Replace scoped_ptr with unique_ptr in webrtc/modules/audio_processing/vad/

BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1699003002

Cr-Commit-Position: refs/heads/master@{#11657}
diff --git a/webrtc/modules/audio_processing/vad/common.h b/webrtc/modules/audio_processing/vad/common.h
index be99c1c..4b7fb50 100644
--- a/webrtc/modules/audio_processing/vad/common.h
+++ b/webrtc/modules/audio_processing/vad/common.h
@@ -11,6 +11,8 @@
 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_VAD_COMMON_H_
 #define WEBRTC_MODULES_AUDIO_PROCESSING_VAD_COMMON_H_
 
+#include <stddef.h>
+
 static const int kSampleRateHz = 16000;
 static const size_t kLength10Ms = kSampleRateHz / 100;
 static const size_t kMaxNumFrames = 4;
diff --git a/webrtc/modules/audio_processing/vad/pitch_based_vad.h b/webrtc/modules/audio_processing/vad/pitch_based_vad.h
index c502184..4fb0c55 100644
--- a/webrtc/modules/audio_processing/vad/pitch_based_vad.h
+++ b/webrtc/modules/audio_processing/vad/pitch_based_vad.h
@@ -11,7 +11,8 @@
 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_VAD_PITCH_BASED_VAD_H_
 #define WEBRTC_MODULES_AUDIO_PROCESSING_VAD_PITCH_BASED_VAD_H_
 
-#include "webrtc/base/scoped_ptr.h"
+#include <memory>
+
 #include "webrtc/modules/audio_processing/vad/common.h"
 #include "webrtc/modules/audio_processing/vad/gmm.h"
 #include "webrtc/typedefs.h"
@@ -50,7 +51,7 @@
 
   double p_prior_;
 
-  rtc::scoped_ptr<VadCircularBuffer> circular_buffer_;
+  std::unique_ptr<VadCircularBuffer> circular_buffer_;
 };
 
 }  // namespace webrtc
diff --git a/webrtc/modules/audio_processing/vad/pole_zero_filter_unittest.cc b/webrtc/modules/audio_processing/vad/pole_zero_filter_unittest.cc
index 492c3f0..b3a0eb0 100644
--- a/webrtc/modules/audio_processing/vad/pole_zero_filter_unittest.cc
+++ b/webrtc/modules/audio_processing/vad/pole_zero_filter_unittest.cc
@@ -13,8 +13,9 @@
 #include <math.h>
 #include <stdio.h>
 
+#include <memory>
+
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/audio_processing/vad/vad_audio_proc_internal.h"
 #include "webrtc/test/testsupport/fileutils.h"
 
@@ -58,7 +59,7 @@
 
  private:
   void TestClean();
