Replace scoped_ptr with unique_ptr in webrtc/voice_engine/

Also introduce a pair of scoped_ptr <-> unique_ptr conversion
functions. By using them judiciously, we can keep these CL:s small and
avoid having to convert enormous amounts of code at once.

BUG=webrtc:5520

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

Cr-Original-Commit-Position: refs/heads/master@{#11658}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: b7f89d6e668602e46a20e3a9927790ff34029b2a
diff --git a/voice_engine/channel.cc b/voice_engine/channel.cc
index c078d20..9e27ce8 100644
--- a/voice_engine/channel.cc
+++ b/voice_engine/channel.cc
@@ -1071,7 +1071,7 @@
   return 0;
 }
 
-void Channel::SetSink(rtc::scoped_ptr<AudioSinkInterface> sink) {
+void Channel::SetSink(std::unique_ptr<AudioSinkInterface> sink) {
   rtc::CritScope cs(&_callbackCritSect);
   audio_sink_ = std::move(sink);
 }
@@ -3265,7 +3265,7 @@
 // TODO(andrew): refactor Mix functions here and in transmit_mixer.cc to use
 // a shared helper.
 int32_t Channel::MixOrReplaceAudioWithFile(int mixingFrequency) {
-  rtc::scoped_ptr<int16_t[]> fileBuffer(new int16_t[640]);
+  std::unique_ptr<int16_t[]> fileBuffer(new int16_t[640]);
   size_t fileSamples(0);
 
   {
@@ -3313,7 +3313,7 @@
 int32_t Channel::MixAudioWithFile(AudioFrame& audioFrame, int mixingFrequency) {
   assert(mixingFrequency <= 48000);
 
-  rtc::scoped_ptr<int16_t[]> fileBuffer(new int16_t[960]);
+  std::unique_ptr<int16_t[]> fileBuffer(new int16_t[960]);
   size_t fileSamples(0);
 
   {
diff --git a/voice_engine/channel.h b/voice_engine/channel.h
index 60c751e..0e87252 100644
--- a/voice_engine/channel.h
+++ b/voice_engine/channel.h
@@ -11,9 +11,10 @@
 #ifndef WEBRTC_VOICE_ENGINE_CHANNEL_H_
 #define WEBRTC_VOICE_ENGINE_CHANNEL_H_
 
+#include <memory>
+
 #include "webrtc/audio/audio_sink.h"
 #include "webrtc/base/criticalsection.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/common_audio/resampler/include/push_resampler.h"
 #include "webrtc/common_types.h"
 #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
@@ -193,7 +194,7 @@
                                rtc::CriticalSection* callbackCritSect);
   int32_t UpdateLocalTimeStamp();
 
-  void SetSink(rtc::scoped_ptr<AudioSinkInterface> sink);
+  void SetSink(std::unique_ptr<AudioSinkInterface> sink);
 
   // API methods
 
@@ -493,15 +494,15 @@
 
   RtcEventLog* const event_log_;
 
-  rtc::scoped_ptr<RtpHeaderParser> rtp_header_parser_;
-  rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_;
-  rtc::scoped_ptr<ReceiveStatistics> rtp_receive_statistics_;
-  rtc::scoped_ptr<StatisticsProxy> statistics_proxy_;
-  rtc::scoped_ptr<RtpReceiver> rtp_receiver_;
+  std::unique_ptr<RtpHeaderParser> rtp_header_parser_;
+  std::unique_ptr<RTPPayloadRegistry> rtp_payload_registry_;
+  std::unique_ptr<ReceiveStatistics> rtp_receive_statistics_;
+  std::unique_ptr<StatisticsProxy> statistics_proxy_;
+  std::unique_ptr<RtpReceiver> rtp_receiver_;
   TelephoneEventHandler* telephone_event_handler_;
-  rtc::scoped_ptr<RtpRtcp> _rtpRtcpModule;
-  rtc::scoped_ptr<AudioCodingModule> audio_coding_;
-  rtc::scoped_ptr<AudioSinkInterface> audio_sink_;
+  std::unique_ptr<RtpRtcp> _rtpRtcpModule;
+  std::unique_ptr<AudioCodingModule> audio_coding_;
+  std::unique_ptr<AudioSinkInterface> audio_sink_;
   AudioLevel _outputAudioLevel;
   bool _externalTransport;
   AudioFrame _audioFrame;
@@ -535,7 +536,7 @@
 
   rtc::CriticalSection ts_stats_lock_;
 
-  rtc::scoped_ptr<rtc::TimestampWrapAroundHandler> rtp_ts_wraparound_handler_;
+  std::unique_ptr<rtc::TimestampWrapAroundHandler> rtp_ts_wraparound_handler_;
   // The rtp timestamp of the first played out audio frame.
   int64_t capture_start_rtp_time_stamp_;
   // The capture ntp time (in local timebase) of the first played out audio
@@ -552,7 +553,7 @@
   rtc::CriticalSection* _callbackCritSectPtr;    // owned by base
   Transport* _transportPtr;  // WebRtc socket or external transport
   RMSLevel rms_level_;
-  rtc::scoped_ptr<AudioProcessing> rx_audioproc_;  // far end AudioProcessing
+  std::unique_ptr<AudioProcessing> rx_audioproc_;  // far end AudioProcessing
   VoERxVadCallback* _rxVadObserverPtr;
   int32_t _oldVadDecision;
   int32_t _sendFrameType;  // Send data is voice, 1-voice, 0-otherwise
@@ -584,17 +585,17 @@
   bool _rxNsIsEnabled;
   bool restored_packet_in_use_;
   // RtcpBandwidthObserver
-  rtc::scoped_ptr<VoERtcpObserver> rtcp_observer_;
-  rtc::scoped_ptr<NetworkPredictor> network_predictor_;
+  std::unique_ptr<VoERtcpObserver> rtcp_observer_;
+  std::unique_ptr<NetworkPredictor> network_predictor_;
   // An associated send channel.
   rtc::CriticalSection assoc_send_channel_lock_;
   ChannelOwner associate_send_channel_ GUARDED_BY(assoc_send_channel_lock_);
 
   bool pacing_enabled_;
   PacketRouter* packet_router_ = nullptr;
-  rtc::scoped_ptr<TransportFeedbackProxy> feedback_observer_proxy_;
-  rtc::scoped_ptr<TransportSequenceNumberProxy> seq_num_allocator_proxy_;
-  rtc::scoped_ptr<RtpPacketSenderProxy> rtp_packet_sender_proxy_;
+  std::unique_ptr<TransportFeedbackProxy> feedback_observer_proxy_;
+  std::unique_ptr<TransportSequenceNumberProxy> seq_num_allocator_proxy_;
+  std::unique_ptr<RtpPacketSenderProxy> rtp_packet_sender_proxy_;
 };
 
 }  // namespace voe
diff --git a/voice_engine/channel_manager.cc b/voice_engine/channel_manager.cc
index eac2e50..96f6d2b 100644
--- a/voice_engine/channel_manager.cc
+++ b/voice_engine/channel_manager.cc
@@ -49,7 +49,7 @@
     : instance_id_(instance_id),
       last_channel_id_(-1),
       config_(config),
-      event_log_(RtcEventLog::Create()) {}
+      event_log_(rtc::ScopedToUnique(RtcEventLog::Create())) {}
 
 ChannelOwner ChannelManager::CreateChannel() {
   return CreateChannelInternal(config_);
diff --git a/voice_engine/channel_manager.h b/voice_engine/channel_manager.h
index 7c86959..77dfc45 100644
--- a/voice_engine/channel_manager.h
+++ b/voice_engine/channel_manager.h
@@ -11,11 +11,11 @@
 #ifndef WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_H
 #define WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_H
 
+#include <memory>
 #include <vector>
 
 #include "webrtc/base/constructormagic.h"
 #include "webrtc/base/criticalsection.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/call/rtc_event_log.h"
 #include "webrtc/system_wrappers/include/atomic32.h"
 #include "webrtc/typedefs.h"
@@ -62,7 +62,7 @@
   // deleted when no references to them are held.
   struct ChannelRef {
     ChannelRef(Channel* channel);
-    const rtc::scoped_ptr<Channel> channel;
+    const std::unique_ptr<Channel> channel;
     Atomic32 ref_count;
   };
 
@@ -127,7 +127,7 @@
   std::vector<ChannelOwner> channels_;
 
   const Config& config_;
-  rtc::scoped_ptr<RtcEventLog> event_log_;
+  std::unique_ptr<RtcEventLog> event_log_;
 
   RTC_DISALLOW_COPY_AND_ASSIGN(ChannelManager);
 };
diff --git a/voice_engine/channel_proxy.cc b/voice_engine/channel_proxy.cc
index 1e2281a..3beaf9b 100644
--- a/voice_engine/channel_proxy.cc
+++ b/voice_engine/channel_proxy.cc
@@ -155,7 +155,7 @@
       channel()->SendTelephoneEventOutband(event, duration_ms, 10, false) == 0;
 }
 
-void ChannelProxy::SetSink(rtc::scoped_ptr<AudioSinkInterface> sink) {
+void ChannelProxy::SetSink(std::unique_ptr<AudioSinkInterface> sink) {
   RTC_DCHECK(thread_checker_.CalledOnValidThread());
   channel()->SetSink(std::move(sink));
 }
diff --git a/voice_engine/channel_proxy.h b/voice_engine/channel_proxy.h
index 9d6839c..3461cf3 100644
--- a/voice_engine/channel_proxy.h
+++ b/voice_engine/channel_proxy.h
@@ -15,6 +15,7 @@
 #include "webrtc/voice_engine/channel_manager.h"
 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
 
+#include <memory>
 #include <string>
 #include <vector>
 
@@ -69,7 +70,7 @@
   virtual bool SetSendTelephoneEventPayloadType(int payload_type);
   virtual bool SendTelephoneEventOutband(uint8_t event, uint32_t duration_ms);
 
-  virtual void SetSink(rtc::scoped_ptr<AudioSinkInterface> sink);
+  virtual void SetSink(std::unique_ptr<AudioSinkInterface> sink);
 
  private:
   Channel* channel() const;
diff --git a/voice_engine/network_predictor.h b/voice_engine/network_predictor.h
index b35ccd8..bf08fe9 100644
--- a/voice_engine/network_predictor.h
+++ b/voice_engine/network_predictor.h
@@ -11,6 +11,8 @@
 #ifndef WEBRTC_VOICE_ENGINE_NETWORK_PREDICTOR_H_
 #define WEBRTC_VOICE_ENGINE_NETWORK_PREDICTOR_H_
 
+#include <memory>
+
 #include "webrtc/base/exp_filter.h"
 #include "webrtc/system_wrappers/include/clock.h"
 
@@ -38,7 +40,7 @@
   int64_t last_loss_rate_update_time_ms_;
 
   // An exponential filter is used to predict packet loss rate.
-  rtc::scoped_ptr<rtc::ExpFilter> loss_rate_filter_;
+  std::unique_ptr<rtc::ExpFilter> loss_rate_filter_;
 };
 
 }  // namespace voe
