Replace scoped_ptr with unique_ptr in webrtc/common_video/

BUG=webrtc:5520

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

Cr-Commit-Position: refs/heads/master@{#11838}
diff --git a/webrtc/common_video/i420_video_frame_unittest.cc b/webrtc/common_video/i420_video_frame_unittest.cc
index bc58e5b..8273136 100644
--- a/webrtc/common_video/i420_video_frame_unittest.cc
+++ b/webrtc/common_video/i420_video_frame_unittest.cc
@@ -13,7 +13,6 @@
 
 #include "testing/gtest/include/gtest/gtest.h"
 #include "webrtc/base/bind.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/test/fake_texture_frame.h"
 #include "webrtc/test/frame_utils.h"
 #include "webrtc/video_frame.h"
diff --git a/webrtc/common_video/include/incoming_video_stream.h b/webrtc/common_video/include/incoming_video_stream.h
index 1aa42e1..b6ab917 100644
--- a/webrtc/common_video/include/incoming_video_stream.h
+++ b/webrtc/common_video/include/incoming_video_stream.h
@@ -11,9 +11,10 @@
 #ifndef WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_
 #define WEBRTC_COMMON_VIDEO_INCLUDE_INCOMING_VIDEO_STREAM_H_
 
+#include <memory>
+
 #include "webrtc/base/criticalsection.h"
 #include "webrtc/base/platform_thread.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/base/thread_annotations.h"
 #include "webrtc/common_video/video_render_frames.h"
 
@@ -82,14 +83,14 @@
   rtc::CriticalSection buffer_critsect_;
   // TODO(pbos): Make plain member and stop resetting this thread, just
   // start/stoping it is enough.
-  rtc::scoped_ptr<rtc::PlatformThread> incoming_render_thread_
+  std::unique_ptr<rtc::PlatformThread> incoming_render_thread_
       GUARDED_BY(thread_critsect_);
-  rtc::scoped_ptr<EventTimerWrapper> deliver_buffer_event_;
+  std::unique_ptr<EventTimerWrapper> deliver_buffer_event_;
 
   bool running_ GUARDED_BY(stream_critsect_);
   VideoRenderCallback* external_callback_ GUARDED_BY(thread_critsect_);
   VideoRenderCallback* render_callback_ GUARDED_BY(thread_critsect_);
-  const rtc::scoped_ptr<VideoRenderFrames> render_buffers_
+  const std::unique_ptr<VideoRenderFrames> render_buffers_
       GUARDED_BY(buffer_critsect_);
 
   uint32_t incoming_rate_ GUARDED_BY(stream_critsect_);
diff --git a/webrtc/common_video/include/video_frame_buffer.h b/webrtc/common_video/include/video_frame_buffer.h
index 191f83e..270f2d5 100644
--- a/webrtc/common_video/include/video_frame_buffer.h
+++ b/webrtc/common_video/include/video_frame_buffer.h
@@ -11,9 +11,12 @@
 #ifndef WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_
 #define WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_
 
+#include <stdint.h>
+
+#include <memory>
+
 #include "webrtc/base/callback.h"
 #include "webrtc/base/refcount.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/base/scoped_ref_ptr.h"
 #include "webrtc/system_wrappers/include/aligned_malloc.h"
 
@@ -87,7 +90,7 @@
   const int stride_y_;
   const int stride_u_;
   const int stride_v_;
-  const rtc::scoped_ptr<uint8_t, AlignedFreeDeleter> data_;
+  const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_;
 };
 
 // Base class for native-handle buffer is a wrapper around a |native_handle|.
diff --git a/webrtc/common_video/libyuv/libyuv_unittest.cc b/webrtc/common_video/libyuv/libyuv_unittest.cc
index 9fad44f..9f92b8b 100644
--- a/webrtc/common_video/libyuv/libyuv_unittest.cc
+++ b/webrtc/common_video/libyuv/libyuv_unittest.cc
@@ -11,8 +11,9 @@
 #include <math.h>
 #include <string.h>
 
+#include <memory>
+
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/base/scoped_ptr.h"
 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
 #include "webrtc/system_wrappers/include/tick_util.h"
 #include "webrtc/test/testsupport/fileutils.h"
@@ -83,7 +84,7 @@
 
   FILE* source_file_;
   VideoFrame orig_frame_;
-  rtc::scoped_ptr<uint8_t[]> orig_buffer_;
+  std::unique_ptr<uint8_t[]> orig_buffer_;
   const int width_;
   const int height_;
   const int size_y_;
@@ -147,7 +148,7 @@
                                                (width_ + 1) / 2,
                                                (width_ + 1) / 2);
   printf("\nConvert #%d I420 <-> I420 \n", j);
