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

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

Issue 2285693002: New static I420Buffer::Rotate method, to replace GetCopyWithRotationApplied. (Closed)
Patch Set: Created 4 years, 3 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
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
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 289 }
290 290
291 TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) { 291 TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) {
292 WebRtcVideoFrame applied0; 292 WebRtcVideoFrame applied0;
293 EXPECT_TRUE(IsNull(applied0)); 293 EXPECT_TRUE(IsNull(applied0));
294 EXPECT_TRUE(LoadFrame(CreateYuvSample(kWidth, kHeight, 12).get(), FOURCC_I420, 294 EXPECT_TRUE(LoadFrame(CreateYuvSample(kWidth, kHeight, 12).get(), FOURCC_I420,
295 kWidth, kHeight, &applied0)); 295 kWidth, kHeight, &applied0));
296 296
297 // Claim that this frame needs to be rotated for 90 degree. 297 // Claim that this frame needs to be rotated for 90 degree.
298 SetFrameRotation(&applied0, webrtc::kVideoRotation_90); 298 SetFrameRotation(&applied0, webrtc::kVideoRotation_90);
299 EXPECT_EQ(applied0.rotation(), webrtc::kVideoRotation_90);
299 300
300 // Apply rotation on frame 1. Output should be different from frame 1. 301 // Apply rotation on frame 1. Output should be different from frame 1.
301 WebRtcVideoFrame* applied90 = 302 WebRtcVideoFrame applied90(
302 const_cast<WebRtcVideoFrame*>(static_cast<const WebRtcVideoFrame*>( 303 webrtc::VideoFrameBuffer::Rotate(applied0.video_frame_buffer(),
303 applied0.GetCopyWithRotationApplied())); 304 applied0.rotation()),
304 EXPECT_TRUE(applied90); 305 webrtc::kVideoRotation_0,
305 EXPECT_EQ(applied90->rotation(), webrtc::kVideoRotation_0); 306 applied0.timestamp_us());
306 EXPECT_FALSE(IsEqual(applied0, *applied90, 0)); 307
308 EXPECT_EQ(applied90.rotation(), webrtc::kVideoRotation_0);
309 EXPECT_FALSE(IsEqual(applied0, applied90, 0));
307 310
308 // Claim the frame 2 needs to be rotated for another 270 degree. The output 311 // Claim the frame 2 needs to be rotated for another 270 degree. The output
309 // from frame 2 rotation should be the same as frame 1. 312 // from frame 2 rotation should be the same as frame 1.
310 SetFrameRotation(applied90, webrtc::kVideoRotation_270); 313 SetFrameRotation(&applied90, webrtc::kVideoRotation_270);
311 const VideoFrame* applied360 = applied90->GetCopyWithRotationApplied(); 314 WebRtcVideoFrame applied360(
312 EXPECT_TRUE(applied360); 315 webrtc::VideoFrameBuffer::Rotate(applied90.video_frame_buffer(),
313 EXPECT_EQ(applied360->rotation(), webrtc::kVideoRotation_0); 316 applied90.rotation()),
314 EXPECT_TRUE(IsEqual(applied0, *applied360, 0)); 317 webrtc::kVideoRotation_0,
318 applied90.timestamp_us());
319 EXPECT_EQ(applied360.rotation(), webrtc::kVideoRotation_0);
320 EXPECT_TRUE(IsEqual(applied0, applied360, 0));
315 } 321 }
316 322
317 } // namespace cricket 323 } // namespace cricket
OLDNEW
« webrtc/media/devices/carbonvideorenderer.cc ('K') | « webrtc/media/devices/gtkvideorenderer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698