TSan v2 reports data races in WebRTCAudioDeviceTest.FullDuplexAudioWithAGC
BUG=226044 TEST=content_unittests in Chrome with TSan v2 enabled Review URL: https://webrtc-codereview.appspot.com/1201010 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3760 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -2053,8 +2053,11 @@ WebRtc_Word32 AudioCodingModuleImpl::IncomingPacket(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
{
|
||||||
|
CriticalSectionScoped lock(acm_crit_sect_);
|
||||||
if (track_neteq_buffer_)
|
if (track_neteq_buffer_)
|
||||||
num_bytes_accumulated_ += payload_length;
|
num_bytes_accumulated_ += payload_length;
|
||||||
|
}
|
||||||
return neteq_.RecIn(incoming_payload, payload_length, rtp_header);
|
return neteq_.RecIn(incoming_payload, payload_length, rtp_header);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2136,9 +2139,12 @@ WebRtc_Word32 AudioCodingModuleImpl::SetMinimumPlayoutDelay(
|
|||||||
"Delay must be in the range of 0-10000 milliseconds.");
|
"Delay must be in the range of 0-10000 milliseconds.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
CriticalSectionScoped lock(acm_crit_sect_);
|
||||||
// Don't let the extra delay modified while accumulating buffers in NetEq.
|
// Don't let the extra delay modified while accumulating buffers in NetEq.
|
||||||
if (track_neteq_buffer_ && first_payload_received_)
|
if (track_neteq_buffer_ && first_payload_received_)
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
return neteq_.SetExtraDelay(time_ms);
|
return neteq_.SetExtraDelay(time_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2665,12 +2671,14 @@ WebRtc_Word32 AudioCodingModuleImpl::PlayoutTimestamp(
|
|||||||
WebRtc_UWord32* timestamp) {
|
WebRtc_UWord32* timestamp) {
|
||||||
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
|
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
|
||||||
"PlayoutTimestamp()");
|
"PlayoutTimestamp()");
|
||||||
|
{
|
||||||
|
CriticalSectionScoped lock(acm_crit_sect_);
|
||||||
if (track_neteq_buffer_) {
|
if (track_neteq_buffer_) {
|
||||||
*timestamp = playout_ts_;
|
*timestamp = playout_ts_;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
|
||||||
return neteq_.PlayoutTimestamp(*timestamp);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return neteq_.PlayoutTimestamp(*timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioCodingModuleImpl::HaveValidEncoder(const char* caller_name) const {
|
bool AudioCodingModuleImpl::HaveValidEncoder(const char* caller_name) const {
|
||||||
|
|||||||
@@ -56,7 +56,18 @@ TransmitMixer::OnPeriodicProcess()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool saturationWarning = false;
|
||||||
|
{
|
||||||
|
// Modify |_saturationWarning| under lock to avoid conflict with write op
|
||||||
|
// in ProcessAudio and also ensure that we don't hold the lock during the
|
||||||
|
// callback.
|
||||||
|
CriticalSectionScoped cs(&_critSect);
|
||||||
|
saturationWarning = _saturationWarning;
|
||||||
if (_saturationWarning)
|
if (_saturationWarning)
|
||||||
|
_saturationWarning = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (saturationWarning)
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(&_callbackCritSect);
|
CriticalSectionScoped cs(&_callbackCritSect);
|
||||||
if (_voiceEngineObserverPtr)
|
if (_voiceEngineObserverPtr)
|
||||||
@@ -66,7 +77,6 @@ TransmitMixer::OnPeriodicProcess()
|
|||||||
" CallbackOnError(VE_SATURATION_WARNING)");
|
" CallbackOnError(VE_SATURATION_WARNING)");
|
||||||
_voiceEngineObserverPtr->CallbackOnError(-1, VE_SATURATION_WARNING);
|
_voiceEngineObserverPtr->CallbackOnError(-1, VE_SATURATION_WARNING);
|
||||||
}
|
}
|
||||||
_saturationWarning = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,6 +464,7 @@ TransmitMixer::EncodeAndSend()
|
|||||||
|
|
||||||
WebRtc_UWord32 TransmitMixer::CaptureLevel() const
|
WebRtc_UWord32 TransmitMixer::CaptureLevel() const
|
||||||
{
|
{
|
||||||
|
CriticalSectionScoped cs(&_critSect);
|
||||||
return _captureLevel;
|
return _captureLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1311,6 +1322,8 @@ void TransmitMixer::ProcessAudio(int delay_ms, int clock_drift,
|
|||||||
LOG(LS_ERROR) << "ProcessStream() error: " << err;
|
LOG(LS_ERROR) << "ProcessStream() error: " << err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CriticalSectionScoped cs(&_critSect);
|
||||||
|
|
||||||
// Store new capture level. Only updated when analog AGC is enabled.
|
// Store new capture level. Only updated when analog AGC is enabled.
|
||||||
_captureLevel = agc->stream_analog_level();
|
_captureLevel = agc->stream_analog_level();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user