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

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

Issue 2029273004: New static method I420Buffer::SetToBlack. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add missing SetToBlack call. Created 4 years, 6 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/webrtcvideoframe.cc ('k') | no next file » | 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) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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> 13 #include <memory>
14 14
15 #include "webrtc/media/base/videoframe_unittest.h" 15 #include "webrtc/media/base/videoframe_unittest.h"
16 #include "webrtc/media/engine/webrtcvideoframe.h" 16 #include "webrtc/media/engine/webrtcvideoframe.h"
17 #include "webrtc/test/fake_texture_frame.h" 17 #include "webrtc/test/fake_texture_frame.h"
18 18
19 namespace { 19 namespace {
20 20
21 class WebRtcVideoTestFrame : public cricket::WebRtcVideoFrame { 21 class WebRtcVideoTestFrame : public cricket::WebRtcVideoFrame {
22 public: 22 public:
23 WebRtcVideoTestFrame() {}
24 WebRtcVideoTestFrame(
25 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer,
26 int64_t time_stamp_ns,
27 webrtc::VideoRotation rotation)
28 : WebRtcVideoFrame(buffer, time_stamp_ns, rotation) {}
29
23 // The ApplyRotationToFrame test needs this as a public method. 30 // The ApplyRotationToFrame test needs this as a public method.
24 using cricket::WebRtcVideoFrame::set_rotation; 31 using cricket::WebRtcVideoFrame::set_rotation;
25 32
26 virtual VideoFrame* CreateEmptyFrame(int w, 33 virtual VideoFrame* CreateEmptyFrame(int w,
27 int h, 34 int h,
28 int64_t time_stamp) const override { 35 int64_t time_stamp) const override {
29 WebRtcVideoTestFrame* frame = new WebRtcVideoTestFrame(); 36 rtc::scoped_refptr<webrtc::I420Buffer> buffer(
30 frame->InitToBlack(w, h, time_stamp); 37 new rtc::RefCountedObject<webrtc::I420Buffer>(w, h));
31 return frame; 38 buffer->SetToBlack();
39 return new WebRtcVideoTestFrame(
40 buffer, time_stamp, webrtc::kVideoRotation_0);
32 } 41 }
33 }; 42 };
34 43
35 } // namespace 44 } // namespace
36 45
37 class WebRtcVideoFrameTest : public VideoFrameTest<cricket::WebRtcVideoFrame> { 46 class WebRtcVideoFrameTest : public VideoFrameTest<cricket::WebRtcVideoFrame> {
38 public: 47 public:
39 WebRtcVideoFrameTest() { 48 WebRtcVideoFrameTest() {
40 } 49 }
41 50
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 TEST_WEBRTCVIDEOFRAME(ConstructI4201Pixel) 147 TEST_WEBRTCVIDEOFRAME(ConstructI4201Pixel)
139 TEST_WEBRTCVIDEOFRAME(ConstructI4205Pixel) 148 TEST_WEBRTCVIDEOFRAME(ConstructI4205Pixel)
140 // TODO(juberti): WebRtcVideoFrame does not support horizontal crop. 149 // TODO(juberti): WebRtcVideoFrame does not support horizontal crop.
141 // Re-evaluate once it supports 3 independent planes, since we might want to 150 // Re-evaluate once it supports 3 independent planes, since we might want to
142 // just Init normally and then crop by adjusting pointers. 151 // just Init normally and then crop by adjusting pointers.
143 // TEST_WEBRTCVIDEOFRAME(ConstructI420CropHorizontal) 152 // TEST_WEBRTCVIDEOFRAME(ConstructI420CropHorizontal)
144 TEST_WEBRTCVIDEOFRAME(ConstructI420CropVertical) 153 TEST_WEBRTCVIDEOFRAME(ConstructI420CropVertical)
145 // TODO(juberti): WebRtcVideoFrame is not currently refcounted. 154 // TODO(juberti): WebRtcVideoFrame is not currently refcounted.
146 // TEST_WEBRTCVIDEOFRAME(ConstructCopy) 155 // TEST_WEBRTCVIDEOFRAME(ConstructCopy)
147 // TEST_WEBRTCVIDEOFRAME(ConstructCopyIsRef) 156 // TEST_WEBRTCVIDEOFRAME(ConstructCopyIsRef)
148 TEST_WEBRTCVIDEOFRAME(ConstructBlack)
149 // TODO(fbarchard): Implement Jpeg 157 // TODO(fbarchard): Implement Jpeg
150 // TEST_WEBRTCVIDEOFRAME(ConstructMjpgI420) 158 // TEST_WEBRTCVIDEOFRAME(ConstructMjpgI420)
151 TEST_WEBRTCVIDEOFRAME(ConstructMjpgI422) 159 TEST_WEBRTCVIDEOFRAME(ConstructMjpgI422)
152 // TEST_WEBRTCVIDEOFRAME(ConstructMjpgI444) 160 // TEST_WEBRTCVIDEOFRAME(ConstructMjpgI444)
153 // TEST_WEBRTCVIDEOFRAME(ConstructMjpgI411) 161 // TEST_WEBRTCVIDEOFRAME(ConstructMjpgI411)
154 // TEST_WEBRTCVIDEOFRAME(ConstructMjpgI400) 162 // TEST_WEBRTCVIDEOFRAME(ConstructMjpgI400)
155 // TEST_WEBRTCVIDEOFRAME(ValidateMjpgI420) 163 // TEST_WEBRTCVIDEOFRAME(ValidateMjpgI420)
156 // TEST_WEBRTCVIDEOFRAME(ValidateMjpgI422) 164 // TEST_WEBRTCVIDEOFRAME(ValidateMjpgI422)
157 // TEST_WEBRTCVIDEOFRAME(ValidateMjpgI444) 165 // TEST_WEBRTCVIDEOFRAME(ValidateMjpgI444)
158 // TEST_WEBRTCVIDEOFRAME(ValidateMjpgI411) 166 // TEST_WEBRTCVIDEOFRAME(ValidateMjpgI411)
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 331
324 // Claim the frame 2 needs to be rotated for another 270 degree. The output 332 // Claim the frame 2 needs to be rotated for another 270 degree. The output
325 // from frame 2 rotation should be the same as frame 1. 333 // from frame 2 rotation should be the same as frame 1.
326 applied90->set_rotation(webrtc::kVideoRotation_270); 334 applied90->set_rotation(webrtc::kVideoRotation_270);
327 const cricket::VideoFrame* applied360 = 335 const cricket::VideoFrame* applied360 =
328 applied90->GetCopyWithRotationApplied(); 336 applied90->GetCopyWithRotationApplied();
329 EXPECT_TRUE(applied360); 337 EXPECT_TRUE(applied360);
330 EXPECT_EQ(applied360->rotation(), webrtc::kVideoRotation_0); 338 EXPECT_EQ(applied360->rotation(), webrtc::kVideoRotation_0);
331 EXPECT_TRUE(IsEqual(applied0, *applied360, 0)); 339 EXPECT_TRUE(IsEqual(applied0, *applied360, 0));
332 } 340 }
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoframe.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698