Bug 1547354 - Hold mMutex during stats calls; r=ng

We did this for the VideoConduit in Bug 1404992, but not for the AudioConduit
because of the ongoing webrtc.org upstream merge.

Differential Revision: https://phabricator.services.mozilla.com/D59424

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dan Minor 2020-01-10 15:08:04 +00:00
Родитель f49c4414d3
Коммит 4e67f4e69b
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -158,6 +158,7 @@ void WebrtcAudioConduit::SetSyncGroup(const std::string& group) {
bool WebrtcAudioConduit::GetSendPacketTypeStats(
webrtc::RtcpPacketTypeCounter* aPacketCounts) {
ASSERT_ON_THREAD(mStsThread);
MutexAutoLock lock(mMutex);
if (!mSendStream) {
return false;
}
@ -167,6 +168,7 @@ bool WebrtcAudioConduit::GetSendPacketTypeStats(
bool WebrtcAudioConduit::GetRecvPacketTypeStats(
webrtc::RtcpPacketTypeCounter* aPacketCounts) {
ASSERT_ON_THREAD(mStsThread);
MutexAutoLock lock(mMutex);
if (!mEngineReceiving) {
return false;
}
@ -178,6 +180,7 @@ bool WebrtcAudioConduit::GetRTPReceiverStats(unsigned int* jitterMs,
ASSERT_ON_THREAD(mStsThread);
*jitterMs = 0;
*cumulativeLost = 0;
MutexAutoLock lock(mMutex);
if (!mRecvStream) {
return false;
}
@ -197,6 +200,7 @@ bool WebrtcAudioConduit::GetRTCPReceiverReport(uint32_t* jitterMs,
int64_t timestampTmp = 0;
int64_t rttMsTmp = 0;
bool res = false;
MutexAutoLock lock(mMutex);
if (mSendChannelProxy) {
res = mSendChannelProxy->GetRTCPReceiverStatistics(
&timestampTmp, jitterMs, cumulativeLost, packetsReceived, bytesReceived,
@ -232,6 +236,7 @@ bool WebrtcAudioConduit::GetRTCPReceiverReport(uint32_t* jitterMs,
bool WebrtcAudioConduit::GetRTCPSenderReport(unsigned int* packetsSent,
uint64_t* bytesSent) {
ASSERT_ON_THREAD(mStsThread);
MutexAutoLock lock(mMutex);
if (!mRecvChannelProxy) {
return false;
}