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}
diff --git a/webrtc/modules/audio_processing/agc/agc.h b/webrtc/modules/audio_processing/agc/agc.h
index 08c287f..9b6b855 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 <memory>
+
 #include "webrtc/modules/audio_processing/vad/voice_activity_detector.h"
 #include "webrtc/typedefs.h"
 
@@ -48,8 +49,8 @@
  private:
   double target_level_loudness_;
   int target_level_dbfs_;
-  rtc::scoped_ptr<Histogram> histogram_;
-  rtc::scoped_ptr<Histogram> inactive_histogram_;
+  std::unique_ptr<Histogram> histogram_;
+  std::unique_ptr<Histogram> 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 6edb0f7..6b16e8b 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 <memory>
+
+#include "webrtc/base/constructormagic.h"
 #include "webrtc/modules/audio_processing/agc/agc.h"
 
 namespace webrtc {
@@ -81,7 +83,7 @@
   void UpdateGain();
   void UpdateCompressor();
 
-  rtc::scoped_ptr<Agc> agc_;
+  std::unique_ptr<Agc> agc_;
   GainControl* gctrl_;
   VolumeCallbacks* volume_callbacks_;
 
@@ -97,8 +99,8 @@
   bool startup_;
   int startup_min_level_;
 
-  rtc::scoped_ptr<DebugFile> file_preproc_;
-  rtc::scoped_ptr<DebugFile> file_postproc_;
+  std::unique_ptr<DebugFile> file_preproc_;
+  std::unique_ptr<DebugFile> 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 a8706bb..fd369a2 100644
--- a/webrtc/modules/audio_processing/agc/histogram.h
+++ b/webrtc/modules/audio_processing/agc/histogram.h
@@ -13,7 +13,8 @@
 
 #include <string.h>
 
-#include "webrtc/base/scoped_ptr.h"
+#include <memory>
+
 #include "webrtc/typedefs.h"
 
 namespace webrtc {
@@ -73,9 +74,9 @@
   int64_t bin_count_q10_[kHistSize];
 
   // Circular buffer for probabilities
-  rtc::scoped_ptr<int[]> activity_probability_;
+  std::unique_ptr<int[]> activity_probability_;
   // Circular buffer for histogram-indices of probabilities.
-  rtc::scoped_ptr<int[]> hist_bin_index_;
+  std::unique_ptr<int[]> 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 d41aaca..d00600c 100644
--- a/webrtc/modules/audio_processing/agc/histogram_unittest.cc
+++ b/webrtc/modules/audio_processing/agc/histogram_unittest.cc
@@ -14,6 +14,7 @@
 
 #include <stdio.h>
 #include <cmath>
+#include <memory>
 
 #include "gtest/gtest.h"
 #include "webrtc/test/testsupport/fileutils.h"
@@ -37,7 +38,7 @@
 
  private:
   void TestClean();
-  rtc::scoped_ptr<Histogram> hist_;
+  std::unique_ptr<Histogram> hist_;
 };
 
 void HistogramTest::TestClean() {
diff --git a/webrtc/modules/audio_processing/audio_buffer.h b/webrtc/modules/audio_processing/audio_buffer.h
index ff12ca2..928f0a4 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 <memory>
+
 #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 @@
   AudioFrame::VADActivity activity_;
 
   const float* keyboard_data_;
-  rtc::scoped_ptr<IFChannelBuffer> data_;
-  rtc::scoped_ptr<IFChannelBuffer> split_data_;
-  rtc::scoped_ptr<SplittingFilter> splitting_filter_;
-  rtc::scoped_ptr<ChannelBuffer<int16_t> > mixed_low_pass_channels_;
-  rtc::scoped_ptr<ChannelBuffer<int16_t> > low_pass_reference_channels_;
-  rtc::scoped_ptr<IFChannelBuffer> input_buffer_;
-  rtc::scoped_ptr<IFChannelBuffer> output_buffer_;
-  rtc::scoped_ptr<ChannelBuffer<float> > process_buffer_;
+  std::unique_ptr<IFChannelBuffer> data_;
+  std::unique_ptr<IFChannelBuffer> split_data_;
+  std::unique_ptr<SplittingFilter> splitting_filter_;
+  std::unique_ptr<ChannelBuffer<int16_t> > mixed_low_pass_channels_;
+  std::unique_ptr<ChannelBuffer<int16_t> > low_pass_reference_channels_;
+  std::unique_ptr<IFChannelBuffer> input_buffer_;
+  std::unique_ptr<IFChannelBuffer> output_buffer_;
+  std::unique_ptr<ChannelBuffer<float> > process_buffer_;
   ScopedVector<PushSincResampler> input_resamplers_;
   ScopedVector<PushSincResampler> output_resamplers_;
 };
diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc
index f385612..74d5590 100644
--- a/webrtc/modules/audio_processing/audio_processing_impl.cc
+++ b/webrtc/modules/audio_processing/audio_processing_impl.cc
@@ -90,16 +90,16 @@
   EchoCancellationImpl* echo_cancellation;
   EchoControlMobileImpl* echo_control_mobile;
   GainControlImpl* gain_control;
-  rtc::scoped_ptr<HighPassFilterImpl> high_pass_filter;
-  rtc::scoped_ptr<LevelEstimatorImpl> level_estimator;
-  rtc::scoped_ptr<NoiseSuppressionImpl> noise_suppression;
-  rtc::scoped_ptr<VoiceDetectionImpl> voice_detection;
-  rtc::scoped_ptr<GainControlForExperimentalAgc>
+  std::unique_ptr<HighPassFilterImpl> high_pass_filter;
+  std::unique_ptr<LevelEstimatorImpl> level_estimator;
+  std::unique_ptr<NoiseSuppressionImpl> noise_suppression;
+  std::unique_ptr<VoiceDetectionImpl> voice_detection;
+  std::unique_ptr<GainControlForExperimentalAgc>
       gain_control_for_experimental_agc;
 
   // Accessed internally from both render and capture.
-  rtc::scoped_ptr<TransientSuppressor> transient_suppressor;
-  rtc::scoped_ptr<IntelligibilityEnhancer> intelligibility_enhancer;
+  std::unique_ptr<TransientSuppressor> transient_suppressor;
+  std::unique_ptr<IntelligibilityEnhancer> intelligibility_enhancer;
 };
 
 struct AudioProcessingImpl::ApmPrivateSubmodules {
@@ -107,8 +107,8 @@
       : beamformer(beamformer) {}
   // Accessed internally from capture or during initialization
   std::list<ProcessingComponent*> component_list;
-  rtc::scoped_ptr<Beamformer<float>> beamformer;
-  rtc::scoped_ptr<AgcManagerDirect> agc_manager;
+  std::unique_ptr<Beamformer<float>> beamformer;
+  std::unique_ptr<AgcManagerDirect> agc_manager;
 };
 
 const int AudioProcessing::kNativeSampleRatesHz[] = {
@@ -297,11 +297,11 @@
         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 b3f43fa..4a28761 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 <list>
+#include <memory>
 #include <string>
 #include <vector>
 
 #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 @@
   // State for the debug dump.
   struct ApmDebugDumpThreadState {
     ApmDebugDumpThreadState() : event_msg(new audioproc::Event()) {}
-    rtc::scoped_ptr<audioproc::Event> event_msg;  // Protobuf message.
+    std::unique_ptr<audioproc::Event> event_msg;  // Protobuf message.
     std::string event_str;  // Memory for protobuf serialization.
 
     // Serialized string of last saved APM configuration.
@@ -149,7 +149,7 @@
     // 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<FileWrapper> debug_file;
+    std::unique_ptr<FileWrapper> debug_file;
     ApmDebugDumpThreadState render;
     ApmDebugDumpThreadState capture;
   };
@@ -250,8 +250,8 @@
   rtc::CriticalSection crit_capture_;
 
   // Structs containing the pointers to the submodules.
-  rtc::scoped_ptr<ApmPublicSubmodules> public_submodules_;
-  rtc::scoped_ptr<ApmPrivateSubmodules> private_submodules_
+  std::unique_ptr<ApmPublicSubmodules> public_submodules_;
+  std::unique_ptr<ApmPrivateSubmodules> private_submodules_
       GUARDED_BY(crit_capture_);
 
   // State that is written to while holding both the render and capture locks
@@ -313,7 +313,7 @@
     bool transient_suppressor_enabled;
     std::vector<Point> array_geometry;
     SphericalPointf target_direction;
-    rtc::scoped_ptr<AudioBuffer> capture_audio;
+    std::unique_ptr<AudioBuffer> 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 @@
   } capture_nonlocked_;
 
   struct ApmRenderState {
-    rtc::scoped_ptr<AudioConverter> render_converter;
-    rtc::scoped_ptr<AudioBuffer> render_audio;
+    std::unique_ptr<AudioConverter> render_converter;
+    std::unique_ptr<AudioBuffer> 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 7ce6a56..663a8a5 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 <algorithm>
+#include <memory>
 #include <vector>
 
 #include "testing/gtest/include/gtest/gtest.h"
@@ -447,7 +448,7 @@
   rtc::PlatformThread stats_thread_;
   mutable RandomGenerator rand_gen_;
 
-  rtc::scoped_ptr<AudioProcessing> apm_;
+  std::unique_ptr<AudioProcessing> 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 093c03e..a4a8351 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 <math.h>
 
 #include <algorithm>
+#include <memory>
 #include <vector>
 
 #include "testing/gtest/include/gtest/gtest.h"
@@ -657,19 +658,19 @@
   }
 
   // Event handler for the test.
