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

Unified Diff: webrtc/media/engine/webrtcvideoframe_unittest.cc

Issue 2285693002: New static I420Buffer::Rotate method, to replace GetCopyWithRotationApplied. (Closed)
Patch Set: Created 4 years, 4 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
Index: webrtc/media/engine/webrtcvideoframe_unittest.cc
diff --git a/webrtc/media/engine/webrtcvideoframe_unittest.cc b/webrtc/media/engine/webrtcvideoframe_unittest.cc
index fb7be22c537cb55c4f4d0907f0e5670c784721be..b0c7f55f8300f77c5713f7cc07d1a09525842bdb 100644
--- a/webrtc/media/engine/webrtcvideoframe_unittest.cc
+++ b/webrtc/media/engine/webrtcvideoframe_unittest.cc
@@ -296,22 +296,28 @@ TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) {
// Claim that this frame needs to be rotated for 90 degree.
SetFrameRotation(&applied0, webrtc::kVideoRotation_90);
+ EXPECT_EQ(applied0.rotation(), webrtc::kVideoRotation_90);
// Apply rotation on frame 1. Output should be different from frame 1.
- WebRtcVideoFrame* applied90 =
- const_cast<WebRtcVideoFrame*>(static_cast<const WebRtcVideoFrame*>(
- applied0.GetCopyWithRotationApplied()));
- EXPECT_TRUE(applied90);
- EXPECT_EQ(applied90->rotation(), webrtc::kVideoRotation_0);
- EXPECT_FALSE(IsEqual(applied0, *applied90, 0));
+ WebRtcVideoFrame applied90(
+ webrtc::VideoFrameBuffer::Rotate(applied0.video_frame_buffer(),
+ applied0.rotation()),
+ webrtc::kVideoRotation_0,
+ applied0.timestamp_us());
+
+ EXPECT_EQ(applied90.rotation(), webrtc::kVideoRotation_0);
+ EXPECT_FALSE(IsEqual(applied0, applied90, 0));
// Claim the frame 2 needs to be rotated for another 270 degree. The output
// from frame 2 rotation should be the same as frame 1.
- SetFrameRotation(applied90, webrtc::kVideoRotation_270);
- const VideoFrame* applied360 = applied90->GetCopyWithRotationApplied();
- EXPECT_TRUE(applied360);
- EXPECT_EQ(applied360->rotation(), webrtc::kVideoRotation_0);
- EXPECT_TRUE(IsEqual(applied0, *applied360, 0));
+ SetFrameRotation(&applied90, webrtc::kVideoRotation_270);
+ WebRtcVideoFrame applied360(
+ webrtc::VideoFrameBuffer::Rotate(applied90.video_frame_buffer(),
+ applied90.rotation()),
+ webrtc::kVideoRotation_0,
+ applied90.timestamp_us());
+ EXPECT_EQ(applied360.rotation(), webrtc::kVideoRotation_0);
+ EXPECT_TRUE(IsEqual(applied0, applied360, 0));
}
} // namespace cricket
« 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