From 7f4dfa4106c96a90de247d965ddf942fe834db59 Mon Sep 17 00:00:00 2001 From: Sam Zackrisson Date: Thu, 1 Nov 2018 08:59:29 +0100 Subject: [PATCH] Remove locks from AEC2 and move it into private_submodules_ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This drops the locks and annotations in EchoCancellationImpl, now that the interface is no longer externally accessible. Bug: webrtc:9929 Change-Id: I401256f523340cbabce23a5914ab28ce44179935 Reviewed-on: https://webrtc-review.googlesource.com/c/108602 Commit-Queue: Sam Zackrisson Reviewed-by: Per Ã…hgren Cr-Commit-Position: refs/heads/master@{#25460} --- .../audio_processing/audio_processing_impl.cc | 61 +++++++++-------- .../echo_cancellation_bit_exact_unittest.cc | 4 +- .../echo_cancellation_impl.cc | 65 +++---------------- .../audio_processing/echo_cancellation_impl.h | 30 ++++----- .../echo_cancellation_impl_unittest.cc | 12 +--- 5 files changed, 55 insertions(+), 117 deletions(-) diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc index 3207a59bfa..876911c846 100644 --- a/modules/audio_processing/audio_processing_impl.cc +++ b/modules/audio_processing/audio_processing_impl.cc @@ -227,7 +227,6 @@ bool AudioProcessingImpl::ApmSubmoduleStates::LowCutFilteringRequired() const { struct AudioProcessingImpl::ApmPublicSubmodules { ApmPublicSubmodules() {} // Accessed externally of APM without any lock acquired. - std::unique_ptr echo_cancellation; std::unique_ptr echo_control_mobile; std::unique_ptr gain_control; std::unique_ptr level_estimator; @@ -255,6 +254,7 @@ struct AudioProcessingImpl::ApmPrivateSubmodules { std::unique_ptr low_cut_filter; rtc::scoped_refptr echo_detector; std::unique_ptr echo_controller; + std::unique_ptr echo_cancellation; std::unique_ptr capture_post_processor; std::unique_ptr render_pre_processor; std::unique_ptr pre_amplifier; @@ -367,8 +367,7 @@ AudioProcessingImpl::AudioProcessingImpl( capture_nonlocked_.echo_controller_enabled = static_cast(echo_control_factory_); - public_submodules_->echo_cancellation.reset( - new EchoCancellationImpl(&crit_render_, &crit_capture_)); + private_submodules_->echo_cancellation.reset(new EchoCancellationImpl()); public_submodules_->echo_control_mobile.reset( new EchoControlMobileImpl(&crit_render_, &crit_capture_)); public_submodules_->gain_control.reset( @@ -507,14 +506,14 @@ int AudioProcessingImpl::InitializeLocked() { formats_.api_format.output_stream().num_channels(), formats_.api_format.output_stream().num_frames())); - public_submodules_->echo_cancellation->Initialize( + private_submodules_->echo_cancellation->Initialize( proc_sample_rate_hz(), num_reverse_channels(), num_output_channels(), num_proc_channels()); AllocateRenderQueue(); - int success = public_submodules_->echo_cancellation->enable_metrics(true); + int success = private_submodules_->echo_cancellation->enable_metrics(true); RTC_DCHECK_EQ(0, success); - success = public_submodules_->echo_cancellation->enable_delay_logging(true); + success = private_submodules_->echo_cancellation->enable_delay_logging(true); RTC_DCHECK_EQ(0, success); public_submodules_->echo_control_mobile->Initialize( proc_split_sample_rate_hz(), num_reverse_channels(), @@ -645,12 +644,12 @@ void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) { config_ = config; - public_submodules_->echo_cancellation->Enable( + private_submodules_->echo_cancellation->Enable( config_.echo_canceller.enabled && !config_.echo_canceller.mobile_mode); public_submodules_->echo_control_mobile->Enable( config_.echo_canceller.enabled && config_.echo_canceller.mobile_mode); - public_submodules_->echo_cancellation->set_suppression_level( + private_submodules_->echo_cancellation->set_suppression_level( config.echo_canceller.legacy_moderate_suppression_level ? EchoCancellationImpl::SuppressionLevel::kModerateSuppression : EchoCancellationImpl::SuppressionLevel::kHighSuppression); @@ -682,7 +681,7 @@ void AudioProcessingImpl::SetExtraOptions(const webrtc::Config& config) { rtc::CritScope cs_render(&crit_render_); rtc::CritScope cs_capture(&crit_capture_); - public_submodules_->echo_cancellation->SetExtraOptions(config); + private_submodules_->echo_cancellation->SetExtraOptions(config); if (capture_.transient_suppressor_enabled != config.Get().enabled) { @@ -1059,7 +1058,7 @@ void AudioProcessingImpl::AllocateRenderQueue() { void AudioProcessingImpl::EmptyQueuedRenderAudio() { rtc::CritScope cs_capture(&crit_capture_); while (aec_render_signal_queue_->Remove(&aec_capture_queue_buffer_)) { - public_submodules_->echo_cancellation->ProcessRenderAudio( + private_submodules_->echo_cancellation->ProcessRenderAudio( aec_capture_queue_buffer_); } @@ -1157,7 +1156,7 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() { // Ensure that not both the AEC and AECM are active at the same time. // TODO(peah): Simplify once the public API Enable functions for these // are moved to APM. - RTC_DCHECK(!(public_submodules_->echo_cancellation->is_enabled() && + RTC_DCHECK(!(private_submodules_->echo_cancellation->is_enabled() && public_submodules_->echo_control_mobile->is_enabled())); MaybeUpdateHistograms(); @@ -1242,7 +1241,7 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() { // Ensure that the stream delay was set before the call to the // AEC ProcessCaptureAudio function. - if (public_submodules_->echo_cancellation->is_enabled() && + if (private_submodules_->echo_cancellation->is_enabled() && !private_submodules_->echo_controller && !was_stream_delay_set()) { return AudioProcessing::kStreamParameterNotSetError; } @@ -1258,7 +1257,7 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() { private_submodules_->echo_controller->ProcessCapture( capture_buffer, capture_.echo_path_gain_change); } else { - RETURN_ON_ERR(public_submodules_->echo_cancellation->ProcessCaptureAudio( + RETURN_ON_ERR(private_submodules_->echo_cancellation->ProcessCaptureAudio( capture_buffer, stream_delay_ms())); } @@ -1276,7 +1275,7 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() { } if (!(private_submodules_->echo_controller || - public_submodules_->echo_cancellation->is_enabled())) { + private_submodules_->echo_cancellation->is_enabled())) { RETURN_ON_ERR(public_submodules_->echo_control_mobile->ProcessCaptureAudio( capture_buffer, stream_delay_ms())); } @@ -1292,7 +1291,7 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() { } RETURN_ON_ERR(public_submodules_->gain_control->ProcessCaptureAudio( capture_buffer, - public_submodules_->echo_cancellation->stream_has_echo())); + private_submodules_->echo_cancellation->stream_has_echo())); if (submodule_states_.CaptureMultiBandProcessingActive() && SampleRateSupportsMultiBand( @@ -1627,7 +1626,7 @@ AudioProcessing::AudioProcessingStatistics AudioProcessingImpl::GetStatistics() // Instant value will also be used for min, max and average. stats.echo_return_loss.Set(erl, erl, erl, erl); stats.echo_return_loss_enhancement.Set(erle, erle, erle, erle); - } else if (public_submodules_->echo_cancellation->GetMetrics(&metrics) == + } else if (private_submodules_->echo_cancellation->GetMetrics(&metrics) == Error::kNoError) { stats.a_nlp.Set(metrics.a_nlp); stats.divergent_filter_fraction = metrics.divergent_filter_fraction; @@ -1641,7 +1640,7 @@ AudioProcessing::AudioProcessingStatistics AudioProcessingImpl::GetStatistics() stats.residual_echo_likelihood = ed_metrics.echo_likelihood; stats.residual_echo_likelihood_recent_max = ed_metrics.echo_likelihood_recent_max; - public_submodules_->echo_cancellation->GetDelayMetrics( + private_submodules_->echo_cancellation->GetDelayMetrics( &stats.delay_median, &stats.delay_standard_deviation, &stats.fraction_poor_delays); return stats; @@ -1659,7 +1658,7 @@ AudioProcessingStats AudioProcessingImpl::GetStatistics( stats.echo_return_loss_enhancement = ec_metrics.echo_return_loss_enhancement; stats.delay_ms = ec_metrics.delay_ms; - } else if (public_submodules_->echo_cancellation->GetMetrics(&metrics) == + } else if (private_submodules_->echo_cancellation->GetMetrics(&metrics) == Error::kNoError) { if (metrics.divergent_filter_fraction != -1.0f) { stats.divergent_filter_fraction = @@ -1683,7 +1682,7 @@ AudioProcessingStats AudioProcessingImpl::GetStatistics( } int delay_median, delay_std; float fraction_poor_delays; - if (public_submodules_->echo_cancellation->GetDelayMetrics( + if (private_submodules_->echo_cancellation->GetDelayMetrics( &delay_median, &delay_std, &fraction_poor_delays) == Error::kNoError) { if (delay_median >= 0) { @@ -1733,7 +1732,7 @@ AudioProcessing::Config AudioProcessingImpl::GetConfig() const { bool AudioProcessingImpl::UpdateActiveSubmoduleStates() { return submodule_states_.Update( config_.high_pass_filter.enabled, - public_submodules_->echo_cancellation->is_enabled(), + private_submodules_->echo_cancellation->is_enabled(), public_submodules_->echo_control_mobile->is_enabled(), config_.residual_echo_detector.enabled, public_submodules_->noise_suppression->is_enabled(), @@ -1821,15 +1820,15 @@ void AudioProcessingImpl::InitializePreProcessor() { void AudioProcessingImpl::MaybeUpdateHistograms() { static const int kMinDiffDelayMs = 60; - if (public_submodules_->echo_cancellation->is_enabled()) { + if (private_submodules_->echo_cancellation->is_enabled()) { // Activate delay_jumps_ counters if we know echo_cancellation is running. // If a stream has echo we know that the echo_cancellation is in process. if (capture_.stream_delay_jumps == -1 && - public_submodules_->echo_cancellation->stream_has_echo()) { + private_submodules_->echo_cancellation->stream_has_echo()) { capture_.stream_delay_jumps = 0; } if (capture_.aec_system_delay_jumps == -1 && - public_submodules_->echo_cancellation->stream_has_echo()) { + private_submodules_->echo_cancellation->stream_has_echo()) { capture_.aec_system_delay_jumps = 0; } @@ -1852,7 +1851,7 @@ void AudioProcessingImpl::MaybeUpdateHistograms() { rtc::CheckedDivExact(capture_nonlocked_.split_rate, 1000); RTC_DCHECK_LT(0, samples_per_ms); const int aec_system_delay_ms = - public_submodules_->echo_cancellation->GetSystemDelayInSamples() / + private_submodules_->echo_cancellation->GetSystemDelayInSamples() / samples_per_ms; const int diff_aec_system_delay_ms = aec_system_delay_ms - capture_.last_aec_system_delay_ms; @@ -1896,7 +1895,7 @@ void AudioProcessingImpl::WriteAecDumpConfigMessage(bool forced) { return; } std::string experiments_description = - public_submodules_->echo_cancellation->GetExperimentsDescription(); + private_submodules_->echo_cancellation->GetExperimentsDescription(); // TODO(peah): Add semicolon-separated concatenations of experiment // descriptions for other submodules. if (constants_.agc_clipped_level_min != kClippedLevelMin) { @@ -1911,15 +1910,15 @@ void AudioProcessingImpl::WriteAecDumpConfigMessage(bool forced) { InternalAPMConfig apm_config; - apm_config.aec_enabled = public_submodules_->echo_cancellation->is_enabled(); + apm_config.aec_enabled = private_submodules_->echo_cancellation->is_enabled(); apm_config.aec_delay_agnostic_enabled = - public_submodules_->echo_cancellation->is_delay_agnostic_enabled(); + private_submodules_->echo_cancellation->is_delay_agnostic_enabled(); apm_config.aec_drift_compensation_enabled = - public_submodules_->echo_cancellation->is_drift_compensation_enabled(); + private_submodules_->echo_cancellation->is_drift_compensation_enabled(); apm_config.aec_extended_filter_enabled = - public_submodules_->echo_cancellation->is_extended_filter_enabled(); + private_submodules_->echo_cancellation->is_extended_filter_enabled(); apm_config.aec_suppression_level = static_cast( - public_submodules_->echo_cancellation->suppression_level()); + private_submodules_->echo_cancellation->suppression_level()); apm_config.aecm_enabled = public_submodules_->echo_control_mobile->is_enabled(); @@ -2001,7 +2000,7 @@ void AudioProcessingImpl::RecordAudioProcessingState() { AecDump::AudioProcessingState audio_proc_state; audio_proc_state.delay = capture_nonlocked_.stream_delay_ms; audio_proc_state.drift = - public_submodules_->echo_cancellation->stream_drift_samples(); + private_submodules_->echo_cancellation->stream_drift_samples(); audio_proc_state.level = gain_control()->stream_analog_level(); audio_proc_state.keypress = capture_.key_pressed; aec_dump_->AddAudioProcessingState(audio_proc_state); diff --git a/modules/audio_processing/echo_cancellation_bit_exact_unittest.cc b/modules/audio_processing/echo_cancellation_bit_exact_unittest.cc index 7f60c4b5d8..af0741ee17 100644 --- a/modules/audio_processing/echo_cancellation_bit_exact_unittest.cc +++ b/modules/audio_processing/echo_cancellation_bit_exact_unittest.cc @@ -74,9 +74,7 @@ void RunBitexactnessTest( EchoCancellationImpl::SuppressionLevel suppression_level, bool stream_has_echo_reference, const rtc::ArrayView& output_reference) { - rtc::CriticalSection crit_render; - rtc::CriticalSection crit_capture; - EchoCancellationImpl echo_canceller(&crit_render, &crit_capture); + EchoCancellationImpl echo_canceller; SetupComponent(sample_rate_hz, suppression_level, drift_compensation_enabled, &echo_canceller); diff --git a/modules/audio_processing/echo_cancellation_impl.cc b/modules/audio_processing/echo_cancellation_impl.cc index e23cd02957..73fe51b752 100644 --- a/modules/audio_processing/echo_cancellation_impl.cc +++ b/modules/audio_processing/echo_cancellation_impl.cc @@ -105,11 +105,8 @@ class EchoCancellationImpl::Canceller { void* state_; }; -EchoCancellationImpl::EchoCancellationImpl(rtc::CriticalSection* crit_render, - rtc::CriticalSection* crit_capture) - : crit_render_(crit_render), - crit_capture_(crit_capture), - drift_compensation_enabled_(false), +EchoCancellationImpl::EchoCancellationImpl() + : drift_compensation_enabled_(false), metrics_enabled_(true), suppression_level_(kHighSuppression), stream_drift_samples_(0), @@ -118,16 +115,12 @@ EchoCancellationImpl::EchoCancellationImpl(rtc::CriticalSection* crit_render, delay_logging_enabled_(true), extended_filter_enabled_(false), delay_agnostic_enabled_(false), - enforce_zero_stream_delay_(EnforceZeroStreamDelay()) { - RTC_DCHECK(crit_render); - RTC_DCHECK(crit_capture); -} + enforce_zero_stream_delay_(EnforceZeroStreamDelay()) {} EchoCancellationImpl::~EchoCancellationImpl() = default; void EchoCancellationImpl::ProcessRenderAudio( rtc::ArrayView packed_render_audio) { - rtc::CritScope cs_capture(crit_capture_); if (!enabled_) { return; } @@ -151,7 +144,6 @@ void EchoCancellationImpl::ProcessRenderAudio( int EchoCancellationImpl::ProcessCaptureAudio(AudioBuffer* audio, int stream_delay_ms) { - rtc::CritScope cs_capture(crit_capture_); if (!enabled_) { return AudioProcessing::kNoError; } @@ -208,10 +200,6 @@ int EchoCancellationImpl::ProcessCaptureAudio(AudioBuffer* audio, } int EchoCancellationImpl::Enable(bool enable) { - // Run in a single-threaded manner. - rtc::CritScope cs_render(crit_render_); - rtc::CritScope cs_capture(crit_capture_); - if (enable && !enabled_) { enabled_ = enable; // Must be set before Initialize() is called. @@ -229,68 +217,52 @@ int EchoCancellationImpl::Enable(bool enable) { } bool EchoCancellationImpl::is_enabled() const { - rtc::CritScope cs(crit_capture_); return enabled_; } int EchoCancellationImpl::set_suppression_level(SuppressionLevel level) { - { - if (MapSetting(level) == -1) { - return AudioProcessing::kBadParameterError; - } - rtc::CritScope cs(crit_capture_); - suppression_level_ = level; + if (MapSetting(level) == -1) { + return AudioProcessing::kBadParameterError; } + suppression_level_ = level; return Configure(); } EchoCancellationImpl::SuppressionLevel EchoCancellationImpl::suppression_level() const { - rtc::CritScope cs(crit_capture_); return suppression_level_; } int EchoCancellationImpl::enable_drift_compensation(bool enable) { - { - rtc::CritScope cs(crit_capture_); - drift_compensation_enabled_ = enable; - } + drift_compensation_enabled_ = enable; return Configure(); } bool EchoCancellationImpl::is_drift_compensation_enabled() const { - rtc::CritScope cs(crit_capture_); return drift_compensation_enabled_; } void EchoCancellationImpl::set_stream_drift_samples(int drift) { - rtc::CritScope cs(crit_capture_); was_stream_drift_set_ = true; stream_drift_samples_ = drift; } int EchoCancellationImpl::stream_drift_samples() const { - rtc::CritScope cs(crit_capture_); return stream_drift_samples_; } int EchoCancellationImpl::enable_metrics(bool enable) { - { - rtc::CritScope cs(crit_capture_); - metrics_enabled_ = enable; - } + metrics_enabled_ = enable; return Configure(); } bool EchoCancellationImpl::are_metrics_enabled() const { - rtc::CritScope cs(crit_capture_); return enabled_ && metrics_enabled_; } // TODO(ajm): we currently just use the metrics from the first AEC. Think more // aboue the best way to extend this to multi-channel. int EchoCancellationImpl::GetMetrics(Metrics* metrics) { - rtc::CritScope cs(crit_capture_); if (metrics == NULL) { return AudioProcessing::kNullPointerError; } @@ -333,46 +305,36 @@ int EchoCancellationImpl::GetMetrics(Metrics* metrics) { } bool EchoCancellationImpl::stream_has_echo() const { - rtc::CritScope cs(crit_capture_); return stream_has_echo_; } int EchoCancellationImpl::enable_delay_logging(bool enable) { - { - rtc::CritScope cs(crit_capture_); - delay_logging_enabled_ = enable; - } + delay_logging_enabled_ = enable; return Configure(); } bool EchoCancellationImpl::is_delay_logging_enabled() const { - rtc::CritScope cs(crit_capture_); return enabled_ && delay_logging_enabled_; } bool EchoCancellationImpl::is_delay_agnostic_enabled() const { - rtc::CritScope cs(crit_capture_); return delay_agnostic_enabled_; } std::string EchoCancellationImpl::GetExperimentsDescription() { - rtc::CritScope cs(crit_capture_); return refined_adaptive_filter_enabled_ ? "RefinedAdaptiveFilter;" : ""; } bool EchoCancellationImpl::is_refined_adaptive_filter_enabled() const { - rtc::CritScope cs(crit_capture_); return refined_adaptive_filter_enabled_; } bool EchoCancellationImpl::is_extended_filter_enabled() const { - rtc::CritScope cs(crit_capture_); return extended_filter_enabled_; } // TODO(bjornv): How should we handle the multi-channel case? int EchoCancellationImpl::GetDelayMetrics(int* median, int* std) { - rtc::CritScope cs(crit_capture_); float fraction_poor_delays = 0; return GetDelayMetrics(median, std, &fraction_poor_delays); } @@ -380,7 +342,6 @@ int EchoCancellationImpl::GetDelayMetrics(int* median, int* std) { int EchoCancellationImpl::GetDelayMetrics(int* median, int* std, float* fraction_poor_delays) { - rtc::CritScope cs(crit_capture_); if (median == NULL) { return AudioProcessing::kNullPointerError; } @@ -402,7 +363,6 @@ int EchoCancellationImpl::GetDelayMetrics(int* median, } struct AecCore* EchoCancellationImpl::aec_core() const { - rtc::CritScope cs(crit_capture_); if (!enabled_) { return NULL; } @@ -413,9 +373,6 @@ void EchoCancellationImpl::Initialize(int sample_rate_hz, size_t num_reverse_channels, size_t num_output_channels, size_t num_proc_channels) { - rtc::CritScope cs_render(crit_render_); - rtc::CritScope cs_capture(crit_capture_); - stream_properties_.reset( new StreamProperties(sample_rate_hz, num_reverse_channels, num_output_channels, num_proc_channels)); @@ -444,7 +401,6 @@ void EchoCancellationImpl::Initialize(int sample_rate_hz, } int EchoCancellationImpl::GetSystemDelayInSamples() const { - rtc::CritScope cs(crit_capture_); RTC_DCHECK(enabled_); // Report the delay for the first AEC component. return WebRtcAec_system_delay(WebRtcAec_aec_core(cancellers_[0]->state())); @@ -473,7 +429,6 @@ void EchoCancellationImpl::PackRenderAudioBuffer( void EchoCancellationImpl::SetExtraOptions(const webrtc::Config& config) { { - rtc::CritScope cs(crit_capture_); extended_filter_enabled_ = config.Get().enabled; delay_agnostic_enabled_ = config.Get().enabled; refined_adaptive_filter_enabled_ = @@ -483,8 +438,6 @@ void EchoCancellationImpl::SetExtraOptions(const webrtc::Config& config) { } int EchoCancellationImpl::Configure() { - rtc::CritScope cs_render(crit_render_); - rtc::CritScope cs_capture(crit_capture_); AecConfig config; config.metricsMode = metrics_enabled_; config.nlpMode = MapSetting(suppression_level_); diff --git a/modules/audio_processing/echo_cancellation_impl.h b/modules/audio_processing/echo_cancellation_impl.h index 34bd0bf856..72c7e52a77 100644 --- a/modules/audio_processing/echo_cancellation_impl.h +++ b/modules/audio_processing/echo_cancellation_impl.h @@ -32,8 +32,7 @@ class AudioBuffer; // for PC and IP phone applications. class EchoCancellationImpl { public: - EchoCancellationImpl(rtc::CriticalSection* crit_render, - rtc::CriticalSection* crit_capture); + explicit EchoCancellationImpl(); ~EchoCancellationImpl(); void ProcessRenderAudio(rtc::ArrayView packed_render_audio); @@ -154,28 +153,23 @@ class EchoCancellationImpl { void AllocateRenderQueue(); int Configure(); - rtc::CriticalSection* const crit_render_ RTC_ACQUIRED_BEFORE(crit_capture_); - rtc::CriticalSection* const crit_capture_; - bool enabled_ = false; - bool drift_compensation_enabled_ RTC_GUARDED_BY(crit_capture_); - bool metrics_enabled_ RTC_GUARDED_BY(crit_capture_); - SuppressionLevel suppression_level_ RTC_GUARDED_BY(crit_capture_); - int stream_drift_samples_ RTC_GUARDED_BY(crit_capture_); - bool was_stream_drift_set_ RTC_GUARDED_BY(crit_capture_); - bool stream_has_echo_ RTC_GUARDED_BY(crit_capture_); - bool delay_logging_enabled_ RTC_GUARDED_BY(crit_capture_); - bool extended_filter_enabled_ RTC_GUARDED_BY(crit_capture_); - bool delay_agnostic_enabled_ RTC_GUARDED_BY(crit_capture_); - bool refined_adaptive_filter_enabled_ RTC_GUARDED_BY(crit_capture_) = false; + bool drift_compensation_enabled_; + bool metrics_enabled_; + SuppressionLevel suppression_level_; + int stream_drift_samples_; + bool was_stream_drift_set_; + bool stream_has_echo_; + bool delay_logging_enabled_; + bool extended_filter_enabled_; + bool delay_agnostic_enabled_; + bool refined_adaptive_filter_enabled_ = false; // Only active on Chrome OS devices. - const bool enforce_zero_stream_delay_ RTC_GUARDED_BY(crit_capture_); + const bool enforce_zero_stream_delay_; std::vector> cancellers_; std::unique_ptr stream_properties_; - - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(EchoCancellationImpl); }; } // namespace webrtc diff --git a/modules/audio_processing/echo_cancellation_impl_unittest.cc b/modules/audio_processing/echo_cancellation_impl_unittest.cc index c50c52f857..9d81c1df3b 100644 --- a/modules/audio_processing/echo_cancellation_impl_unittest.cc +++ b/modules/audio_processing/echo_cancellation_impl_unittest.cc @@ -18,9 +18,7 @@ namespace webrtc { TEST(EchoCancellationInternalTest, ExtendedFilter) { - rtc::CriticalSection crit_render; - rtc::CriticalSection crit_capture; - EchoCancellationImpl echo_canceller(&crit_render, &crit_capture); + EchoCancellationImpl echo_canceller; echo_canceller.Initialize(AudioProcessing::kSampleRate32kHz, 2, 2, 2); EXPECT_TRUE(echo_canceller.aec_core() == nullptr); @@ -51,9 +49,7 @@ TEST(EchoCancellationInternalTest, ExtendedFilter) { } TEST(EchoCancellationInternalTest, DelayAgnostic) { - rtc::CriticalSection crit_render; - rtc::CriticalSection crit_capture; - EchoCancellationImpl echo_canceller(&crit_render, &crit_capture); + EchoCancellationImpl echo_canceller; echo_canceller.Initialize(AudioProcessing::kSampleRate32kHz, 1, 1, 1); EXPECT_TRUE(echo_canceller.aec_core() == NULL); @@ -85,9 +81,7 @@ TEST(EchoCancellationInternalTest, DelayAgnostic) { } TEST(EchoCancellationInternalTest, InterfaceConfiguration) { - rtc::CriticalSection crit_render; - rtc::CriticalSection crit_capture; - EchoCancellationImpl echo_canceller(&crit_render, &crit_capture); + EchoCancellationImpl echo_canceller; echo_canceller.Initialize(AudioProcessing::kSampleRate16kHz, 1, 1, 1); EXPECT_EQ(0, echo_canceller.enable_drift_compensation(true));