-  const rtc::scoped_ptr<EventWrapper> test_complete_;
+  const std::unique_ptr<EventWrapper> test_complete_;
 
   // Thread related variables.
-  rtc::scoped_ptr<rtc::PlatformThread> render_thread_;
-  rtc::scoped_ptr<rtc::PlatformThread> capture_thread_;
+  std::unique_ptr<rtc::PlatformThread> render_thread_;
+  std::unique_ptr<rtc::PlatformThread> capture_thread_;
   Random rand_gen_;
 
-  rtc::scoped_ptr<AudioProcessing> apm_;
+  std::unique_ptr<AudioProcessing> apm_;
   const SimulationConfig simulation_config_;
   FrameCounters frame_counters_;
   LockedFlag capture_call_checker_;
-  rtc::scoped_ptr<TimedThreadApiProcessor> render_thread_state_;
-  rtc::scoped_ptr<TimedThreadApiProcessor> capture_thread_state_;
+  std::unique_ptr<TimedThreadApiProcessor> render_thread_state_;
+  std::unique_ptr<TimedThreadApiProcessor> 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 707c515..fe0e24c 100644
--- a/webrtc/modules/audio_processing/beamformer/complex_matrix.h
+++ b/webrtc/modules/audio_processing/beamformer/complex_matrix.h
@@ -14,7 +14,6 @@
 #include <complex>
 
 #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 51c1cece9..40b4793 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 29c416c..6119f0f 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 <math.h>