diff --git a/voice_engine/network_predictor_unittest.cc b/voice_engine/network_predictor_unittest.cc
index 28ff57f..1471f46 100644
--- a/voice_engine/network_predictor_unittest.cc
+++ b/voice_engine/network_predictor_unittest.cc
@@ -10,6 +10,8 @@
 
 #include <math.h>
 
+#include <memory>
+
 #include "testing/gtest/include/gtest/gtest.h"
 #include "webrtc/voice_engine/network_predictor.h"
 #include "webrtc/system_wrappers/include/clock.h"
@@ -23,7 +25,7 @@
       : clock_(0),
         network_predictor_(new NetworkPredictor(&clock_)) {}
   SimulatedClock clock_;
-  rtc::scoped_ptr<NetworkPredictor> network_predictor_;
+  std::unique_ptr<NetworkPredictor> network_predictor_;
 };
 
 TEST_F(TestNetworkPredictor, TestPacketLossRateFilter) {
diff --git a/voice_engine/shared_data.cc b/voice_engine/shared_data.cc
index 1d50c3c..b21578c 100644
--- a/voice_engine/shared_data.cc
+++ b/voice_engine/shared_data.cc
@@ -27,7 +27,8 @@
       _channelManager(_gInstanceCounter, config),
       _engineStatistics(_gInstanceCounter),
       _audioDevicePtr(NULL),
-      _moduleProcessThreadPtr(ProcessThread::Create("VoiceProcessThread")) {
+      _moduleProcessThreadPtr(
+          rtc::ScopedToUnique(ProcessThread::Create("VoiceProcessThread"))) {
     Trace::CreateTrace();
     if (OutputMixer::Create(_outputMixerPtr, _gInstanceCounter) == 0)
     {
diff --git a/voice_engine/shared_data.h b/voice_engine/shared_data.h
index 1d96103..a4a852a 100644
--- a/voice_engine/shared_data.h
+++ b/voice_engine/shared_data.h
@@ -11,8 +11,9 @@
 #ifndef WEBRTC_VOICE_ENGINE_SHARED_DATA_H
 #define WEBRTC_VOICE_ENGINE_SHARED_DATA_H
 
+#include <memory>
+
 #include "webrtc/base/criticalsection.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/audio_device/include/audio_device.h"
 #include "webrtc/modules/audio_processing/include/audio_processing.h"
 #include "webrtc/modules/utility/include/process_thread.h"
@@ -69,8 +70,8 @@
     AudioDeviceModule* _audioDevicePtr;
     OutputMixer* _outputMixerPtr;
     TransmitMixer* _transmitMixerPtr;
-    rtc::scoped_ptr<AudioProcessing> audioproc_;
-    rtc::scoped_ptr<ProcessThread> _moduleProcessThreadPtr;
+    std::unique_ptr<AudioProcessing> audioproc_;
+    std::unique_ptr<ProcessThread> _moduleProcessThreadPtr;
 
     AudioDeviceModule::AudioLayer _audioDeviceLayer;
 
diff --git a/voice_engine/test/auto_test/fakes/conference_transport.h b/voice_engine/test/auto_test/fakes/conference_transport.h
index cce6148..8fd7457 100644
--- a/voice_engine/test/auto_test/fakes/conference_transport.h
+++ b/voice_engine/test/auto_test/fakes/conference_transport.h
@@ -13,13 +13,13 @@
 
 #include <deque>
 #include <map>
+#include <memory>
 #include <utility>
 
 #include "testing/gtest/include/gtest/gtest.h"
 #include "webrtc/base/basictypes.h"
 #include "webrtc/base/criticalsection.h"
 #include "webrtc/base/platform_thread.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/common_types.h"
 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
 #include "webrtc/system_wrappers/include/event_wrapper.h"
@@ -130,7 +130,7 @@
 
   rtc::CriticalSection pq_crit_;
   rtc::CriticalSection stream_crit_;
-  const rtc::scoped_ptr<webrtc::EventWrapper> packet_event_;
+  const std::unique_ptr<webrtc::EventWrapper> packet_event_;
   rtc::PlatformThread thread_;
 
   unsigned int rtt_ms_;
@@ -156,7 +156,7 @@
 
   LoudestFilter loudest_filter_;
 
-  const rtc::scoped_ptr<webrtc::RtpHeaderParser> rtp_header_parser_;
+  const std::unique_ptr<webrtc::RtpHeaderParser> rtp_header_parser_;
 };
 }  // namespace voetest
 
diff --git a/voice_engine/test/auto_test/fixtures/after_initialization_fixture.h b/voice_engine/test/auto_test/fixtures/after_initialization_fixture.h
index 46b7abf..6608669 100644
--- a/voice_engine/test/auto_test/fixtures/after_initialization_fixture.h
+++ b/voice_engine/test/auto_test/fixtures/after_initialization_fixture.h
@@ -12,10 +12,10 @@
 #define SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_AFTER_INIT_H_
 
 #include <deque>
+#include <memory>
 
 #include "webrtc/base/criticalsection.h"
 #include "webrtc/base/platform_thread.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/common_types.h"
 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
 #include "webrtc/system_wrappers/include/atomic32.h"
@@ -143,7 +143,7 @@
   }
 
   rtc::CriticalSection crit_;
-  const rtc::scoped_ptr<webrtc::EventWrapper> packet_event_;
+  const std::unique_ptr<webrtc::EventWrapper> packet_event_;
   rtc::PlatformThread thread_;
   std::deque<Packet> packet_queue_ GUARDED_BY(crit_);
   const int channel_;
@@ -163,7 +163,7 @@
   virtual ~AfterInitializationFixture();
 
  protected:
-  rtc::scoped_ptr<TestErrorObserver> error_observer_;
+  std::unique_ptr<TestErrorObserver> error_observer_;
 };
 
 #endif  // SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_AFTER_INIT_H_
