audio_processing/agc: Put entire method set_output_will_be_muted() under lock
Setting the member value output_will_be_muted_ in set_output_will_be_muted() was done before the lock. This caused a data race. BUG=4477 R=pbos@webrtc.org Review URL: https://webrtc-codereview.appspot.com/44929004 Cr-Commit-Position: refs/heads/master@{#8877}
This commit is contained in:
parent
75a0255627
commit
424694ce79
@ -452,14 +452,15 @@ int AudioProcessingImpl::num_output_channels() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AudioProcessingImpl::set_output_will_be_muted(bool muted) {
|
void AudioProcessingImpl::set_output_will_be_muted(bool muted) {
|
||||||
output_will_be_muted_ = muted;
|
|
||||||
CriticalSectionScoped lock(crit_);
|
CriticalSectionScoped lock(crit_);
|
||||||
|
output_will_be_muted_ = muted;
|
||||||
if (agc_manager_.get()) {
|
if (agc_manager_.get()) {
|
||||||
agc_manager_->SetCaptureMuted(output_will_be_muted_);
|
agc_manager_->SetCaptureMuted(output_will_be_muted_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioProcessingImpl::output_will_be_muted() const {
|
bool AudioProcessingImpl::output_will_be_muted() const {
|
||||||
|
CriticalSectionScoped lock(crit_);
|
||||||
return output_will_be_muted_;
|
return output_will_be_muted_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ class AudioProcessingImpl : public AudioProcessing {
|
|||||||
int delay_offset_ms_;
|
int delay_offset_ms_;
|
||||||
bool was_stream_delay_set_;
|
bool was_stream_delay_set_;
|
||||||
|
|
||||||
bool output_will_be_muted_;
|
bool output_will_be_muted_ GUARDED_BY(crit_);
|
||||||
|
|
||||||
bool key_pressed_;
|
bool key_pressed_;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user