Add protection to few more methods of AudioDeviceLinuxALSA. Those methods can be called from

a different thread.

One example is the _playWarning can be changed in AudioDeviceLinuxALSA::Init, which is called on the application's thread. At the same time it can be read via PlayoutWarning() on the VoE's process_thread.

RISK=P2
TESTED=try bots and tsan test:
tools/valgrind-webrtc/webrtc_tests.sh --tool=tsan -t out/Debug/libjingle_peerconnection_unittest --gtest_filter=PeerConnectionFactoryTestInternal.CreatePCUsingInternalModules
BUG=1205
R=xians@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/2315004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4866 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
wu@webrtc.org
2013-09-27 18:19:25 +00:00
parent 137b3793d9
commit 6049787252
2 changed files with 37 additions and 69 deletions

View File

@ -51,46 +51,6 @@
#-----------------------------------------------------------------------
# 2. libjingle stuff (talk folder)
{
bug_1205_1
ThreadSanitizer:Race
fun:webrtc::AudioDeviceLinuxALSA::PlayoutWarning
fun:webrtc::AudioDeviceModuleImpl::Process
fun:webrtc::ProcessThreadImpl::Process
fun:webrtc::ProcessThreadImpl::Run
fun:webrtc::ThreadPosix::Run
fun:StartThread
}
{
bug_1205_2
ThreadSanitizer:Race
fun:webrtc::AudioDeviceLinuxALSA::PlayoutError
fun:webrtc::AudioDeviceModuleImpl::Process
fun:webrtc::ProcessThreadImpl::Process
fun:webrtc::ProcessThreadImpl::Run
fun:webrtc::ThreadPosix::Run
fun:StartThread
}
{
bug_1205_3
ThreadSanitizer:Race
fun:webrtc::AudioDeviceLinuxALSA::RecordingWarning
fun:webrtc::AudioDeviceModuleImpl::Process
fun:webrtc::ProcessThreadImpl::Process
fun:webrtc::ProcessThreadImpl::Run
fun:webrtc::ThreadPosix::Run
fun:StartThread
}
{
bug_1205_4
ThreadSanitizer:Race
fun:webrtc::AudioDeviceLinuxALSA::RecordingError
fun:webrtc::AudioDeviceModuleImpl::Process
fun:webrtc::ProcessThreadImpl::Process
fun:webrtc::ProcessThreadImpl::Run
fun:webrtc::ThreadPosix::Run
fun:StartThread
}
{
bug_1205_5
ThreadSanitizer:Race

View File

@ -1782,41 +1782,49 @@ int32_t AudioDeviceLinuxALSA::CPULoad(uint16_t& load) const
bool AudioDeviceLinuxALSA::PlayoutWarning() const
{
CriticalSectionScoped lock(&_critSect);
return (_playWarning > 0);
}
bool AudioDeviceLinuxALSA::PlayoutError() const
{
CriticalSectionScoped lock(&_critSect);
return (_playError > 0);
}
bool AudioDeviceLinuxALSA::RecordingWarning() const
{
CriticalSectionScoped lock(&_critSect);
return (_recWarning > 0);
}
bool AudioDeviceLinuxALSA::RecordingError() const
{
CriticalSectionScoped lock(&_critSect);
return (_recError > 0);
}
void AudioDeviceLinuxALSA::ClearPlayoutWarning()
{
CriticalSectionScoped lock(&_critSect);
_playWarning = 0;
}
void AudioDeviceLinuxALSA::ClearPlayoutError()
{
CriticalSectionScoped lock(&_critSect);
_playError = 0;
}
void AudioDeviceLinuxALSA::ClearRecordingWarning()
{
CriticalSectionScoped lock(&_critSect);
_recWarning = 0;
}
void AudioDeviceLinuxALSA::ClearRecordingError()
{
CriticalSectionScoped lock(&_critSect);
_recError = 0;
}