Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: webrtc/modules/audio_processing/gain_control_impl.cc

Issue 1827013002: Fixed a potential deadlock problem in the AGC. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Moved parameter checks to outside of the critical section Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_processing/gain_control_impl.cc
diff --git a/webrtc/modules/audio_processing/gain_control_impl.cc b/webrtc/modules/audio_processing/gain_control_impl.cc
index db1c585ca95962f5140e7430daedc1683ca21f8e..d190284063cc1861f26175df90b5d7772a3fdc3f 100644
--- a/webrtc/modules/audio_processing/gain_control_impl.cc
+++ b/webrtc/modules/audio_processing/gain_control_impl.cc
@@ -336,7 +336,6 @@ GainControl::Mode GainControlImpl::mode() const {
int GainControlImpl::set_analog_level_limits(int minimum,
int maximum) {
- rtc::CritScope cs(crit_capture_);
if (minimum < 0) {
return AudioProcessing::kBadParameterError;
}
@@ -349,12 +348,20 @@ int GainControlImpl::set_analog_level_limits(int minimum,
return AudioProcessing::kBadParameterError;
}
- minimum_capture_level_ = minimum;
- maximum_capture_level_ = maximum;
+ size_t num_proc_channels_local = 0u;
+ int sample_rate_hz_local = 0;
+ {
+ rtc::CritScope cs(crit_capture_);
- RTC_DCHECK(num_proc_channels_);
- RTC_DCHECK(sample_rate_hz_);
- Initialize(*num_proc_channels_, *sample_rate_hz_);
+ minimum_capture_level_ = minimum;
+ maximum_capture_level_ = maximum;
+
+ RTC_DCHECK(num_proc_channels_);
+ RTC_DCHECK(sample_rate_hz_);
+ num_proc_channels_local = *num_proc_channels_;
+ sample_rate_hz_local = *sample_rate_hz_;
+ }
+ Initialize(num_proc_channels_local, sample_rate_hz_local);
return AudioProcessing::kNoError;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698