-  rtc::scoped_ptr<uint8_t[]> out_i420_buffer(new uint8_t[frame_length_]);
+  std::unique_ptr<uint8_t[]> out_i420_buffer(new uint8_t[frame_length_]);
   EXPECT_EQ(0, ConvertFromI420(orig_frame_, kI420, 0,
                                out_i420_buffer.get()));
   EXPECT_EQ(0, ConvertToI420(kI420, out_i420_buffer.get(), 0, 0, width_,
@@ -161,7 +162,7 @@
   j++;
 
   printf("\nConvert #%d I420 <-> RGB24\n", j);
-  rtc::scoped_ptr<uint8_t[]> res_rgb_buffer2(new uint8_t[width_ * height_ * 3]);
+  std::unique_ptr<uint8_t[]> res_rgb_buffer2(new uint8_t[width_ * height_ * 3]);
   // Align the stride values for the output frame.
   int stride_y = 0;
   int stride_uv = 0;
@@ -183,7 +184,7 @@
   j++;
 
   printf("\nConvert #%d I420 <-> UYVY\n", j);
-  rtc::scoped_ptr<uint8_t[]> out_uyvy_buffer(new uint8_t[width_ * height_ * 2]);
+  std::unique_ptr<uint8_t[]> out_uyvy_buffer(new uint8_t[width_ * height_ * 2]);
   EXPECT_EQ(0, ConvertFromI420(orig_frame_,  kUYVY, 0, out_uyvy_buffer.get()));
   EXPECT_EQ(0, ConvertToI420(kUYVY, out_uyvy_buffer.get(), 0, 0, width_,
                              height_, 0, kVideoRotation_0, &res_i420_frame));
@@ -195,8 +196,8 @@
   j++;
 
   printf("\nConvert #%d I420 <-> YV12\n", j);
-  rtc::scoped_ptr<uint8_t[]> outYV120Buffer(new uint8_t[frame_length_]);
-  rtc::scoped_ptr<uint8_t[]> res_i420_buffer(new uint8_t[frame_length_]);
+  std::unique_ptr<uint8_t[]> outYV120Buffer(new uint8_t[frame_length_]);
+  std::unique_ptr<uint8_t[]> res_i420_buffer(new uint8_t[frame_length_]);
   VideoFrame yv12_frame;
   EXPECT_EQ(0, ConvertFromI420(orig_frame_, kYV12, 0, outYV120Buffer.get()));
   yv12_frame.CreateFrame(outYV120Buffer.get(),
@@ -218,7 +219,7 @@
   j++;
 
   printf("\nConvert #%d I420 <-> YUY2\n", j);
-  rtc::scoped_ptr<uint8_t[]> out_yuy2_buffer(new uint8_t[width_ * height_ * 2]);
+  std::unique_ptr<uint8_t[]> out_yuy2_buffer(new uint8_t[width_ * height_ * 2]);
   EXPECT_EQ(0, ConvertFromI420(orig_frame_,  kYUY2, 0, out_yuy2_buffer.get()));
 
   EXPECT_EQ(0, ConvertToI420(kYUY2, out_yuy2_buffer.get(), 0, 0, width_,
@@ -231,7 +232,7 @@
   psnr = I420PSNR(&orig_frame_, &res_i420_frame);
   EXPECT_EQ(48.0, psnr);
   printf("\nConvert #%d I420 <-> RGB565\n", j);
-  rtc::scoped_ptr<uint8_t[]> out_rgb565_buffer(
+  std::unique_ptr<uint8_t[]> out_rgb565_buffer(
       new uint8_t[width_ * height_ * 2]);
   EXPECT_EQ(0, ConvertFromI420(orig_frame_, kRGB565, 0,
                                out_rgb565_buffer.get()));
@@ -251,7 +252,7 @@
   EXPECT_GT(ceil(psnr), 40);
 
   printf("\nConvert #%d I420 <-> ARGB8888\n", j);
-  rtc::scoped_ptr<uint8_t[]> out_argb8888_buffer(
+  std::unique_ptr<uint8_t[]> out_argb8888_buffer(
       new uint8_t[width_ * height_ * 4]);
   EXPECT_EQ(0, ConvertFromI420(orig_frame_, kARGB, 0,
                                out_argb8888_buffer.get()));
@@ -285,7 +286,7 @@
   Calc16ByteAlignedStride(width_, &stride_y, &stride_uv);
   res_i420_frame.CreateEmptyFrame(width_, height_,
                                   stride_y, stride_uv, stride_uv);
-  rtc::scoped_ptr<uint8_t[]> out_i420_buffer(new uint8_t[frame_length_]);
+  std::unique_ptr<uint8_t[]> out_i420_buffer(new uint8_t[frame_length_]);
   EXPECT_EQ(0, ConvertFromI420(orig_frame_, kI420, 0,
                                out_i420_buffer.get()));
   EXPECT_EQ(0, ConvertToI420(kI420, out_i420_buffer.get(), 0, 0, width_,
diff --git a/webrtc/common_video/libyuv/scaler_unittest.cc b/webrtc/common_video/libyuv/scaler_unittest.cc
index d70cadf..9ba1b9d 100644
--- a/webrtc/common_video/libyuv/scaler_unittest.cc
+++ b/webrtc/common_video/libyuv/scaler_unittest.cc
@@ -11,6 +11,8 @@
 #include <math.h>
 #include <string.h>
 
+#include <memory>
+
 #include "testing/gtest/include/gtest/gtest.h"
 #include "webrtc/common_video/libyuv/include/scaler.h"
 #include "webrtc/system_wrappers/include/tick_util.h"
@@ -98,7 +100,7 @@
                                 kI420, kI420,
                                 kScalePoint));
   VideoFrame test_frame2;
-  rtc::scoped_ptr<uint8_t[]> orig_buffer(new uint8_t[frame_length_]);
+  std::unique_ptr<uint8_t[]> orig_buffer(new uint8_t[frame_length_]);
   EXPECT_GT(fread(orig_buffer.get(), 1, frame_length_, source_file_), 0U);
   test_frame_.CreateFrame(orig_buffer.get(),
                           orig_buffer.get() + size_y_,
@@ -358,7 +360,7 @@
   total_clock = 0;
   int frame_count = 0;
   size_t src_required_size = CalcBufferSize(kI420, src_width, src_height);
-  rtc::scoped_ptr<uint8_t[]> frame_buffer(new uint8_t[src_required_size]);
+  std::unique_ptr<uint8_t[]> frame_buffer(new uint8_t[src_required_size]);
   int size_y = src_width * src_height;
   int size_uv = ((src_width + 1) / 2) * ((src_height + 1) / 2);
 
diff --git a/webrtc/test/linux/glx_renderer.cc b/webrtc/test/linux/glx_renderer.cc
index 450c6bd..c5071de 100644
--- a/webrtc/test/linux/glx_renderer.cc
+++ b/webrtc/test/linux/glx_renderer.cc
@@ -11,6 +11,7 @@
 #include "webrtc/test/linux/glx_renderer.h"
 
 #include <assert.h>
+#include <stdlib.h>
 
 #include <X11/Xatom.h>
 #include <X11/Xlib.h>
diff --git a/webrtc/test/testsupport/metrics/video_metrics.cc b/webrtc/test/testsupport/metrics/video_metrics.cc
index 947b81d..ee9aa34 100644
--- a/webrtc/test/testsupport/metrics/video_metrics.cc
+++ b/webrtc/test/testsupport/metrics/video_metrics.cc
@@ -14,6 +14,7 @@
 #include <stdio.h>
 
 #include <algorithm>  // min_element, max_element
+#include <memory>
 
 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
 #include "webrtc/video_frame.h"
@@ -111,8 +112,8 @@
   const size_t frame_length = 3 * width * height >> 1;
   VideoFrame ref_frame;
   VideoFrame test_frame;
-  rtc::scoped_ptr<uint8_t[]> ref_buffer(new uint8_t[frame_length]);
-  rtc::scoped_ptr<uint8_t[]> test_buffer(new uint8_t[frame_length]);
+  std::unique_ptr<uint8_t[]> ref_buffer(new uint8_t[frame_length]);
+  std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[frame_length]);
 
   // Set decoded image parameters.
   int half_width = (width + 1) / 2;
diff --git a/webrtc/video_decoder.h b/webrtc/video_decoder.h
index e99183f..4f25e1f 100644
--- a/webrtc/video_decoder.h
+++ b/webrtc/video_decoder.h
@@ -11,6 +11,7 @@
 #ifndef WEBRTC_VIDEO_DECODER_H_
 #define WEBRTC_VIDEO_DECODER_H_
 
+#include <memory>
 #include <string>
 #include <vector>
 
@@ -116,7 +117,7 @@
   VideoCodec codec_settings_;
   int32_t number_of_cores_;
   std::string fallback_implementation_name_;
-  rtc::scoped_ptr<VideoDecoder> fallback_decoder_;
+  std::unique_ptr<VideoDecoder> fallback_decoder_;
   DecodedImageCallback* callback_;
 };
 
diff --git a/webrtc/video_encoder.h b/webrtc/video_encoder.h
index 9e7e4d7..89a6464 100644
--- a/webrtc/video_encoder.h
+++ b/webrtc/video_encoder.h
@@ -11,6 +11,7 @@
 #ifndef WEBRTC_VIDEO_ENCODER_H_
 #define WEBRTC_VIDEO_ENCODER_H_
 
+#include <memory>
 #include <string>
 #include <vector>
 
@@ -177,7 +178,7 @@
   const EncoderType encoder_type_;
   webrtc::VideoEncoder* const encoder_;
 
-  rtc::scoped_ptr<webrtc::VideoEncoder> fallback_encoder_;
+  std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_;
   std::string fallback_implementation_name_;
   EncodedImageCallback* callback_;
 };