+
+#include <memory>
 #include <vector>
 
 #include "webrtc/common_audio/lapped_transform.h"
@@ -125,7 +127,7 @@
 
   // Deals with the fft transform and blocking.
   size_t chunk_length_;
-  rtc::scoped_ptr<LappedTransform> lapped_transform_;
+  std::unique_ptr<LappedTransform> 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 82ae859..fbc2bcc 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 <memory>
+
 #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 @@
   std::vector<float> capture_queue_buffer_ GUARDED_BY(crit_capture_);
 
   // Lock protection not needed.
-  rtc::scoped_ptr<SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>>>
+  std::unique_ptr<SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>>>
       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 7f152bf..163e420 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 <memory>
+
 #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 @@
 namespace webrtc {
 
 TEST(EchoCancellationInternalTest, ExtendedFilter) {
-  rtc::scoped_ptr<AudioProcessing> ap(AudioProcessing::Create());
+  std::unique_ptr<AudioProcessing> 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, DelayAgnostic) {
-  rtc::scoped_ptr<AudioProcessing> ap(AudioProcessing::Create());
+  std::unique_ptr<AudioProcessing> 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 4d6529d..23c1abb 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 <memory>
+
 #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 @@
   std::vector<int16_t> capture_queue_buffer_ GUARDED_BY(crit_capture_);
 
   // Lock protection not needed.
-  rtc::scoped_ptr<
+  std::unique_ptr<
       SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>>
       render_signal_queue_;
 };
diff --git a/webrtc/modules/audio_processing/gain_control_impl.h b/webrtc/modules/audio_processing/gain_control_impl.h
index 72789ba..942a183 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 <memory>
 #include <vector>
 
 #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 @@
   std::vector<int16_t> capture_queue_buffer_ GUARDED_BY(crit_capture_);
 
   // Lock protection not needed.
-  rtc::scoped_ptr<
+  std::unique_ptr<
       SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>>
       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 375d58f..d33ec78 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() {}
 
 void HighPassFilterImpl::Initialize(size_t channels, int sample_rate_hz) {
-  std::vector<rtc::scoped_ptr<BiquadFilter>> new_filters(channels);
+  std::vector<std::unique_ptr<BiquadFilter>> 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 0e985ba..a02e661 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 <memory>
+
 #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 BiquadFilter;
   rtc::CriticalSection* const crit_ = nullptr;
   bool enabled_ GUARDED_BY(crit_) = false;
-  std::vector<rtc::scoped_ptr<BiquadFilter>> filters_ GUARDED_BY(crit_);
+  std::vector<std::unique_ptr<BiquadFilter>> 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 363e99a..b5ea587 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 <memory>
+
 #include "webrtc/modules/audio_processing/include/audio_processing.h"
 
 namespace webrtc {
@@ -282,13 +283,13 @@
   }
 
  private:
-  rtc::scoped_ptr<MockEchoCancellation> echo_cancellation_;
-  rtc::scoped_ptr<MockEchoControlMobile> echo_control_mobile_;
-  rtc::scoped_ptr<MockGainControl> gain_control_;
-  rtc::scoped_ptr<MockHighPassFilter> high_pass_filter_;
-  rtc::scoped_ptr<MockLevelEstimator> level_estimator_;
-  rtc::scoped_ptr<MockNoiseSuppression> noise_suppression_;
-  rtc::scoped_ptr<MockVoiceDetection> voice_detection_;
+  std::unique_ptr<MockEchoCancellation> echo_cancellation_;
+  std::unique_ptr<MockEchoControlMobile> echo_control_mobile_;
+  std::unique_ptr<MockGainControl> gain_control_;
+  std::unique_ptr<MockHighPassFilter> high_pass_filter_;
+  std::unique_ptr<MockLevelEstimator> level_estimator_;
+  std::unique_ptr<MockNoiseSuppression> noise_suppression_;
+  std::unique_ptr<MockVoiceDetection> 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 9cb03ca..2deb4d2 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 <complex>
+#include <memory>
 #include <vector>
 
-#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 @@
 
   intelligibility::PowerEstimator clear_power_;
   std::vector<float> noise_power_;
-  rtc::scoped_ptr<float[]> filtered_clear_pow_;
-  rtc::scoped_ptr<float[]> filtered_noise_pow_;
-  rtc::scoped_ptr<float[]> center_freqs_;
+  std::unique_ptr<float[]> filtered_clear_pow_;
+  std::unique_ptr<float[]> filtered_noise_pow_;
+  std::unique_ptr<float[]> center_freqs_;
   std::vector<std::vector<float>> capture_filter_bank_;
   std::vector<std::vector<float>> render_filter_bank_;
   size_t start_freq_;
-  rtc::scoped_ptr<float[]> rho_;  // Production and interpretation SNR.
+  std::unique_ptr<float[]> rho_;  // Production and interpretation SNR.
                                   // for each ERB band.
-  rtc::scoped_ptr<float[]> gains_eq_;  // Pre-filter modified gains.
+  std::unique_ptr<float[]> 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<float> temp_render_out_buffer_;
 
-  rtc::scoped_ptr<float[]> kbd_window_;
+  std::unique_ptr<float[]> kbd_window_;
   TransformCallback render_callback_;
-  rtc::scoped_ptr<LappedTransform> render_mangler_;
+  std::unique_ptr<LappedTransform> 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 0d15406..b0f94ec 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 <math.h>
 #include <stdlib.h>
+
 #include <algorithm>
+#include <memory>
 #include <vector>
 
 #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 @@
   }
 
   IntelligibilityEnhancer::Config config_;
-  rtc::scoped_ptr<IntelligibilityEnhancer> enh_;
+  std::unique_ptr<IntelligibilityEnhancer> enh_;
   std::vector<float> clear_data_;
   std::vector<float> noise_data_;
   std::vector<float> orig_data_;
diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h b/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.h
index 2bf0791..8858cff 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 <complex>
-
-#include "webrtc/base/scoped_ptr.h"
+#include <memory>
 
 namespace webrtc {
 
@@ -36,13 +35,13 @@
 
  private:
   // TODO(ekmeyerson): Switch the following running means
-  // and histories from rtc::scoped_ptr to std::vector.
-  rtc::scoped_ptr<std::complex<float>[]> running_mean_sq_;
+  // and histories from std::unique_ptr to std::vector.
+  std::unique_ptr<std::complex<float>[]> running_mean_sq_;
 
   // The current magnitude array.
-  rtc::scoped_ptr<float[]> magnitude_;
+  std::unique_ptr<float[]> magnitude_;
   // The current power array.
-  rtc::scoped_ptr<float[]> power_;
+  std::unique_ptr<float[]> power_;
 
   const size_t num_freqs_;
   const float decay_;
@@ -66,8 +65,8 @@
  private:
   const size_t num_freqs_;
   const float change_limit_;
-  rtc::scoped_ptr<float[]> target_;
-  rtc::scoped_ptr<float[]> current_;
+  std::unique_ptr<float[]> target_;
+  std::unique_ptr<float[]> current_;
 };
 
 }  // namespace intelligibility
