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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 268 } |
269 | 269 |
270 TEST_F(WebRtcVideoFrameTest, TextureInitialValues) { | 270 TEST_F(WebRtcVideoFrameTest, TextureInitialValues) { |
271 webrtc::test::FakeNativeHandle* dummy_handle = | 271 webrtc::test::FakeNativeHandle* dummy_handle = |
272 new webrtc::test::FakeNativeHandle(); | 272 new webrtc::test::FakeNativeHandle(); |
273 webrtc::NativeHandleBuffer* buffer = | 273 webrtc::NativeHandleBuffer* buffer = |
274 new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>( | 274 new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>( |
275 dummy_handle, 640, 480); | 275 dummy_handle, 640, 480); |
276 // Timestamp is converted from ns to us, so last three digits are lost. | 276 // Timestamp is converted from ns to us, so last three digits are lost. |
277 cricket::WebRtcVideoFrame frame(buffer, 20000, webrtc::kVideoRotation_0); | 277 cricket::WebRtcVideoFrame frame(buffer, 20000, webrtc::kVideoRotation_0); |
278 EXPECT_EQ(dummy_handle, frame.GetNativeHandle()); | 278 EXPECT_EQ(dummy_handle, frame.video_frame_buffer()->native_handle()); |
279 EXPECT_EQ(640, frame.width()); | 279 EXPECT_EQ(640, frame.width()); |
280 EXPECT_EQ(480, frame.height()); | 280 EXPECT_EQ(480, frame.height()); |
281 EXPECT_EQ(20000, frame.GetTimeStamp()); | 281 EXPECT_EQ(20000, frame.GetTimeStamp()); |
282 EXPECT_EQ(20, frame.timestamp_us()); | 282 EXPECT_EQ(20, frame.timestamp_us()); |
283 frame.set_timestamp_us(40); | 283 frame.set_timestamp_us(40); |
284 EXPECT_EQ(40000, frame.GetTimeStamp()); | 284 EXPECT_EQ(40000, frame.GetTimeStamp()); |
285 EXPECT_EQ(40, frame.timestamp_us()); | 285 EXPECT_EQ(40, frame.timestamp_us()); |
286 } | 286 } |
287 | 287 |
288 TEST_F(WebRtcVideoFrameTest, CopyTextureFrame) { | 288 TEST_F(WebRtcVideoFrameTest, CopyTextureFrame) { |
289 webrtc::test::FakeNativeHandle* dummy_handle = | 289 webrtc::test::FakeNativeHandle* dummy_handle = |
290 new webrtc::test::FakeNativeHandle(); | 290 new webrtc::test::FakeNativeHandle(); |
291 webrtc::NativeHandleBuffer* buffer = | 291 webrtc::NativeHandleBuffer* buffer = |
292 new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>( | 292 new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>( |
293 dummy_handle, 640, 480); | 293 dummy_handle, 640, 480); |
294 // Timestamp is converted from ns to us, so last three digits are lost. | 294 // Timestamp is converted from ns to us, so last three digits are lost. |
295 cricket::WebRtcVideoFrame frame1(buffer, 20000, webrtc::kVideoRotation_0); | 295 cricket::WebRtcVideoFrame frame1(buffer, 20000, webrtc::kVideoRotation_0); |
296 cricket::VideoFrame* frame2 = frame1.Copy(); | 296 cricket::VideoFrame* frame2 = frame1.Copy(); |
297 EXPECT_EQ(frame1.GetNativeHandle(), frame2->GetNativeHandle()); | 297 EXPECT_EQ(frame1.video_frame_buffer()->native_handle(), |
| 298 frame2->video_frame_buffer()->native_handle()); |
298 EXPECT_EQ(frame1.width(), frame2->width()); | 299 EXPECT_EQ(frame1.width(), frame2->width()); |
299 EXPECT_EQ(frame1.height(), frame2->height()); | 300 EXPECT_EQ(frame1.height(), frame2->height()); |
300 EXPECT_EQ(frame1.GetTimeStamp(), frame2->GetTimeStamp()); | 301 EXPECT_EQ(frame1.GetTimeStamp(), frame2->GetTimeStamp()); |
301 EXPECT_EQ(frame1.timestamp_us(), frame2->timestamp_us()); | 302 EXPECT_EQ(frame1.timestamp_us(), frame2->timestamp_us()); |
302 delete frame2; | 303 delete frame2; |
303 } | 304 } |
304 | 305 |
305 TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) { | 306 TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) { |
306 WebRtcVideoTestFrame applied0; | 307 WebRtcVideoTestFrame applied0; |
307 EXPECT_TRUE(IsNull(applied0)); | 308 EXPECT_TRUE(IsNull(applied0)); |
(...skipping 14 matching lines...) Expand all Loading... |
322 | 323 |
323 // Claim the frame 2 needs to be rotated for another 270 degree. The output | 324 // Claim the frame 2 needs to be rotated for another 270 degree. The output |
324 // from frame 2 rotation should be the same as frame 1. | 325 // from frame 2 rotation should be the same as frame 1. |
325 applied90->set_rotation(webrtc::kVideoRotation_270); | 326 applied90->set_rotation(webrtc::kVideoRotation_270); |
326 const cricket::VideoFrame* applied360 = | 327 const cricket::VideoFrame* applied360 = |
327 applied90->GetCopyWithRotationApplied(); | 328 applied90->GetCopyWithRotationApplied(); |
328 EXPECT_TRUE(applied360); | 329 EXPECT_TRUE(applied360); |
329 EXPECT_EQ(applied360->rotation(), webrtc::kVideoRotation_0); | 330 EXPECT_EQ(applied360->rotation(), webrtc::kVideoRotation_0); |
330 EXPECT_TRUE(IsEqual(applied0, *applied360, 0)); | 331 EXPECT_TRUE(IsEqual(applied0, *applied360, 0)); |
331 } | 332 } |
OLD | NEW |