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

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

Issue 1422013002: Preparational work for an upcoming addition of a threadchecking scheme for APM (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@bundling_of_state_CL
Patch Set: Created 5 years, 2 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
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 7205bf1934e9c504b828bdb7786f338d9fc62f7a..c353b2aaf934b6b61e0ffd635046c9ea9ea6f796 100644
--- a/webrtc/modules/audio_processing/gain_control_impl.cc
+++ b/webrtc/modules/audio_processing/gain_control_impl.cc
@@ -39,10 +39,14 @@ const size_t GainControlImpl::kAllowedValuesOfSamplesPerFrame1;
const size_t GainControlImpl::kAllowedValuesOfSamplesPerFrame2;
GainControlImpl::GainControlImpl(const AudioProcessing* apm,
- CriticalSectionWrapper* crit)
+ CriticalSectionWrapper* crit,
+ rtc::ThreadChecker* render_thread,
+ rtc::ThreadChecker* capture_thread)
: ProcessingComponent(),
apm_(apm),
crit_(crit),
+ render_thread_(render_thread),
+ capture_thread_(capture_thread),
mode_(kAdaptiveAnalog),
minimum_capture_level_(0),
maximum_capture_level_(255),
@@ -59,6 +63,7 @@ GainControlImpl::GainControlImpl(const AudioProcessing* apm,
GainControlImpl::~GainControlImpl() {}
int GainControlImpl::ProcessRenderAudio(AudioBuffer* audio) {
+ RTC_DCHECK(render_thread_->CalledOnValidThread());
if (!is_component_enabled()) {
return apm_->kNoError;
}
@@ -94,6 +99,7 @@ int GainControlImpl::ProcessRenderAudio(AudioBuffer* audio) {
// Read chunks of data that were received and queued on the render side from
// a queue. All the data chunks are buffered into the farend signal of the AGC.
void GainControlImpl::ReadQueuedRenderData() {
+ RTC_DCHECK(capture_thread_->CalledOnValidThread());
if (!is_component_enabled()) {
return;
}
@@ -115,6 +121,7 @@ void GainControlImpl::ReadQueuedRenderData() {
}
int GainControlImpl::AnalyzeCaptureAudio(AudioBuffer* audio) {
+ RTC_DCHECK(capture_thread_->CalledOnValidThread());
if (!is_component_enabled()) {
return apm_->kNoError;
}
@@ -165,6 +172,7 @@ int GainControlImpl::AnalyzeCaptureAudio(AudioBuffer* audio) {
}
int GainControlImpl::ProcessCaptureAudio(AudioBuffer* audio) {
+ RTC_DCHECK(capture_thread_->CalledOnValidThread());
if (!is_component_enabled()) {
return apm_->kNoError;
}
@@ -219,6 +227,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_->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
@@ -236,6 +245,7 @@ int GainControlImpl::set_stream_analog_level(int level) {
}
int GainControlImpl::stream_analog_level() {
+ RTC_DCHECK(capture_thread_->CalledOnValidThread());
// TODO(ajm): enable this assertion?
//assert(mode_ == kAdaptiveAnalog);

Powered by Google App Engine
This is Rietveld 408576698