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

Side by Side Diff: webrtc/media/engine/webrtcvideoframefactory_unittest.cc

Issue 1728503002: Replace scoped_ptr with unique_ptr in webrtc/media/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@up1
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « webrtc/media/engine/webrtcvideoframefactory.cc ('k') | webrtc/media/engine/webrtcvoe.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <string.h> 11 #include <string.h>
12 12
13 #include <memory>
14
13 #include "webrtc/media/base/videoframe_unittest.h" 15 #include "webrtc/media/base/videoframe_unittest.h"
14 #include "webrtc/media/engine/webrtcvideoframe.h" 16 #include "webrtc/media/engine/webrtcvideoframe.h"
15 #include "webrtc/media/engine/webrtcvideoframefactory.h" 17 #include "webrtc/media/engine/webrtcvideoframefactory.h"
16 18
17 class WebRtcVideoFrameFactoryTest 19 class WebRtcVideoFrameFactoryTest
18 : public VideoFrameTest<cricket::WebRtcVideoFrameFactory> { 20 : public VideoFrameTest<cricket::WebRtcVideoFrameFactory> {
19 public: 21 public:
20 WebRtcVideoFrameFactoryTest() {} 22 WebRtcVideoFrameFactoryTest() {}
21 23
22 void InitFrame(webrtc::VideoRotation frame_rotation) { 24 void InitFrame(webrtc::VideoRotation frame_rotation) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 63 }
62 } 64 }
63 } 65 }
64 66
65 void TestCreateAliasedFrame(bool apply_rotation) { 67 void TestCreateAliasedFrame(bool apply_rotation) {
66 cricket::VideoFrameFactory& factory = factory_; 68 cricket::VideoFrameFactory& factory = factory_;
67 factory.SetApplyRotation(apply_rotation); 69 factory.SetApplyRotation(apply_rotation);
68 InitFrame(webrtc::kVideoRotation_270); 70 InitFrame(webrtc::kVideoRotation_270);
69 const cricket::CapturedFrame& captured_frame = get_captured_frame(); 71 const cricket::CapturedFrame& captured_frame = get_captured_frame();
70 // Create the new frame from the CapturedFrame. 72 // Create the new frame from the CapturedFrame.
71 rtc::scoped_ptr<cricket::VideoFrame> frame; 73 std::unique_ptr<cricket::VideoFrame> frame;
72 int new_width = captured_frame.width / 2; 74 int new_width = captured_frame.width / 2;
73 int new_height = captured_frame.height / 2; 75 int new_height = captured_frame.height / 2;
74 frame.reset(factory.CreateAliasedFrame(&captured_frame, new_width, 76 frame.reset(factory.CreateAliasedFrame(&captured_frame, new_width,
75 new_height, new_width, new_height)); 77 new_height, new_width, new_height));
76 VerifyFrame(frame.get(), webrtc::kVideoRotation_270, new_width, new_height, 78 VerifyFrame(frame.get(), webrtc::kVideoRotation_270, new_width, new_height,
77 apply_rotation); 79 apply_rotation);
78 80
79 frame.reset(factory.CreateAliasedFrame( 81 frame.reset(factory.CreateAliasedFrame(
80 &captured_frame, new_width, new_height, new_width / 2, new_height / 2)); 82 &captured_frame, new_width, new_height, new_width / 2, new_height / 2));
81 VerifyFrame(frame.get(), webrtc::kVideoRotation_270, new_width / 2, 83 VerifyFrame(frame.get(), webrtc::kVideoRotation_270, new_width / 2,
82 new_height / 2, apply_rotation); 84 new_height / 2, apply_rotation);
83 85
84 // Reset the frame first so it's exclusive hence we could go through the 86 // Reset the frame first so it's exclusive hence we could go through the
85 // StretchToFrame code path in CreateAliasedFrame. 87 // StretchToFrame code path in CreateAliasedFrame.
86 frame.reset(); 88 frame.reset();
87 frame.reset(factory.CreateAliasedFrame( 89 frame.reset(factory.CreateAliasedFrame(
88 &captured_frame, new_width, new_height, new_width / 2, new_height / 2)); 90 &captured_frame, new_width, new_height, new_width / 2, new_height / 2));
89 VerifyFrame(frame.get(), webrtc::kVideoRotation_270, new_width / 2, 91 VerifyFrame(frame.get(), webrtc::kVideoRotation_270, new_width / 2,
90 new_height / 2, apply_rotation); 92 new_height / 2, apply_rotation);
91 } 93 }
92 94
93 const cricket::CapturedFrame& get_captured_frame() { return captured_frame_; } 95 const cricket::CapturedFrame& get_captured_frame() { return captured_frame_; }
94 96
95 private: 97 private:
96 cricket::CapturedFrame captured_frame_; 98 cricket::CapturedFrame captured_frame_;
97 rtc::scoped_ptr<uint8_t[]> captured_frame_buffer_; 99 std::unique_ptr<uint8_t[]> captured_frame_buffer_;
98 cricket::WebRtcVideoFrameFactory factory_; 100 cricket::WebRtcVideoFrameFactory factory_;
99 }; 101 };
100 102
101 TEST_F(WebRtcVideoFrameFactoryTest, NoApplyRotation) { 103 TEST_F(WebRtcVideoFrameFactoryTest, NoApplyRotation) {
102 TestCreateAliasedFrame(false); 104 TestCreateAliasedFrame(false);
103 } 105 }
104 106
105 TEST_F(WebRtcVideoFrameFactoryTest, ApplyRotation) { 107 TEST_F(WebRtcVideoFrameFactoryTest, ApplyRotation) {
106 TestCreateAliasedFrame(true); 108 TestCreateAliasedFrame(true);
107 } 109 }
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoframefactory.cc ('k') | webrtc/media/engine/webrtcvoe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698