-  rtc::scoped_ptr<PoleZeroFilter> my_filter_;
+  std::unique_ptr<PoleZeroFilter> my_filter_;
 };
 
 void PoleZeroFilterTest::FilterSubframes(int num_subframes) {
diff --git a/webrtc/modules/audio_processing/vad/standalone_vad.h b/webrtc/modules/audio_processing/vad/standalone_vad.h
index 6a25424..3cf1a42 100644
--- a/webrtc/modules/audio_processing/vad/standalone_vad.h
+++ b/webrtc/modules/audio_processing/vad/standalone_vad.h
@@ -11,7 +11,6 @@
 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AGC_STANDALONE_VAD_H_
 #define WEBRTC_MODULES_AUDIO_PROCESSING_AGC_STANDALONE_VAD_H_
 
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/audio_processing/vad/common.h"
 #include "webrtc/common_audio/vad/include/webrtc_vad.h"
 #include "webrtc/typedefs.h"
diff --git a/webrtc/modules/audio_processing/vad/standalone_vad_unittest.cc b/webrtc/modules/audio_processing/vad/standalone_vad_unittest.cc
index 1d1dcc7..482a20a 100644
--- a/webrtc/modules/audio_processing/vad/standalone_vad_unittest.cc
+++ b/webrtc/modules/audio_processing/vad/standalone_vad_unittest.cc
@@ -12,15 +12,16 @@
 
 #include <string.h>
 
+#include <memory>
+
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/include/module_common_types.h"
 #include "webrtc/test/testsupport/fileutils.h"
 
 namespace webrtc {
 
 TEST(StandaloneVadTest, Api) {
-  rtc::scoped_ptr<StandaloneVad> vad(StandaloneVad::Create());
+  std::unique_ptr<StandaloneVad> vad(StandaloneVad::Create());
   int16_t data[kLength10Ms] = {0};
 
   // Valid frame length (for 32 kHz rate), but not what the VAD is expecting.
@@ -59,7 +60,7 @@
 #else
 TEST(StandaloneVadTest, ActivityDetection) {
 #endif
-  rtc::scoped_ptr<StandaloneVad> vad(StandaloneVad::Create());
+  std::unique_ptr<StandaloneVad> vad(StandaloneVad::Create());
   const size_t kDataLength = kLength10Ms;
   int16_t data[kDataLength] = {0};
 
diff --git a/webrtc/modules/audio_processing/vad/vad_audio_proc.h b/webrtc/modules/audio_processing/vad/vad_audio_proc.h
index 85500ae..a8ecc7b 100644
--- a/webrtc/modules/audio_processing/vad/vad_audio_proc.h
+++ b/webrtc/modules/audio_processing/vad/vad_audio_proc.h
@@ -11,7 +11,8 @@
 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_VAD_VAD_AUDIO_PROC_H_
 #define WEBRTC_MODULES_AUDIO_PROCESSING_VAD_VAD_AUDIO_PROC_H_
 
-#include "webrtc/base/scoped_ptr.h"
+#include <memory>
+
 #include "webrtc/modules/audio_processing/vad/common.h"
 #include "webrtc/typedefs.h"
 
@@ -79,9 +80,9 @@
   double log_old_gain_;
   double old_lag_;
 
-  rtc::scoped_ptr<PitchAnalysisStruct> pitch_analysis_handle_;
-  rtc::scoped_ptr<PreFiltBankstr> pre_filter_handle_;
-  rtc::scoped_ptr<PoleZeroFilter> high_pass_filter_;
+  std::unique_ptr<PitchAnalysisStruct> pitch_analysis_handle_;
+  std::unique_ptr<PreFiltBankstr> pre_filter_handle_;
+  std::unique_ptr<PoleZeroFilter> high_pass_filter_;
 };
 
 }  // namespace webrtc
diff --git a/webrtc/modules/audio_processing/vad/vad_circular_buffer.h b/webrtc/modules/audio_processing/vad/vad_circular_buffer.h
index 5238f77..cfa6977 100644
--- a/webrtc/modules/audio_processing/vad/vad_circular_buffer.h
+++ b/webrtc/modules/audio_processing/vad/vad_circular_buffer.h
@@ -11,7 +11,7 @@
 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_VAD_VAD_CIRCULAR_BUFFER_H_
 #define WEBRTC_MODULES_AUDIO_PROCESSING_VAD_VAD_CIRCULAR_BUFFER_H_
 
-#include "webrtc/base/scoped_ptr.h"
+#include <memory>
 
 namespace webrtc {
 
@@ -58,7 +58,7 @@
   // corresponding linear index.
   int ConvertToLinearIndex(int* index) const;
 
-  rtc::scoped_ptr<double[]> buffer_;
+  std::unique_ptr<double[]> buffer_;
   bool is_full_;
   int index_;
   int buffer_size_;
diff --git a/webrtc/modules/audio_processing/vad/vad_circular_buffer_unittest.cc b/webrtc/modules/audio_processing/vad/vad_circular_buffer_unittest.cc
index 11945e0..81c3a2d 100644
--- a/webrtc/modules/audio_processing/vad/vad_circular_buffer_unittest.cc
+++ b/webrtc/modules/audio_processing/vad/vad_circular_buffer_unittest.cc
@@ -12,8 +12,9 @@
 
 #include <stdio.h>
 
+#include <memory>
+
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/base/scoped_ptr.h"
 
 namespace webrtc {
 
@@ -44,7 +45,7 @@
 }
 
 TEST(VadCircularBufferTest, GeneralTest) {
-  rtc::scoped_ptr<VadCircularBuffer> circular_buffer(
+  std::unique_ptr<VadCircularBuffer> circular_buffer(
       VadCircularBuffer::Create(kShortBuffSize));
   double mean_val;
 
@@ -72,7 +73,7 @@
 }
 
 TEST(VadCircularBufferTest, TransientsRemoval) {
-  rtc::scoped_ptr<VadCircularBuffer> circular_buffer(
+  std::unique_ptr<VadCircularBuffer> circular_buffer(
       VadCircularBuffer::Create(kLongBuffSize));
   // Let the first transient be in wrap-around.
   InsertZeros(kLongBuffSize - kWidthThreshold / 2, circular_buffer.get());
@@ -91,7 +92,7 @@
 }
 
 TEST(VadCircularBufferTest, TransientDetection) {
-  rtc::scoped_ptr<VadCircularBuffer> circular_buffer(
+  std::unique_ptr<VadCircularBuffer> circular_buffer(
       VadCircularBuffer::Create(kLongBuffSize));
   // Let the first transient be in wrap-around.
   int num_insertion = kLongBuffSize - kWidthThreshold / 2;
diff --git a/webrtc/modules/audio_processing/vad/voice_activity_detector.h b/webrtc/modules/audio_processing/vad/voice_activity_detector.h
index e2dcf02..25f10dd 100644
--- a/webrtc/modules/audio_processing/vad/voice_activity_detector.h
+++ b/webrtc/modules/audio_processing/vad/voice_activity_detector.h
@@ -11,9 +11,9 @@
 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_VAD_VOICE_ACTIVITY_DETECTOR_H_
 #define WEBRTC_MODULES_AUDIO_PROCESSING_VAD_VOICE_ACTIVITY_DETECTOR_H_
 
+#include <memory>
 #include <vector>
 
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/common_audio/resampler/include/resampler.h"
 #include "webrtc/modules/audio_processing/vad/vad_audio_proc.h"
 #include "webrtc/modules/audio_processing/vad/common.h"
@@ -58,7 +58,7 @@
   Resampler resampler_;
   VadAudioProc audio_processing_;
 
-  rtc::scoped_ptr<StandaloneVad> standalone_vad_;
+  std::unique_ptr<StandaloneVad> standalone_vad_;
   PitchBasedVad pitch_based_vad_;
 
   int16_t resampled_[kLength10Ms];