diff --git a/voice_engine/test/auto_test/standard/rtp_rtcp_extensions.cc b/voice_engine/test/auto_test/standard/rtp_rtcp_extensions.cc
index 1dc15df..16f17b1 100644
--- a/voice_engine/test/auto_test/standard/rtp_rtcp_extensions.cc
+++ b/voice_engine/test/auto_test/standard/rtp_rtcp_extensions.cc
@@ -8,6 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <memory>
+
 #include "webrtc/modules/include/module_common_types.h"
 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
 #include "webrtc/system_wrappers/include/atomic32.h"
@@ -83,7 +85,7 @@
     kPacketsExpected = 10,
     kSleepIntervalMs = 10
   };
-  rtc::scoped_ptr<webrtc::RtpHeaderParser> parser_;
+  std::unique_ptr<webrtc::RtpHeaderParser> parser_;
   webrtc::Atomic32 received_packets_;
   webrtc::Atomic32 bad_packets_;
   int audio_level_id_;
diff --git a/voice_engine/test/auto_test/standard/rtp_rtcp_test.cc b/voice_engine/test/auto_test/standard/rtp_rtcp_test.cc
index d653cc1..eeb7fa5 100644
--- a/voice_engine/test/auto_test/standard/rtp_rtcp_test.cc
+++ b/voice_engine/test/auto_test/standard/rtp_rtcp_test.cc
@@ -8,6 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <memory>
+
 #include "webrtc/base/criticalsection.h"
 #include "webrtc/system_wrappers/include/atomic32.h"
 #include "webrtc/system_wrappers/include/event_wrapper.h"
