Fix tsan failures in channel.cc regarding to the volume settings.
BUG=2461 TEST=try bots R=xians@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2377004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4992 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
b22049b295
commit
6342066974
@ -47,26 +47,6 @@
|
||||
fun:webrtc::ThreadPosix::Run
|
||||
fun:webrtc::StartThread
|
||||
}
|
||||
{
|
||||
bug_2461_1
|
||||
ThreadSanitizer:Race
|
||||
fun:webrtc::voe::Channel::SetChannelOutputVolumeScaling
|
||||
fun:webrtc::VoEVolumeControlImpl::SetChannelOutputVolumeScaling
|
||||
fun:cricket::WebRtcVoiceMediaChannel::SetOutputScaling
|
||||
fun:cricket::VoiceChannel::SetOutputScaling_w
|
||||
fun:cricket::VoiceChannel::OnMessage
|
||||
...
|
||||
}
|
||||
{
|
||||
bug_2461_2
|
||||
ThreadSanitizer:Race
|
||||
fun:webrtc::voe::Channel::SetOutputVolumePan
|
||||
fun:webrtc::VoEVolumeControlImpl::SetOutputVolumePan
|
||||
fun:cricket::WebRtcVoiceMediaChannel::SetOutputScaling
|
||||
fun:cricket::VoiceChannel::SetOutputScaling_w
|
||||
fun:cricket::VoiceChannel::OnMessage
|
||||
...
|
||||
}
|
||||
{
|
||||
bug_2497
|
||||
ThreadSanitizer:Race
|
||||
@ -146,16 +126,6 @@
|
||||
fun:webrtc::ThreadPosix::Run
|
||||
fun:StartThread
|
||||
}
|
||||
{
|
||||
bug_1205_12
|
||||
ThreadSanitizer:Race
|
||||
fun:webrtc::voe::Channel::GetAudioFrame
|
||||
fun:webrtc::AudioConferenceMixerImpl::UpdateToMix
|
||||
fun:webrtc::AudioConferenceMixerImpl::Process
|
||||
fun:webrtc::voe::OutputMixer::MixActiveChannels
|
||||
fun:webrtc::VoEBaseImpl::NeedMorePlayData
|
||||
...
|
||||
}
|
||||
{
|
||||
bug_1205_22
|
||||
ThreadSanitizer:Race
|
||||
@ -164,23 +134,6 @@
|
||||
fun:webrtc::ThreadPosix::Run
|
||||
fun:StartThread
|
||||
}
|
||||
{
|
||||
bug_1205_25
|
||||
ThreadSanitizer:Race
|
||||
fun:webrtc::AudioCodingModuleImpl::PlayoutData10Ms
|
||||
fun:webrtc::voe::Channel::GetAudioFrame
|
||||
fun:webrtc::AudioConferenceMixerImpl::UpdateToMix
|
||||
fun:webrtc::AudioConferenceMixerImpl::Process
|
||||
fun:webrtc::voe::OutputMixer::MixActiveChannels
|
||||
fun:webrtc::VoEBaseImpl::NeedMorePlayData
|
||||
fun:FakeAudioCaptureModule::ReceiveFrameP
|
||||
fun:FakeAudioCaptureModule::ProcessFrameP
|
||||
fun:FakeAudioCaptureModule::OnMessage
|
||||
fun:talk_base::MessageQueue::Dispatch
|
||||
fun:talk_base::Thread::ProcessMessages
|
||||
fun:talk_base::Thread::Run
|
||||
fun:talk_base::Thread::PreRun
|
||||
}
|
||||
{
|
||||
bug_1205_26
|
||||
ThreadSanitizer:Race
|
||||
|
@ -703,16 +703,26 @@ int32_t Channel::GetAudioFrame(int32_t id, AudioFrame& audioFrame)
|
||||
ApmProcessRx(audioFrame);
|
||||
}
|
||||
|
||||
// Output volume scaling
|
||||
if (_outputGain < 0.99f || _outputGain > 1.01f)
|
||||
float output_gain = 1.0f;
|
||||
float left_pan = 1.0f;
|
||||
float right_pan = 1.0f;
|
||||
{
|
||||
AudioFrameOperations::ScaleWithSat(_outputGain, audioFrame);
|
||||
CriticalSectionScoped cs(&volume_settings_critsect_);
|
||||
output_gain = _outputGain;
|
||||
left_pan = _panLeft;
|
||||
right_pan= _panRight;
|
||||
}
|
||||
|
||||
// Output volume scaling
|
||||
if (output_gain < 0.99f || output_gain > 1.01f)
|
||||
{
|
||||
AudioFrameOperations::ScaleWithSat(output_gain, audioFrame);
|
||||
}
|
||||
|
||||
// Scale left and/or right channel(s) if stereo and master balance is
|
||||
// active
|
||||
|
||||
if (_panLeft != 1.0f || _panRight != 1.0f)
|
||||
if (left_pan != 1.0f || right_pan != 1.0f)
|
||||
{
|
||||
if (audioFrame.num_channels_ == 1)
|
||||
{
|
||||
@ -725,7 +735,7 @@ int32_t Channel::GetAudioFrame(int32_t id, AudioFrame& audioFrame)
|
||||
|
||||
// Do the panning operation (the audio frame contains stereo at this
|
||||
// stage)
|
||||
AudioFrameOperations::Scale(_panLeft, _panRight, audioFrame);
|
||||
AudioFrameOperations::Scale(left_pan, right_pan, audioFrame);
|
||||
}
|
||||
|
||||
// Mix decoded PCM output with file if file mixing is enabled
|
||||
@ -905,6 +915,7 @@ Channel::Channel(int32_t channelId,
|
||||
const Config& config) :
|
||||
_fileCritSect(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
volume_settings_critsect_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_instanceId(instanceId),
|
||||
_channelId(channelId),
|
||||
rtp_header_parser_(RtpHeaderParser::Create()),
|
||||
@ -1103,6 +1114,7 @@ Channel::~Channel()
|
||||
delete [] _decryptionRTCPBufferPtr;
|
||||
delete &_callbackCritSect;
|
||||
delete &_fileCritSect;
|
||||
delete &volume_settings_critsect_;
|
||||
}
|
||||
|
||||
int32_t
|
||||
@ -2957,6 +2969,7 @@ Channel::GetSpeechOutputLevelFullRange(uint32_t& level) const
|
||||
int
|
||||
Channel::SetMute(bool enable)
|
||||
{
|
||||
CriticalSectionScoped cs(&volume_settings_critsect_);
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
|
||||
"Channel::SetMute(enable=%d)", enable);
|
||||
_mute = enable;
|
||||
@ -2966,12 +2979,14 @@ Channel::SetMute(bool enable)
|
||||
bool
|
||||
Channel::Mute() const
|
||||
{
|
||||
CriticalSectionScoped cs(&volume_settings_critsect_);
|
||||
return _mute;
|
||||
}
|
||||
|
||||
int
|
||||
Channel::SetOutputVolumePan(float left, float right)
|
||||
{
|
||||
CriticalSectionScoped cs(&volume_settings_critsect_);
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
|
||||
"Channel::SetOutputVolumePan()");
|
||||
_panLeft = left;
|
||||
@ -2982,6 +2997,7 @@ Channel::SetOutputVolumePan(float left, float right)
|
||||
int
|
||||
Channel::GetOutputVolumePan(float& left, float& right) const
|
||||
{
|
||||
CriticalSectionScoped cs(&volume_settings_critsect_);
|
||||
left = _panLeft;
|
||||
right = _panRight;
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
||||
@ -2993,6 +3009,7 @@ Channel::GetOutputVolumePan(float& left, float& right) const
|
||||
int
|
||||
Channel::SetChannelOutputVolumeScaling(float scaling)
|
||||
{
|
||||
CriticalSectionScoped cs(&volume_settings_critsect_);
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
|
||||
"Channel::SetChannelOutputVolumeScaling()");
|
||||
_outputGain = scaling;
|
||||
@ -3002,6 +3019,7 @@ Channel::SetChannelOutputVolumeScaling(float scaling)
|
||||
int
|
||||
Channel::GetChannelOutputVolumeScaling(float& scaling) const
|
||||
{
|
||||
CriticalSectionScoped cs(&volume_settings_critsect_);
|
||||
scaling = _outputGain;
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
||||
VoEId(_instanceId,_channelId),
|
||||
@ -4397,7 +4415,7 @@ Channel::PrepareEncodeAndSend(int mixingFrequency)
|
||||
MixOrReplaceAudioWithFile(mixingFrequency);
|
||||
}
|
||||
|
||||
if (_mute)
|
||||
if (Mute())
|
||||
{
|
||||
AudioFrameOperations::Mute(_audioFrame);
|
||||
}
|
||||
|
@ -447,6 +447,7 @@ private:
|
||||
|
||||
CriticalSectionWrapper& _fileCritSect;
|
||||
CriticalSectionWrapper& _callbackCritSect;
|
||||
CriticalSectionWrapper& volume_settings_critsect_;
|
||||
uint32_t _instanceId;
|
||||
int32_t _channelId;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user