diff --git a/webrtc/modules/audio_processing/level_estimator_impl.h b/webrtc/modules/audio_processing/level_estimator_impl.h
index 4401da3..df43c9b 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 <memory>
+
 #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 @@
  private:
   rtc::CriticalSection* const crit_ = nullptr;
   bool enabled_ GUARDED_BY(crit_) = false;
-  rtc::scoped_ptr<RMSLevel> rms_ GUARDED_BY(crit_);
+  std::unique_ptr<RMSLevel> 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 dbfe1c4..076f1ba 100644
--- a/webrtc/modules/audio_processing/noise_suppression_impl.cc
+++ b/webrtc/modules/audio_processing/noise_suppression_impl.cc
@@ -56,7 +56,7 @@
   rtc::CritScope cs(crit_);
   channels_ = channels;
   sample_rate_hz_ = sample_rate_hz;
-  std::vector<rtc::scoped_ptr<Suppressor>> new_suppressors;
+  std::vector<std::unique_ptr<Suppressor>> 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 47fe815..ef30bb1 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 <memory>
 #include <vector>
 
 #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 @@
   Level level_ GUARDED_BY(crit_) = kModerate;
   size_t channels_ GUARDED_BY(crit_) = 0;
   int sample_rate_hz_ GUARDED_BY(crit_) = 0;
-  std::vector<rtc::scoped_ptr<Suppressor>> suppressors_ GUARDED_BY(crit_);
+  std::vector<std::unique_ptr<Suppressor>> 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 22d218c..674a519 100644
--- a/webrtc/modules/audio_processing/voice_detection_impl.cc
+++ b/webrtc/modules/audio_processing/voice_detection_impl.cc
@@ -41,7 +41,7 @@
 void VoiceDetectionImpl::Initialize(int sample_rate_hz) {
   rtc::CritScope cs(crit_);
   sample_rate_hz_ = sample_rate_hz;
-  rtc::scoped_ptr<Vad> new_vad;
+  std::unique_ptr<Vad> 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 0d6d8cf..6ba43db 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 <memory>
+
 #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 @@
   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> vad_ GUARDED_BY(crit_);
+  std::unique_ptr<Vad> 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 2cb0a1b..258d023 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"