@@ -35,7 +37,7 @@
  public:
   rtc::CriticalSection crit_;
   unsigned int incoming_ssrc_;
-  rtc::scoped_ptr<voetest::EventWrapper> changed_ssrc_event_;
+  std::unique_ptr<voetest::EventWrapper> changed_ssrc_event_;
 };
 
 void TestRtpObserver::OnIncomingSSRCChanged(int channel,
diff --git a/voice_engine/test/auto_test/voe_cpu_test.cc b/voice_engine/test/auto_test/voe_cpu_test.cc
index 5666b3f..3bf51aa 100644
--- a/voice_engine/test/auto_test/voe_cpu_test.cc
+++ b/voice_engine/test/auto_test/voe_cpu_test.cc
@@ -17,7 +17,8 @@
 #include <conio.h>
 #endif
 
-#include "webrtc/base/scoped_ptr.h"
+#include <memory>
+
 #include "webrtc/test/channel_transport/channel_transport.h"
 #include "webrtc/voice_engine/test/auto_test/voe_test_defines.h"
 
@@ -64,7 +65,7 @@
   CHECK(base->Init());
   channel = base->CreateChannel();
 
-  rtc::scoped_ptr<VoiceChannelTransport> voice_socket_transport(
+  std::unique_ptr<VoiceChannelTransport> voice_socket_transport(
       new VoiceChannelTransport(voe_network, channel));
 
   CHECK(voice_socket_transport->SetSendDestination("127.0.0.1", 5566));
diff --git a/voice_engine/test/auto_test/voe_output_test.cc b/voice_engine/test/auto_test/voe_output_test.cc
index 3bedbc3..d1bcf96 100644
--- a/voice_engine/test/auto_test/voe_output_test.cc
+++ b/voice_engine/test/auto_test/voe_output_test.cc
@@ -10,7 +10,6 @@
 
 #include "testing/gtest/include/gtest/gtest.h"
 #include "webrtc/base/random.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/base/timeutils.h"
 #include "webrtc/system_wrappers/include/sleep.h"
 #include "webrtc/test/channel_transport/channel_transport.h"
diff --git a/voice_engine/test/auto_test/voe_stress_test.cc b/voice_engine/test/auto_test/voe_stress_test.cc
index 259eff0..0b5660f 100644
--- a/voice_engine/test/auto_test/voe_stress_test.cc
+++ b/voice_engine/test/auto_test/voe_stress_test.cc
@@ -24,7 +24,6 @@
 
 #include "webrtc/voice_engine/test/auto_test/voe_stress_test.h"
 
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/system_wrappers/include/sleep.h"
 #include "webrtc/test/channel_transport/channel_transport.h"
 #include "webrtc/voice_engine/test/auto_test/voe_standard_test.h"
@@ -144,7 +143,7 @@
   printf("Test will take approximately %d minutes. \n",
          numberOfLoops * loopSleep / 1000 / 60 + 1);
 
-  rtc::scoped_ptr<VoiceChannelTransport> voice_channel_transport(
+  std::unique_ptr<VoiceChannelTransport> voice_channel_transport(
       new VoiceChannelTransport(voe_network, 0));
 
   for (i = 0; i < numberOfLoops; ++i) {
diff --git a/voice_engine/test/auto_test/voe_stress_test.h b/voice_engine/test/auto_test/voe_stress_test.h
index 715e8ef..1c91306 100644
--- a/voice_engine/test/auto_test/voe_stress_test.h
+++ b/voice_engine/test/auto_test/voe_stress_test.h
@@ -11,8 +11,9 @@
 #ifndef WEBRTC_VOICE_ENGINE_VOE_STRESS_TEST_H
 #define WEBRTC_VOICE_ENGINE_VOE_STRESS_TEST_H
 
+#include <memory>
+
 #include "webrtc/base/platform_thread.h"
-#include "webrtc/base/scoped_ptr.h"
 
 namespace voetest {
 
@@ -37,8 +38,8 @@
 
   VoETestManager& _mgr;
 
-  // TODO(pbos): Remove scoped_ptr and use PlatformThread directly.
-  rtc::scoped_ptr<rtc::PlatformThread> _ptrExtraApiThread;
+  // TODO(pbos): Remove unique_ptr and use PlatformThread directly.
+  std::unique_ptr<rtc::PlatformThread> _ptrExtraApiThread;
 };
 
 }  // namespace voetest
diff --git a/voice_engine/test/cmd_test/voe_cmd_test.cc b/voice_engine/test/cmd_test/voe_cmd_test.cc
index ccfe3c2..bfc8b65 100644
--- a/voice_engine/test/cmd_test/voe_cmd_test.cc
+++ b/voice_engine/test/cmd_test/voe_cmd_test.cc
@@ -15,12 +15,12 @@
 #include <unistd.h>
 #endif
 
+#include <memory>
 #include <vector>
 
 #include "gflags/gflags.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "webrtc/base/format_macros.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/call/rtc_event_log.h"
 #include "webrtc/engine_configurations.h"
 #include "webrtc/modules/audio_processing/include/audio_processing.h"
@@ -142,7 +142,7 @@
 
   MyObserver my_observer;
 
-  rtc::scoped_ptr<test::TraceToStderr> trace_to_stderr;
+  std::unique_ptr<test::TraceToStderr> trace_to_stderr;
   if (!FLAGS_use_log_file) {
     trace_to_stderr.reset(new test::TraceToStderr);
   } else {
diff --git a/voice_engine/transmit_mixer.cc b/voice_engine/transmit_mixer.cc
index 1490350..d6a5213 100644
--- a/voice_engine/transmit_mixer.cc
+++ b/voice_engine/transmit_mixer.cc
@@ -10,6 +10,8 @@
 
 #include "webrtc/voice_engine/transmit_mixer.h"
 
+#include <memory>
+
 #include "webrtc/base/format_macros.h"
 #include "webrtc/base/logging.h"
 #include "webrtc/modules/utility/include/audio_frame_operations.h"
@@ -1180,7 +1182,7 @@
 int32_t TransmitMixer::MixOrReplaceAudioWithFile(
     int mixingFrequency)
 {
-  rtc::scoped_ptr<int16_t[]> fileBuffer(new int16_t[640]);
+    std::unique_ptr<int16_t[]> fileBuffer(new int16_t[640]);
 
     size_t fileSamples(0);
     {
diff --git a/voice_engine/transmit_mixer.h b/voice_engine/transmit_mixer.h
index e0246cf..b5c483a 100644
--- a/voice_engine/transmit_mixer.h
+++ b/voice_engine/transmit_mixer.h
@@ -12,7 +12,6 @@
 #define WEBRTC_VOICE_ENGINE_TRANSMIT_MIXER_H
 
 #include "webrtc/base/criticalsection.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/common_audio/resampler/include/push_resampler.h"
 #include "webrtc/common_types.h"
 #include "webrtc/modules/audio_processing/typing_detection.h"
diff --git a/voice_engine/voe_codec_unittest.cc b/voice_engine/voe_codec_unittest.cc
index f09e19e..73e576b 100644
--- a/voice_engine/voe_codec_unittest.cc
+++ b/voice_engine/voe_codec_unittest.cc
@@ -8,10 +8,11 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <memory>
+
 #include "webrtc/voice_engine/include/voe_codec.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/modules/audio_device/include/fake_audio_device.h"
 #include "webrtc/voice_engine/include/voe_base.h"
 #include "webrtc/voice_engine/include/voe_hardware.h"
@@ -93,7 +94,7 @@
   int channel_;
   CodecInst primary_;
   CodecInst valid_secondary_;
-  rtc::scoped_ptr<FakeAudioDeviceModule> adm_;
+  std::unique_ptr<FakeAudioDeviceModule> adm_;
 
   // A codec which is not valid to be registered as secondary codec.
   CodecInst invalid_secondary_;
diff --git a/voice_engine/voice_engine_impl.cc b/voice_engine/voice_engine_impl.cc
index d0b7412..919d0e8 100644
--- a/voice_engine/voice_engine_impl.cc
+++ b/voice_engine/voice_engine_impl.cc
@@ -62,12 +62,12 @@
   return new_ref;
 }
 
-rtc::scoped_ptr<voe::ChannelProxy> VoiceEngineImpl::GetChannelProxy(
+std::unique_ptr<voe::ChannelProxy> VoiceEngineImpl::GetChannelProxy(
     int channel_id) {
   RTC_DCHECK(channel_id >= 0);
   rtc::CritScope cs(crit_sec());
   RTC_DCHECK(statistics().Initialized());
-  return rtc::scoped_ptr<voe::ChannelProxy>(
+  return std::unique_ptr<voe::ChannelProxy>(
       new voe::ChannelProxy(channel_manager().GetChannel(channel_id)));
 }
 
diff --git a/voice_engine/voice_engine_impl.h b/voice_engine/voice_engine_impl.h
index f98f881..ed6efe3 100644
--- a/voice_engine/voice_engine_impl.h
+++ b/voice_engine/voice_engine_impl.h
@@ -11,7 +11,8 @@
 #ifndef WEBRTC_VOICE_ENGINE_VOICE_ENGINE_IMPL_H
 #define WEBRTC_VOICE_ENGINE_VOICE_ENGINE_IMPL_H
 
-#include "webrtc/base/scoped_ptr.h"
+#include <memory>
+
 #include "webrtc/engine_configurations.h"
 #include "webrtc/system_wrappers/include/atomic32.h"
 #include "webrtc/voice_engine/voe_base_impl.h"
@@ -134,14 +135,14 @@
 
   // Backdoor to access a voe::Channel object without a channel ID. This is only
   // to be used while refactoring the VoE API!
-  virtual rtc::scoped_ptr<voe::ChannelProxy> GetChannelProxy(int channel_id);
+  virtual std::unique_ptr<voe::ChannelProxy> GetChannelProxy(int channel_id);
 
  // This is *protected* so that FakeVoiceEngine can inherit from the class and
  // manipulate the reference count. See: fake_voice_engine.h.
  protected:
   Atomic32 _ref_count;
  private:
-  rtc::scoped_ptr<const Config> own_config_;
+  std::unique_ptr<const Config> own_config_;
 };
 
 }  // namespace webrtc