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 b32680bfc58fda332344d720745ff5d12f0fba9f..533f067f345cfcb450da68bf82bf753cb2b0dfcb 100644 |
--- a/webrtc/modules/audio_processing/gain_control_impl.cc |
+++ b/webrtc/modules/audio_processing/gain_control_impl.cc |
@@ -38,11 +38,16 @@ int16_t MapSetting(GainControl::Mode mode) { |
const size_t GainControlImpl::kAllowedValuesOfSamplesPerFrame1; |
const size_t GainControlImpl::kAllowedValuesOfSamplesPerFrame2; |
-GainControlImpl::GainControlImpl(const AudioProcessing* apm, |
- CriticalSectionWrapper* crit) |
+GainControlImpl::GainControlImpl( |
+ const AudioProcessing* apm, |
+ CriticalSectionWrapper* crit, |
+ const rtc::ThreadChecker* render_thread_checker, |
+ const rtc::ThreadChecker* capture_thread_checker) |
: ProcessingComponent(), |
apm_(apm), |
crit_(crit), |
+ render_thread_checker_(render_thread_checker), |
+ capture_thread_checker_(capture_thread_checker), |
mode_(kAdaptiveAnalog), |
minimum_capture_level_(0), |
maximum_capture_level_(255), |
@@ -59,6 +64,7 @@ GainControlImpl::GainControlImpl(const AudioProcessing* apm, |
GainControlImpl::~GainControlImpl() {} |
int GainControlImpl::ProcessRenderAudio(AudioBuffer* audio) { |
+ RTC_DCHECK(render_thread_checker_->CalledOnValidThread()); |
if (!is_component_enabled()) { |
return apm_->kNoError; |
} |
@@ -213,6 +219,7 @@ int GainControlImpl::ProcessCaptureAudio(AudioBuffer* audio) { |
// TODO(ajm): ensure this is called under kAdaptiveAnalog. |
int GainControlImpl::set_stream_analog_level(int level) { |
+ RTC_DCHECK(capture_thread_checker_->CalledOnValidThread()); |
// TODO(peah): Verify that this is really needed to do the reading |
// here as well as in ProcessStream. It works since these functions |
// are called from the same thread, but it is not nice to do it in two |
@@ -230,6 +237,7 @@ int GainControlImpl::set_stream_analog_level(int level) { |
} |
int GainControlImpl::stream_analog_level() { |
+ RTC_DCHECK(capture_thread_checker_->CalledOnValidThread()); |
// TODO(ajm): enable this assertion? |
//assert(mode_ == kAdaptiveAnalog); |