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

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: 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..b82978d19c8a12301735680dd50810b85326817d 100644
--- a/webrtc/modules/audio_processing/gain_control_impl.cc
+++ b/webrtc/modules/audio_processing/gain_control_impl.cc
@@ -336,25 +336,31 @@ 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;
- }
+ size_t num_proc_channels_local = 0u;
+ int sample_rate_hz_local = 0;
+ {
+ rtc::CritScope cs(crit_capture_);
+ if (minimum < 0) {
the sun 2016/03/24 12:29:29 All parameter checking should go first in the func
peah-webrtc 2016/03/24 12:46:40 Good point! Done.
+ return AudioProcessing::kBadParameterError;
+ }
- if (maximum > 65535) {
- return AudioProcessing::kBadParameterError;
- }
+ if (maximum > 65535) {
+ return AudioProcessing::kBadParameterError;
+ }
- if (maximum < minimum) {
- return AudioProcessing::kBadParameterError;
- }
+ if (maximum < minimum) {
+ return AudioProcessing::kBadParameterError;
+ }
- minimum_capture_level_ = minimum;
- maximum_capture_level_ = maximum;
+ minimum_capture_level_ = minimum;
+ maximum_capture_level_ = maximum;
- RTC_DCHECK(num_proc_channels_);
- RTC_DCHECK(sample_rate_hz_);
- Initialize(*num_proc_channels_, *sample_rate_hz_);
+ 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