OLD | NEW |
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // Verify the new frame. | 68 // Verify the new frame. |
69 EXPECT_EQ(5678, frame.GetTimeStamp()); | 69 EXPECT_EQ(5678, frame.GetTimeStamp()); |
70 if (apply_rotation) | 70 if (apply_rotation) |
71 EXPECT_EQ(webrtc::kVideoRotation_0, frame.GetVideoRotation()); | 71 EXPECT_EQ(webrtc::kVideoRotation_0, frame.GetVideoRotation()); |
72 else | 72 else |
73 EXPECT_EQ(frame_rotation, frame.GetVideoRotation()); | 73 EXPECT_EQ(frame_rotation, frame.GetVideoRotation()); |
74 // If |apply_rotation| and the frame rotation is 90 or 270, width and | 74 // If |apply_rotation| and the frame rotation is 90 or 270, width and |
75 // height are flipped. | 75 // height are flipped. |
76 if (apply_rotation && (frame_rotation == webrtc::kVideoRotation_90 | 76 if (apply_rotation && (frame_rotation == webrtc::kVideoRotation_90 |
77 || frame_rotation == webrtc::kVideoRotation_270)) { | 77 || frame_rotation == webrtc::kVideoRotation_270)) { |
78 EXPECT_EQ(static_cast<size_t>(cropped_width), frame.GetHeight()); | 78 EXPECT_EQ(cropped_width, frame.height()); |
79 EXPECT_EQ(static_cast<size_t>(cropped_height), frame.GetWidth()); | 79 EXPECT_EQ(cropped_height, frame.width()); |
80 } else { | 80 } else { |
81 EXPECT_EQ(static_cast<size_t>(cropped_width), frame.GetWidth()); | 81 EXPECT_EQ(cropped_width, frame.width()); |
82 EXPECT_EQ(static_cast<size_t>(cropped_height), frame.GetHeight()); | 82 EXPECT_EQ(cropped_height, frame.height()); |
83 } | 83 } |
84 } | 84 } |
85 }; | 85 }; |
86 | 86 |
87 #define TEST_WEBRTCVIDEOFRAME(X) TEST_F(WebRtcVideoFrameTest, X) { \ | 87 #define TEST_WEBRTCVIDEOFRAME(X) TEST_F(WebRtcVideoFrameTest, X) { \ |
88 VideoFrameTest<cricket::WebRtcVideoFrame>::X(); \ | 88 VideoFrameTest<cricket::WebRtcVideoFrame>::X(); \ |
89 } | 89 } |
90 | 90 |
91 TEST_WEBRTCVIDEOFRAME(ConstructI420) | 91 TEST_WEBRTCVIDEOFRAME(ConstructI420) |
92 TEST_WEBRTCVIDEOFRAME(ConstructI422) | 92 TEST_WEBRTCVIDEOFRAME(ConstructI422) |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } | 270 } |
271 | 271 |
272 TEST_F(WebRtcVideoFrameTest, TextureInitialValues) { | 272 TEST_F(WebRtcVideoFrameTest, TextureInitialValues) { |
273 webrtc::test::FakeNativeHandle* dummy_handle = | 273 webrtc::test::FakeNativeHandle* dummy_handle = |
274 new webrtc::test::FakeNativeHandle(); | 274 new webrtc::test::FakeNativeHandle(); |
275 webrtc::NativeHandleBuffer* buffer = | 275 webrtc::NativeHandleBuffer* buffer = |
276 new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>( | 276 new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>( |
277 dummy_handle, 640, 480); | 277 dummy_handle, 640, 480); |
278 cricket::WebRtcVideoFrame frame(buffer, 200, webrtc::kVideoRotation_0); | 278 cricket::WebRtcVideoFrame frame(buffer, 200, webrtc::kVideoRotation_0); |
279 EXPECT_EQ(dummy_handle, frame.GetNativeHandle()); | 279 EXPECT_EQ(dummy_handle, frame.GetNativeHandle()); |
280 EXPECT_EQ(640u, frame.GetWidth()); | 280 EXPECT_EQ(640, frame.width()); |
281 EXPECT_EQ(480u, frame.GetHeight()); | 281 EXPECT_EQ(480, frame.height()); |
282 EXPECT_EQ(200, frame.GetTimeStamp()); | 282 EXPECT_EQ(200, frame.GetTimeStamp()); |
283 frame.SetTimeStamp(400); | 283 frame.SetTimeStamp(400); |
284 EXPECT_EQ(400, frame.GetTimeStamp()); | 284 EXPECT_EQ(400, frame.GetTimeStamp()); |
285 } | 285 } |
286 | 286 |
287 TEST_F(WebRtcVideoFrameTest, CopyTextureFrame) { | 287 TEST_F(WebRtcVideoFrameTest, CopyTextureFrame) { |
288 webrtc::test::FakeNativeHandle* dummy_handle = | 288 webrtc::test::FakeNativeHandle* dummy_handle = |
289 new webrtc::test::FakeNativeHandle(); | 289 new webrtc::test::FakeNativeHandle(); |
290 webrtc::NativeHandleBuffer* buffer = | 290 webrtc::NativeHandleBuffer* buffer = |
291 new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>( | 291 new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>( |
292 dummy_handle, 640, 480); | 292 dummy_handle, 640, 480); |
293 cricket::WebRtcVideoFrame frame1(buffer, 200, webrtc::kVideoRotation_0); | 293 cricket::WebRtcVideoFrame frame1(buffer, 200, webrtc::kVideoRotation_0); |
294 cricket::VideoFrame* frame2 = frame1.Copy(); | 294 cricket::VideoFrame* frame2 = frame1.Copy(); |
295 EXPECT_EQ(frame1.GetNativeHandle(), frame2->GetNativeHandle()); | 295 EXPECT_EQ(frame1.GetNativeHandle(), frame2->GetNativeHandle()); |
296 EXPECT_EQ(frame1.GetWidth(), frame2->GetWidth()); | 296 EXPECT_EQ(frame1.width(), frame2->width()); |
297 EXPECT_EQ(frame1.GetHeight(), frame2->GetHeight()); | 297 EXPECT_EQ(frame1.height(), frame2->height()); |
298 EXPECT_EQ(frame1.GetTimeStamp(), frame2->GetTimeStamp()); | 298 EXPECT_EQ(frame1.GetTimeStamp(), frame2->GetTimeStamp()); |
299 delete frame2; | 299 delete frame2; |
300 } | 300 } |
301 | 301 |
302 TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) { | 302 TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) { |
303 WebRtcVideoTestFrame applied0; | 303 WebRtcVideoTestFrame applied0; |
304 EXPECT_TRUE(IsNull(applied0)); | 304 EXPECT_TRUE(IsNull(applied0)); |
305 std::unique_ptr<rtc::MemoryStream> ms(CreateYuvSample(kWidth, kHeight, 12)); | 305 std::unique_ptr<rtc::MemoryStream> ms(CreateYuvSample(kWidth, kHeight, 12)); |
306 EXPECT_TRUE( | 306 EXPECT_TRUE( |
307 LoadFrame(ms.get(), cricket::FOURCC_I420, kWidth, kHeight, &applied0)); | 307 LoadFrame(ms.get(), cricket::FOURCC_I420, kWidth, kHeight, &applied0)); |
(...skipping 11 matching lines...) Expand all Loading... |
319 | 319 |
320 // Claim the frame 2 needs to be rotated for another 270 degree. The output | 320 // Claim the frame 2 needs to be rotated for another 270 degree. The output |
321 // from frame 2 rotation should be the same as frame 1. | 321 // from frame 2 rotation should be the same as frame 1. |
322 applied90->SetRotation(webrtc::kVideoRotation_270); | 322 applied90->SetRotation(webrtc::kVideoRotation_270); |
323 const cricket::VideoFrame* applied360 = | 323 const cricket::VideoFrame* applied360 = |
324 applied90->GetCopyWithRotationApplied(); | 324 applied90->GetCopyWithRotationApplied(); |
325 EXPECT_TRUE(applied360); | 325 EXPECT_TRUE(applied360); |
326 EXPECT_EQ(applied360->GetVideoRotation(), webrtc::kVideoRotation_0); | 326 EXPECT_EQ(applied360->GetVideoRotation(), webrtc::kVideoRotation_0); |
327 EXPECT_TRUE(IsEqual(applied0, *applied360, 0)); | 327 EXPECT_TRUE(IsEqual(applied0, *applied360, 0)); |
328 } | 328 } |
OLD | NEW |