From 88788adcfd9e84e3e8882806e68d759898be0907 Mon Sep 17 00:00:00 2001 From: kwiberg Date: Fri, 19 Feb 2016 07:04:49 -0800 Subject: [PATCH] Replace scoped_ptr with unique_ptr in webrtc/modules/audio_processing/ BUG=webrtc:5520 Review URL: https://codereview.webrtc.org/1710483002 Cr-Commit-Position: refs/heads/master@{#11684} --- webrtc/modules/audio_processing/agc/agc.h | 7 +++--- .../audio_processing/agc/agc_manager_direct.h | 10 +++++---- .../modules/audio_processing/agc/histogram.h | 7 +++--- .../agc/histogram_unittest.cc | 3 ++- .../modules/audio_processing/audio_buffer.h | 19 ++++++++-------- .../audio_processing/audio_processing_impl.cc | 22 +++++++++---------- .../audio_processing/audio_processing_impl.h | 16 +++++++------- .../audio_processing_impl_locking_unittest.cc | 3 ++- .../audio_processing_performance_unittest.cc | 13 ++++++----- .../beamformer/complex_matrix.h | 1 - .../audio_processing/beamformer/matrix.h | 1 - .../beamformer/nonlinear_beamformer.h | 4 +++- .../audio_processing/echo_cancellation_impl.h | 5 +++-- .../echo_cancellation_impl_unittest.cc | 7 +++--- .../echo_control_mobile_impl.h | 5 +++-- .../audio_processing/gain_control_impl.h | 4 ++-- .../audio_processing/high_pass_filter_impl.cc | 2 +- .../audio_processing/high_pass_filter_impl.h | 5 +++-- .../include/mock_audio_processing.h | 17 +++++++------- .../intelligibility_enhancer.h | 16 +++++++------- .../intelligibility_enhancer_unittest.cc | 5 +++-- .../intelligibility/intelligibility_utils.h | 15 ++++++------- .../audio_processing/level_estimator_impl.h | 5 +++-- .../noise_suppression_impl.cc | 2 +- .../audio_processing/noise_suppression_impl.h | 4 ++-- .../audio_processing/voice_detection_impl.cc | 2 +- .../audio_processing/voice_detection_impl.h | 5 +++-- webrtc/tools/agc/activity_metric.cc | 1 + 28 files changed, 111 insertions(+), 95 deletions(-) diff --git a/webrtc/modules/audio_processing/agc/agc.h b/webrtc/modules/audio_processing/agc/agc.h index 08c287f820..9b6b8556ab 100644 --- a/webrtc/modules/audio_processing/agc/agc.h +++ b/webrtc/modules/audio_processing/agc/agc.h @@ -11,7 +11,8 @@ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_H_ -#include "webrtc/base/scoped_ptr.h" +#include + #include "webrtc/modules/audio_processing/vad/voice_activity_detector.h" #include "webrtc/typedefs.h" @@ -48,8 +49,8 @@ class Agc { private: double target_level_loudness_; int target_level_dbfs_; - rtc::scoped_ptr histogram_; - rtc::scoped_ptr inactive_histogram_; + std::unique_ptr histogram_; + std::unique_ptr inactive_histogram_; VoiceActivityDetector vad_; }; diff --git a/webrtc/modules/audio_processing/agc/agc_manager_direct.h b/webrtc/modules/audio_processing/agc/agc_manager_direct.h index 6edb0f7bf1..6b16e8b776 100644 --- a/webrtc/modules/audio_processing/agc/agc_manager_direct.h +++ b/webrtc/modules/audio_processing/agc/agc_manager_direct.h @@ -11,7 +11,9 @@ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_MANAGER_DIRECT_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_MANAGER_DIRECT_H_ -#include "webrtc/base/scoped_ptr.h" +#include + +#include "webrtc/base/constructormagic.h" #include "webrtc/modules/audio_processing/agc/agc.h" namespace webrtc { @@ -81,7 +83,7 @@ class AgcManagerDirect final { void UpdateGain(); void UpdateCompressor(); - rtc::scoped_ptr agc_; + std::unique_ptr agc_; GainControl* gctrl_; VolumeCallbacks* volume_callbacks_; @@ -97,8 +99,8 @@ class AgcManagerDirect final { bool startup_; int startup_min_level_; - rtc::scoped_ptr file_preproc_; - rtc::scoped_ptr file_postproc_; + std::unique_ptr file_preproc_; + std::unique_ptr file_postproc_; RTC_DISALLOW_COPY_AND_ASSIGN(AgcManagerDirect); }; diff --git a/webrtc/modules/audio_processing/agc/histogram.h b/webrtc/modules/audio_processing/agc/histogram.h index a8706bb0ef..fd369a284b 100644 --- a/webrtc/modules/audio_processing/agc/histogram.h +++ b/webrtc/modules/audio_processing/agc/histogram.h @@ -13,7 +13,8 @@ #include -#include "webrtc/base/scoped_ptr.h" +#include + #include "webrtc/typedefs.h" namespace webrtc { @@ -73,9 +74,9 @@ class Histogram { int64_t bin_count_q10_[kHistSize]; // Circular buffer for probabilities - rtc::scoped_ptr activity_probability_; + std::unique_ptr activity_probability_; // Circular buffer for histogram-indices of probabilities. - rtc::scoped_ptr hist_bin_index_; + std::unique_ptr hist_bin_index_; // Current index of circular buffer, where the newest data will be written to, // therefore, pointing to the oldest data if buffer is full. int buffer_index_; diff --git a/webrtc/modules/audio_processing/agc/histogram_unittest.cc b/webrtc/modules/audio_processing/agc/histogram_unittest.cc index d41aacafd8..d00600cc97 100644 --- a/webrtc/modules/audio_processing/agc/histogram_unittest.cc +++ b/webrtc/modules/audio_processing/agc/histogram_unittest.cc @@ -14,6 +14,7 @@ #include #include +#include #include "gtest/gtest.h" #include "webrtc/test/testsupport/fileutils.h" @@ -37,7 +38,7 @@ class HistogramTest : public ::testing::Test { private: void TestClean(); - rtc::scoped_ptr hist_; + std::unique_ptr hist_; }; void HistogramTest::TestClean() { diff --git a/webrtc/modules/audio_processing/audio_buffer.h b/webrtc/modules/audio_processing/audio_buffer.h index ff12ca2d95..928f0a43be 100644 --- a/webrtc/modules/audio_processing/audio_buffer.h +++ b/webrtc/modules/audio_processing/audio_buffer.h @@ -11,7 +11,8 @@ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_BUFFER_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_BUFFER_H_ -#include "webrtc/base/scoped_ptr.h" +#include + #include "webrtc/common_audio/channel_buffer.h" #include "webrtc/modules/audio_processing/include/audio_processing.h" #include "webrtc/modules/audio_processing/splitting_filter.h" @@ -146,14 +147,14 @@ class AudioBuffer { AudioFrame::VADActivity activity_; const float* keyboard_data_; - rtc::scoped_ptr data_; - rtc::scoped_ptr split_data_; - rtc::scoped_ptr splitting_filter_; - rtc::scoped_ptr > mixed_low_pass_channels_; - rtc::scoped_ptr > low_pass_reference_channels_; - rtc::scoped_ptr input_buffer_; - rtc::scoped_ptr output_buffer_; - rtc::scoped_ptr > process_buffer_; + std::unique_ptr data_; + std::unique_ptr split_data_; + std::unique_ptr splitting_filter_; + std::unique_ptr > mixed_low_pass_channels_; + std::unique_ptr > low_pass_reference_channels_; + std::unique_ptr input_buffer_; + std::unique_ptr output_buffer_; + std::unique_ptr > process_buffer_; ScopedVector input_resamplers_; ScopedVector output_resamplers_; }; diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc index f3856128bb..74d5590627 100644 --- a/webrtc/modules/audio_processing/audio_processing_impl.cc +++ b/webrtc/modules/audio_processing/audio_processing_impl.cc @@ -90,16 +90,16 @@ struct AudioProcessingImpl::ApmPublicSubmodules { EchoCancellationImpl* echo_cancellation; EchoControlMobileImpl* echo_control_mobile; GainControlImpl* gain_control; - rtc::scoped_ptr high_pass_filter; - rtc::scoped_ptr level_estimator; - rtc::scoped_ptr noise_suppression; - rtc::scoped_ptr voice_detection; - rtc::scoped_ptr + std::unique_ptr high_pass_filter; + std::unique_ptr level_estimator; + std::unique_ptr noise_suppression; + std::unique_ptr voice_detection; + std::unique_ptr gain_control_for_experimental_agc; // Accessed internally from both render and capture. - rtc::scoped_ptr transient_suppressor; - rtc::scoped_ptr intelligibility_enhancer; + std::unique_ptr transient_suppressor; + std::unique_ptr intelligibility_enhancer; }; struct AudioProcessingImpl::ApmPrivateSubmodules { @@ -107,8 +107,8 @@ struct AudioProcessingImpl::ApmPrivateSubmodules { : beamformer(beamformer) {} // Accessed internally from capture or during initialization std::list component_list; - rtc::scoped_ptr> beamformer; - rtc::scoped_ptr agc_manager; + std::unique_ptr> beamformer; + std::unique_ptr agc_manager; }; const int AudioProcessing::kNativeSampleRatesHz[] = { @@ -297,11 +297,11 @@ int AudioProcessingImpl::InitializeLocked() { formats_.rev_proc_format.num_channels(), rev_audio_buffer_out_num_frames)); if (rev_conversion_needed()) { - render_.render_converter = AudioConverter::Create( + render_.render_converter = rtc::ScopedToUnique(AudioConverter::Create( formats_.api_format.reverse_input_stream().num_channels(), formats_.api_format.reverse_input_stream().num_frames(), formats_.api_format.reverse_output_stream().num_channels(), - formats_.api_format.reverse_output_stream().num_frames()); + formats_.api_format.reverse_output_stream().num_frames())); } else { render_.render_converter.reset(nullptr); } diff --git a/webrtc/modules/audio_processing/audio_processing_impl.h b/webrtc/modules/audio_processing/audio_processing_impl.h index b3f43fa5b3..4a28761af1 100644 --- a/webrtc/modules/audio_processing/audio_processing_impl.h +++ b/webrtc/modules/audio_processing/audio_processing_impl.h @@ -12,11 +12,11 @@ #define WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ #include +#include #include #include #include "webrtc/base/criticalsection.h" -#include "webrtc/base/scoped_ptr.h" #include "webrtc/base/thread_annotations.h" #include "webrtc/modules/audio_processing/audio_buffer.h" #include "webrtc/modules/audio_processing/include/audio_processing.h" @@ -137,7 +137,7 @@ class AudioProcessingImpl : public AudioProcessing { // State for the debug dump. struct ApmDebugDumpThreadState { ApmDebugDumpThreadState() : event_msg(new audioproc::Event()) {} - rtc::scoped_ptr event_msg; // Protobuf message. + std::unique_ptr event_msg; // Protobuf message. std::string event_str; // Memory for protobuf serialization. // Serialized string of last saved APM configuration. @@ -149,7 +149,7 @@ class AudioProcessingImpl : public AudioProcessing { // Number of bytes that can still be written to the log before the maximum // size is reached. A value of <= 0 indicates that no limit is used. int64_t num_bytes_left_for_log_ = -1; - rtc::scoped_ptr debug_file; + std::unique_ptr debug_file; ApmDebugDumpThreadState render; ApmDebugDumpThreadState capture; }; @@ -250,8 +250,8 @@ class AudioProcessingImpl : public AudioProcessing { rtc::CriticalSection crit_capture_; // Structs containing the pointers to the submodules. - rtc::scoped_ptr public_submodules_; - rtc::scoped_ptr private_submodules_ + std::unique_ptr public_submodules_; + std::unique_ptr private_submodules_ GUARDED_BY(crit_capture_); // State that is written to while holding both the render and capture locks @@ -313,7 +313,7 @@ class AudioProcessingImpl : public AudioProcessing { bool transient_suppressor_enabled; std::vector array_geometry; SphericalPointf target_direction; - rtc::scoped_ptr capture_audio; + std::unique_ptr capture_audio; // Only the rate and samples fields of fwd_proc_format_ are used because the // forward processing number of channels is mutable and is tracked by the // capture_audio_. @@ -337,8 +337,8 @@ class AudioProcessingImpl : public AudioProcessing { } capture_nonlocked_; struct ApmRenderState { - rtc::scoped_ptr render_converter; - rtc::scoped_ptr render_audio; + std::unique_ptr render_converter; + std::unique_ptr render_audio; } render_ GUARDED_BY(crit_render_); }; diff --git a/webrtc/modules/audio_processing/audio_processing_impl_locking_unittest.cc b/webrtc/modules/audio_processing/audio_processing_impl_locking_unittest.cc index 7ce6a569d1..663a8a51a8 100644 --- a/webrtc/modules/audio_processing/audio_processing_impl_locking_unittest.cc +++ b/webrtc/modules/audio_processing/audio_processing_impl_locking_unittest.cc @@ -11,6 +11,7 @@ #include "webrtc/modules/audio_processing/audio_processing_impl.h" #include +#include #include #include "testing/gtest/include/gtest/gtest.h" @@ -447,7 +448,7 @@ class AudioProcessingImplLockTest rtc::PlatformThread stats_thread_; mutable RandomGenerator rand_gen_; - rtc::scoped_ptr apm_; + std::unique_ptr apm_; TestConfig test_config_; FrameCounters frame_counters_; RenderProcessor render_thread_state_; diff --git a/webrtc/modules/audio_processing/audio_processing_performance_unittest.cc b/webrtc/modules/audio_processing/audio_processing_performance_unittest.cc index 093c03e89f..a4a8351a17 100644 --- a/webrtc/modules/audio_processing/audio_processing_performance_unittest.cc +++ b/webrtc/modules/audio_processing/audio_processing_performance_unittest.cc @@ -12,6 +12,7 @@ #include #include +#include #include #include "testing/gtest/include/gtest/gtest.h" @@ -657,19 +658,19 @@ class CallSimulator : public ::testing::TestWithParam { } // Event handler for the test. - const rtc::scoped_ptr test_complete_; + const std::unique_ptr test_complete_; // Thread related variables. - rtc::scoped_ptr render_thread_; - rtc::scoped_ptr capture_thread_; + std::unique_ptr render_thread_; + std::unique_ptr capture_thread_; Random rand_gen_; - rtc::scoped_ptr apm_; + std::unique_ptr apm_; const SimulationConfig simulation_config_; FrameCounters frame_counters_; LockedFlag capture_call_checker_; - rtc::scoped_ptr render_thread_state_; - rtc::scoped_ptr capture_thread_state_; + std::unique_ptr render_thread_state_; + std::unique_ptr capture_thread_state_; }; // Implements the callback functionality for the threads. diff --git a/webrtc/modules/audio_processing/beamformer/complex_matrix.h b/webrtc/modules/audio_processing/beamformer/complex_matrix.h index 707c51564b..fe0e24c074 100644 --- a/webrtc/modules/audio_processing/beamformer/complex_matrix.h +++ b/webrtc/modules/audio_processing/beamformer/complex_matrix.h @@ -14,7 +14,6 @@ #include #include "webrtc/base/checks.h" -#include "webrtc/base/scoped_ptr.h" #include "webrtc/modules/audio_processing/beamformer/matrix.h" namespace webrtc { diff --git a/webrtc/modules/audio_processing/beamformer/matrix.h b/webrtc/modules/audio_processing/beamformer/matrix.h index 51c1cece97..40b4793426 100644 --- a/webrtc/modules/audio_processing/beamformer/matrix.h +++ b/webrtc/modules/audio_processing/beamformer/matrix.h @@ -18,7 +18,6 @@ #include "webrtc/base/checks.h" #include "webrtc/base/constructormagic.h" -#include "webrtc/base/scoped_ptr.h" namespace { diff --git a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h index 29c416ca91..6119f0fb20 100644 --- a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h +++ b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h @@ -15,6 +15,8 @@ #define _USE_MATH_DEFINES #include + +#include #include #include "webrtc/common_audio/lapped_transform.h" @@ -125,7 +127,7 @@ class NonlinearBeamformer // Deals with the fft transform and blocking. size_t chunk_length_; - rtc::scoped_ptr lapped_transform_; + std::unique_ptr lapped_transform_; float window_[kFftSize]; // Parameters exposed to the user. diff --git a/webrtc/modules/audio_processing/echo_cancellation_impl.h b/webrtc/modules/audio_processing/echo_cancellation_impl.h index 82ae8596d6..fbc2bcc465 100644 --- a/webrtc/modules/audio_processing/echo_cancellation_impl.h +++ b/webrtc/modules/audio_processing/echo_cancellation_impl.h @@ -11,8 +11,9 @@ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_ +#include + #include "webrtc/base/criticalsection.h" -#include "webrtc/base/scoped_ptr.h" #include "webrtc/common_audio/swap_queue.h" #include "webrtc/modules/audio_processing/include/audio_processing.h" #include "webrtc/modules/audio_processing/processing_component.h" @@ -101,7 +102,7 @@ class EchoCancellationImpl : public EchoCancellation, std::vector capture_queue_buffer_ GUARDED_BY(crit_capture_); // Lock protection not needed. - rtc::scoped_ptr, RenderQueueItemVerifier>> + std::unique_ptr, RenderQueueItemVerifier>> render_signal_queue_; }; diff --git a/webrtc/modules/audio_processing/echo_cancellation_impl_unittest.cc b/webrtc/modules/audio_processing/echo_cancellation_impl_unittest.cc index 7f152bf942..163e420662 100644 --- a/webrtc/modules/audio_processing/echo_cancellation_impl_unittest.cc +++ b/webrtc/modules/audio_processing/echo_cancellation_impl_unittest.cc @@ -8,8 +8,9 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include + #include "testing/gtest/include/gtest/gtest.h" -#include "webrtc/base/scoped_ptr.h" extern "C" { #include "webrtc/modules/audio_processing/aec/aec_core.h" } @@ -18,7 +19,7 @@ extern "C" { namespace webrtc { TEST(EchoCancellationInternalTest, ExtendedFilter) { - rtc::scoped_ptr ap(AudioProcessing::Create()); + std::unique_ptr ap(AudioProcessing::Create()); EXPECT_TRUE(ap->echo_cancellation()->aec_core() == NULL); EXPECT_EQ(ap->kNoError, ap->echo_cancellation()->Enable(true)); @@ -48,7 +49,7 @@ TEST(EchoCancellationInternalTest, ExtendedFilter) { } TEST(EchoCancellationInternalTest, DelayAgnostic) { - rtc::scoped_ptr ap(AudioProcessing::Create()); + std::unique_ptr ap(AudioProcessing::Create()); EXPECT_TRUE(ap->echo_cancellation()->aec_core() == NULL); EXPECT_EQ(ap->kNoError, ap->echo_cancellation()->Enable(true)); diff --git a/webrtc/modules/audio_processing/echo_control_mobile_impl.h b/webrtc/modules/audio_processing/echo_control_mobile_impl.h index 4d6529d3ac..23c1abbd47 100644 --- a/webrtc/modules/audio_processing/echo_control_mobile_impl.h +++ b/webrtc/modules/audio_processing/echo_control_mobile_impl.h @@ -11,8 +11,9 @@ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ +#include + #include "webrtc/base/criticalsection.h" -#include "webrtc/base/scoped_ptr.h" #include "webrtc/common_audio/swap_queue.h" #include "webrtc/modules/audio_processing/include/audio_processing.h" #include "webrtc/modules/audio_processing/processing_component.h" @@ -81,7 +82,7 @@ class EchoControlMobileImpl : public EchoControlMobile, std::vector capture_queue_buffer_ GUARDED_BY(crit_capture_); // Lock protection not needed. - rtc::scoped_ptr< + std::unique_ptr< SwapQueue, RenderQueueItemVerifier>> render_signal_queue_; }; diff --git a/webrtc/modules/audio_processing/gain_control_impl.h b/webrtc/modules/audio_processing/gain_control_impl.h index 72789ba5e1..942a1835e4 100644 --- a/webrtc/modules/audio_processing/gain_control_impl.h +++ b/webrtc/modules/audio_processing/gain_control_impl.h @@ -11,10 +11,10 @@ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ +#include #include #include "webrtc/base/criticalsection.h" -#include "webrtc/base/scoped_ptr.h" #include "webrtc/base/thread_annotations.h" #include "webrtc/common_audio/swap_queue.h" #include "webrtc/modules/audio_processing/include/audio_processing.h" @@ -96,7 +96,7 @@ class GainControlImpl : public GainControl, std::vector capture_queue_buffer_ GUARDED_BY(crit_capture_); // Lock protection not needed. - rtc::scoped_ptr< + std::unique_ptr< SwapQueue, RenderQueueItemVerifier>> render_signal_queue_; }; diff --git a/webrtc/modules/audio_processing/high_pass_filter_impl.cc b/webrtc/modules/audio_processing/high_pass_filter_impl.cc index 375d58febb..d33ec78dcb 100644 --- a/webrtc/modules/audio_processing/high_pass_filter_impl.cc +++ b/webrtc/modules/audio_processing/high_pass_filter_impl.cc @@ -93,7 +93,7 @@ HighPassFilterImpl::HighPassFilterImpl(rtc::CriticalSection* crit) HighPassFilterImpl::~HighPassFilterImpl() {} void HighPassFilterImpl::Initialize(size_t channels, int sample_rate_hz) { - std::vector> new_filters(channels); + std::vector> new_filters(channels); for (size_t i = 0; i < channels; i++) { new_filters[i].reset(new BiquadFilter(sample_rate_hz)); } diff --git a/webrtc/modules/audio_processing/high_pass_filter_impl.h b/webrtc/modules/audio_processing/high_pass_filter_impl.h index 0e985bac7a..a02e661d9c 100644 --- a/webrtc/modules/audio_processing/high_pass_filter_impl.h +++ b/webrtc/modules/audio_processing/high_pass_filter_impl.h @@ -11,9 +11,10 @@ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_HIGH_PASS_FILTER_IMPL_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_HIGH_PASS_FILTER_IMPL_H_ +#include + #include "webrtc/base/constructormagic.h" #include "webrtc/base/criticalsection.h" -#include "webrtc/base/scoped_ptr.h" #include "webrtc/modules/audio_processing/include/audio_processing.h" namespace webrtc { @@ -37,7 +38,7 @@ class HighPassFilterImpl : public HighPassFilter { class BiquadFilter; rtc::CriticalSection* const crit_ = nullptr; bool enabled_ GUARDED_BY(crit_) = false; - std::vector> filters_ GUARDED_BY(crit_); + std::vector> filters_ GUARDED_BY(crit_); RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(HighPassFilterImpl); }; } // namespace webrtc diff --git a/webrtc/modules/audio_processing/include/mock_audio_processing.h b/webrtc/modules/audio_processing/include/mock_audio_processing.h index 363e99a003..b5ea5875a7 100644 --- a/webrtc/modules/audio_processing/include/mock_audio_processing.h +++ b/webrtc/modules/audio_processing/include/mock_audio_processing.h @@ -11,7 +11,8 @@ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_MOCK_AUDIO_PROCESSING_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_MOCK_AUDIO_PROCESSING_H_ -#include "webrtc/base/scoped_ptr.h" +#include + #include "webrtc/modules/audio_processing/include/audio_processing.h" namespace webrtc { @@ -282,13 +283,13 @@ class MockAudioProcessing : public AudioProcessing { } private: - rtc::scoped_ptr echo_cancellation_; - rtc::scoped_ptr echo_control_mobile_; - rtc::scoped_ptr gain_control_; - rtc::scoped_ptr high_pass_filter_; - rtc::scoped_ptr level_estimator_; - rtc::scoped_ptr noise_suppression_; - rtc::scoped_ptr voice_detection_; + std::unique_ptr echo_cancellation_; + std::unique_ptr echo_control_mobile_; + std::unique_ptr gain_control_; + std::unique_ptr high_pass_filter_; + std::unique_ptr level_estimator_; + std::unique_ptr noise_suppression_; + std::unique_ptr voice_detection_; }; } // namespace webrtc diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h index 9cb03ca9ae..2deb4d2439 100644 --- a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h +++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h @@ -12,9 +12,9 @@ #define WEBRTC_MODULES_AUDIO_PROCESSING_INTELLIGIBILITY_INTELLIGIBILITY_ENHANCER_H_ #include +#include #include -#include "webrtc/base/scoped_ptr.h" #include "webrtc/common_audio/lapped_transform.h" #include "webrtc/common_audio/channel_buffer.h" #include "webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h" @@ -120,24 +120,24 @@ class IntelligibilityEnhancer { intelligibility::PowerEstimator clear_power_; std::vector noise_power_; - rtc::scoped_ptr filtered_clear_pow_; - rtc::scoped_ptr filtered_noise_pow_; - rtc::scoped_ptr center_freqs_; + std::unique_ptr filtered_clear_pow_; + std::unique_ptr filtered_noise_pow_; + std::unique_ptr center_freqs_; std::vector> capture_filter_bank_; std::vector> render_filter_bank_; size_t start_freq_; - rtc::scoped_ptr rho_; // Production and interpretation SNR. + std::unique_ptr rho_; // Production and interpretation SNR. // for each ERB band. - rtc::scoped_ptr gains_eq_; // Pre-filter modified gains. + std::unique_ptr gains_eq_; // Pre-filter modified gains. intelligibility::GainApplier gain_applier_; // Destination buffers used to reassemble blocked chunks before overwriting // the original input array with modifications. ChannelBuffer temp_render_out_buffer_; - rtc::scoped_ptr kbd_window_; + std::unique_ptr kbd_window_; TransformCallback render_callback_; - rtc::scoped_ptr render_mangler_; + std::unique_ptr render_mangler_; int block_count_; int analysis_step_; }; diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc index 0d15406017..b0f94ec5e2 100644 --- a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc +++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc @@ -10,12 +10,13 @@ #include #include + #include +#include #include #include "testing/gtest/include/gtest/gtest.h" #include "webrtc/base/arraysize.h" -#include "webrtc/base/scoped_ptr.h" #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" #include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h" @@ -105,7 +106,7 @@ class IntelligibilityEnhancerTest : public ::testing::Test { } IntelligibilityEnhancer::Config config_; - rtc::scoped_ptr enh_; + std::unique_ptr enh_; std::vector clear_data_; std::vector noise_data_; std::vector orig_data_; diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h b/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h index 2bf0791d85..8858cff74c 100644 --- a/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h +++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h @@ -12,8 +12,7 @@ #define WEBRTC_MODULES_AUDIO_PROCESSING_INTELLIGIBILITY_INTELLIGIBILITY_UTILS_H_ #include - -#include "webrtc/base/scoped_ptr.h" +#include namespace webrtc { @@ -36,13 +35,13 @@ class PowerEstimator { private: // TODO(ekmeyerson): Switch the following running means - // and histories from rtc::scoped_ptr to std::vector. - rtc::scoped_ptr[]> running_mean_sq_; + // and histories from std::unique_ptr to std::vector. + std::unique_ptr[]> running_mean_sq_; // The current magnitude array. - rtc::scoped_ptr magnitude_; + std::unique_ptr magnitude_; // The current power array. - rtc::scoped_ptr power_; + std::unique_ptr power_; const size_t num_freqs_; const float decay_; @@ -66,8 +65,8 @@ class GainApplier { private: const size_t num_freqs_; const float change_limit_; - rtc::scoped_ptr target_; - rtc::scoped_ptr current_; + std::unique_ptr target_; + std::unique_ptr current_; }; } // namespace intelligibility diff --git a/webrtc/modules/audio_processing/level_estimator_impl.h b/webrtc/modules/audio_processing/level_estimator_impl.h index 4401da37e4..df43c9be0d 100644 --- a/webrtc/modules/audio_processing/level_estimator_impl.h +++ b/webrtc/modules/audio_processing/level_estimator_impl.h @@ -11,9 +11,10 @@ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_ESTIMATOR_IMPL_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_ESTIMATOR_IMPL_H_ +#include + #include "webrtc/base/constructormagic.h" #include "webrtc/base/criticalsection.h" -#include "webrtc/base/scoped_ptr.h" #include "webrtc/modules/audio_processing/include/audio_processing.h" namespace webrtc { @@ -38,7 +39,7 @@ class LevelEstimatorImpl : public LevelEstimator { private: rtc::CriticalSection* const crit_ = nullptr; bool enabled_ GUARDED_BY(crit_) = false; - rtc::scoped_ptr rms_ GUARDED_BY(crit_); + std::unique_ptr rms_ GUARDED_BY(crit_); RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(LevelEstimatorImpl); }; } // namespace webrtc diff --git a/webrtc/modules/audio_processing/noise_suppression_impl.cc b/webrtc/modules/audio_processing/noise_suppression_impl.cc index dbfe1c4c37..076f1ba25a 100644 --- a/webrtc/modules/audio_processing/noise_suppression_impl.cc +++ b/webrtc/modules/audio_processing/noise_suppression_impl.cc @@ -56,7 +56,7 @@ void NoiseSuppressionImpl::Initialize(size_t channels, int sample_rate_hz) { rtc::CritScope cs(crit_); channels_ = channels; sample_rate_hz_ = sample_rate_hz; - std::vector> new_suppressors; + std::vector> new_suppressors; if (enabled_) { new_suppressors.resize(channels); for (size_t i = 0; i < channels; i++) { diff --git a/webrtc/modules/audio_processing/noise_suppression_impl.h b/webrtc/modules/audio_processing/noise_suppression_impl.h index 47fe815fdb..ef30bb1167 100644 --- a/webrtc/modules/audio_processing/noise_suppression_impl.h +++ b/webrtc/modules/audio_processing/noise_suppression_impl.h @@ -11,11 +11,11 @@ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_IMPL_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_IMPL_H_ +#include #include #include "webrtc/base/constructormagic.h" #include "webrtc/base/criticalsection.h" -#include "webrtc/base/scoped_ptr.h" #include "webrtc/modules/audio_processing/include/audio_processing.h" namespace webrtc { @@ -47,7 +47,7 @@ class NoiseSuppressionImpl : public NoiseSuppression { Level level_ GUARDED_BY(crit_) = kModerate; size_t channels_ GUARDED_BY(crit_) = 0; int sample_rate_hz_ GUARDED_BY(crit_) = 0; - std::vector> suppressors_ GUARDED_BY(crit_); + std::vector> suppressors_ GUARDED_BY(crit_); RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(NoiseSuppressionImpl); }; } // namespace webrtc diff --git a/webrtc/modules/audio_processing/voice_detection_impl.cc b/webrtc/modules/audio_processing/voice_detection_impl.cc index 22d218c371..674a5197a8 100644 --- a/webrtc/modules/audio_processing/voice_detection_impl.cc +++ b/webrtc/modules/audio_processing/voice_detection_impl.cc @@ -41,7 +41,7 @@ VoiceDetectionImpl::~VoiceDetectionImpl() {} void VoiceDetectionImpl::Initialize(int sample_rate_hz) { rtc::CritScope cs(crit_); sample_rate_hz_ = sample_rate_hz; - rtc::scoped_ptr new_vad; + std::unique_ptr new_vad; if (enabled_) { new_vad.reset(new Vad()); } diff --git a/webrtc/modules/audio_processing/voice_detection_impl.h b/webrtc/modules/audio_processing/voice_detection_impl.h index 0d6d8cf14a..6ba43dbc9e 100644 --- a/webrtc/modules/audio_processing/voice_detection_impl.h +++ b/webrtc/modules/audio_processing/voice_detection_impl.h @@ -11,9 +11,10 @@ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_VOICE_DETECTION_IMPL_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_VOICE_DETECTION_IMPL_H_ +#include + #include "webrtc/base/constructormagic.h" #include "webrtc/base/criticalsection.h" -#include "webrtc/base/scoped_ptr.h" #include "webrtc/modules/audio_processing/include/audio_processing.h" namespace webrtc { @@ -49,7 +50,7 @@ class VoiceDetectionImpl : public VoiceDetection { int frame_size_ms_ GUARDED_BY(crit_) = 10; size_t frame_size_samples_ GUARDED_BY(crit_) = 0; int sample_rate_hz_ GUARDED_BY(crit_) = 0; - rtc::scoped_ptr vad_ GUARDED_BY(crit_); + std::unique_ptr vad_ GUARDED_BY(crit_); RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(VoiceDetectionImpl); }; } // namespace webrtc diff --git a/webrtc/tools/agc/activity_metric.cc b/webrtc/tools/agc/activity_metric.cc index 2cb0a1b2df..258d02377e 100644 --- a/webrtc/tools/agc/activity_metric.cc +++ b/webrtc/tools/agc/activity_metric.cc @@ -17,6 +17,7 @@ #include "gflags/gflags.h" #include "testing/gtest/include/gtest/gtest.h" +#include "webrtc/base/scoped_ptr.h" #include "webrtc/modules/audio_processing/agc/agc.h" #include "webrtc/modules/audio_processing/agc/histogram.h" #include "webrtc/modules/audio_processing/agc/utility.h"