Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: remoting/codec/video_encoder_vpx_unittest.cc

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/codec/video_encoder_vpx.cc ('k') | remoting/host/audio_capturer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/codec/video_encoder_vpx_unittest.cc
diff --git a/remoting/codec/video_encoder_vpx_unittest.cc b/remoting/codec/video_encoder_vpx_unittest.cc
index 61c74d1fce826ab23cb99b711b64b8dc0809c411..3ef6054bfbbdfbaff4e93875d85b7c81fec06864 100644
--- a/remoting/codec/video_encoder_vpx_unittest.cc
+++ b/remoting/codec/video_encoder_vpx_unittest.cc
@@ -7,9 +7,9 @@
#include <stdint.h>
#include <limits>
+#include <memory>
#include <vector>
-#include "base/memory/scoped_ptr.h"
#include "remoting/codec/codec_test.h"
#include "remoting/proto/video.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -24,9 +24,9 @@ const uint32_t kGreenColor = 0x00ff00;
// Creates a frame stippled between blue and red pixels, which is useful for
// lossy/lossless encode and color tests. By default all pixels in the frame
// are included in the updated_region().
-static scoped_ptr<webrtc::DesktopFrame> CreateTestFrame(
+static std::unique_ptr<webrtc::DesktopFrame> CreateTestFrame(
const webrtc::DesktopSize& frame_size) {
- scoped_ptr<webrtc::DesktopFrame> frame(
+ std::unique_ptr<webrtc::DesktopFrame> frame(
new webrtc::BasicDesktopFrame(frame_size));
for (int x = 0; x < frame_size.width(); ++x) {
for (int y = 0; y < frame_size.height(); ++y) {
@@ -42,30 +42,30 @@ static scoped_ptr<webrtc::DesktopFrame> CreateTestFrame(
}
TEST(VideoEncoderVpxTest, Vp8) {
- scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
+ std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
TestVideoEncoder(encoder.get(), false);
}
TEST(VideoEncoderVpxTest, Vp9) {
- scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
+ std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
// VP9 encoder defaults to lossless encode and lossy (I420) color.
TestVideoEncoder(encoder.get(), false);
}
// Test that the VP9 encoder can switch between lossy & lossless encode.
TEST(VideoEncoderVpxTest, Vp9LossyEncodeSwitching) {
- scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
+ std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
webrtc::DesktopSize frame_size(100, 100);
- scoped_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
+ std::unique_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
// Lossy encode the first frame.
encoder->SetLosslessEncode(false);
- scoped_ptr<VideoPacket> lossy_packet = encoder->Encode(*frame);
+ std::unique_ptr<VideoPacket> lossy_packet = encoder->Encode(*frame);
// Lossless encode the second frame.
encoder->SetLosslessEncode(true);
- scoped_ptr<VideoPacket> lossless_packet = encoder->Encode(*frame);
+ std::unique_ptr<VideoPacket> lossless_packet = encoder->Encode(*frame);
// Lossless encode is so good that the frames are smaller than the lossy
// encodes. This comparison needs to be revisited.
// http://crbug.com/439166
@@ -80,18 +80,18 @@ TEST(VideoEncoderVpxTest, Vp9LossyEncodeSwitching) {
// Test that the VP9 encoder can switch between lossy & lossless color.
TEST(VideoEncoderVpxTest, Vp9LossyColorSwitching) {
- scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
+ std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
webrtc::DesktopSize frame_size(100, 100);
- scoped_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
+ std::unique_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
// Lossy encode the first frame.
encoder->SetLosslessColor(false);
- scoped_ptr<VideoPacket> lossy_packet = encoder->Encode(*frame);
+ std::unique_ptr<VideoPacket> lossy_packet = encoder->Encode(*frame);
// Lossless encode the second frame.
encoder->SetLosslessColor(true);
- scoped_ptr<VideoPacket> lossless_packet = encoder->Encode(*frame);
+ std::unique_ptr<VideoPacket> lossless_packet = encoder->Encode(*frame);
// Lossy encode one more frame.
encoder->SetLosslessColor(false);
@@ -100,15 +100,15 @@ TEST(VideoEncoderVpxTest, Vp9LossyColorSwitching) {
// Test that the VP8 encoder ignores lossless modes without crashing.
TEST(VideoEncoderVpxTest, Vp8IgnoreLossy) {
- scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
+ std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
webrtc::DesktopSize frame_size(100, 100);
- scoped_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
+ std::unique_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
// Encode a frame, to give the encoder a chance to crash if misconfigured.
encoder->SetLosslessEncode(true);
encoder->SetLosslessColor(true);
- scoped_ptr<VideoPacket> packet = encoder->Encode(*frame);
+ std::unique_ptr<VideoPacket> packet = encoder->Encode(*frame);
EXPECT_TRUE(packet);
}
@@ -117,11 +117,11 @@ TEST(VideoEncoderVpxTest, Vp8IgnoreLossy) {
TEST(VideoEncoderVpxTest, Vp8SizeChangeNoCrash) {
webrtc::DesktopSize frame_size(100, 100);
- scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
+ std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
// Create first frame & encode it.
- scoped_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
- scoped_ptr<VideoPacket> packet = encoder->Encode(*frame);
+ std::unique_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
+ std::unique_ptr<VideoPacket> packet = encoder->Encode(*frame);
EXPECT_TRUE(packet);
// Double the size of the frame, and updated region, and encode again.
@@ -136,11 +136,11 @@ TEST(VideoEncoderVpxTest, Vp8SizeChangeNoCrash) {
TEST(VideoEncoderVpxTest, Vp9SizeChangeNoCrash) {
webrtc::DesktopSize frame_size(100, 100);
- scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
+ std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
// Create first frame & encode it.
- scoped_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
- scoped_ptr<VideoPacket> packet = encoder->Encode(*frame);
+ std::unique_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
+ std::unique_ptr<VideoPacket> packet = encoder->Encode(*frame);
EXPECT_TRUE(packet);
// Double the size of the frame, and updated region, and encode again.
@@ -155,28 +155,28 @@ TEST(VideoEncoderVpxTest, Vp9SizeChangeNoCrash) {
TEST(VideoEncoderVpxTest, DpiPropagation) {
webrtc::DesktopSize frame_size(32, 32);
- scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
+ std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
- scoped_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
+ std::unique_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
frame->set_dpi(webrtc::DesktopVector(96, 97));
- scoped_ptr<VideoPacket> packet = encoder->Encode(*frame);
+ std::unique_ptr<VideoPacket> packet = encoder->Encode(*frame);
EXPECT_EQ(packet->format().x_dpi(), 96);
EXPECT_EQ(packet->format().y_dpi(), 97);
}
TEST(VideoEncoderVpxTest, Vp8EncodeUnchangedFrame) {
- scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
+ std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
TestVideoEncoderEmptyFrames(encoder.get(), 0);
}
TEST(VideoEncoderVpxTest, Vp9LosslessUnchangedFrame) {
- scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
+ std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
encoder->SetLosslessEncode(true);
TestVideoEncoderEmptyFrames(encoder.get(), 0);
}
TEST(VideoEncoderVpxTest, Vp9LossyUnchangedFrame) {
- scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
+ std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
encoder->SetLosslessEncode(false);
// Expect that VP9+CR should generate no more than 10 top-off frames
// per cycle, and take no more than 2 cycles to top-off.
« no previous file with comments | « remoting/codec/video_encoder_vpx.cc ('k') | remoting/host/audio_capturer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698