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

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

Issue 2080253002: Delete method cricket::VideoFrame::Copy. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix syntax error in objc files. 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
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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 TEST_WEBRTCVIDEOFRAME(ConvertFromI400BufferInverted) 238 TEST_WEBRTCVIDEOFRAME(ConvertFromI400BufferInverted)
239 TEST_WEBRTCVIDEOFRAME(ConvertFromYUY2Buffer) 239 TEST_WEBRTCVIDEOFRAME(ConvertFromYUY2Buffer)
240 TEST_WEBRTCVIDEOFRAME(ConvertFromYUY2BufferStride) 240 TEST_WEBRTCVIDEOFRAME(ConvertFromYUY2BufferStride)
241 TEST_WEBRTCVIDEOFRAME(ConvertFromYUY2BufferInverted) 241 TEST_WEBRTCVIDEOFRAME(ConvertFromYUY2BufferInverted)
242 TEST_WEBRTCVIDEOFRAME(ConvertFromUYVYBuffer) 242 TEST_WEBRTCVIDEOFRAME(ConvertFromUYVYBuffer)
243 TEST_WEBRTCVIDEOFRAME(ConvertFromUYVYBufferStride) 243 TEST_WEBRTCVIDEOFRAME(ConvertFromUYVYBufferStride)
244 TEST_WEBRTCVIDEOFRAME(ConvertFromUYVYBufferInverted) 244 TEST_WEBRTCVIDEOFRAME(ConvertFromUYVYBufferInverted)
245 // TEST_WEBRTCVIDEOFRAME(ConvertToI422Buffer) 245 // TEST_WEBRTCVIDEOFRAME(ConvertToI422Buffer)
246 // TEST_WEBRTCVIDEOFRAME(ConstructARGBBlackWhitePixel) 246 // TEST_WEBRTCVIDEOFRAME(ConstructARGBBlackWhitePixel)
247 247
248 TEST_WEBRTCVIDEOFRAME(Copy)
249 TEST_WEBRTCVIDEOFRAME(CopyIsRef)
250
251 // These functions test implementation-specific details. 248 // These functions test implementation-specific details.
252 // Tests the Init function with different cropped size. 249 // Tests the Init function with different cropped size.
253 TEST_F(WebRtcVideoFrameTest, InitEvenSize) { 250 TEST_F(WebRtcVideoFrameTest, InitEvenSize) {
254 TestInit(640, 360, webrtc::kVideoRotation_0, true); 251 TestInit(640, 360, webrtc::kVideoRotation_0, true);
255 } 252 }
256 253
257 TEST_F(WebRtcVideoFrameTest, InitOddWidth) { 254 TEST_F(WebRtcVideoFrameTest, InitOddWidth) {
258 TestInit(601, 480, webrtc::kVideoRotation_0, true); 255 TestInit(601, 480, webrtc::kVideoRotation_0, true);
259 } 256 }
260 257
(...skipping 24 matching lines...) Expand all
285 EXPECT_EQ(dummy_handle, frame.video_frame_buffer()->native_handle()); 282 EXPECT_EQ(dummy_handle, frame.video_frame_buffer()->native_handle());
286 EXPECT_EQ(640, frame.width()); 283 EXPECT_EQ(640, frame.width());
287 EXPECT_EQ(480, frame.height()); 284 EXPECT_EQ(480, frame.height());
288 EXPECT_EQ(20000, frame.GetTimeStamp()); 285 EXPECT_EQ(20000, frame.GetTimeStamp());
289 EXPECT_EQ(20, frame.timestamp_us()); 286 EXPECT_EQ(20, frame.timestamp_us());
290 frame.set_timestamp_us(40); 287 frame.set_timestamp_us(40);
291 EXPECT_EQ(40000, frame.GetTimeStamp()); 288 EXPECT_EQ(40000, frame.GetTimeStamp());
292 EXPECT_EQ(40, frame.timestamp_us()); 289 EXPECT_EQ(40, frame.timestamp_us());
293 } 290 }
294 291
295 TEST_F(WebRtcVideoFrameTest, CopyTextureFrame) {
296 webrtc::test::FakeNativeHandle* dummy_handle =
297 new webrtc::test::FakeNativeHandle();
298 webrtc::NativeHandleBuffer* buffer =
299 new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>(
300 dummy_handle, 640, 480);
301 // Timestamp is converted from ns to us, so last three digits are lost.
302 cricket::WebRtcVideoFrame frame1(buffer, 20000, webrtc::kVideoRotation_0);
303 cricket::VideoFrame* frame2 = frame1.Copy();
304 EXPECT_EQ(frame1.video_frame_buffer()->native_handle(),
305 frame2->video_frame_buffer()->native_handle());
306 EXPECT_EQ(frame1.width(), frame2->width());
307 EXPECT_EQ(frame1.height(), frame2->height());
308 EXPECT_EQ(frame1.GetTimeStamp(), frame2->GetTimeStamp());
309 EXPECT_EQ(frame1.timestamp_us(), frame2->timestamp_us());
310 delete frame2;
311 }
312
313 TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) { 292 TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) {
314 WebRtcVideoTestFrame applied0; 293 WebRtcVideoTestFrame applied0;
315 EXPECT_TRUE(IsNull(applied0)); 294 EXPECT_TRUE(IsNull(applied0));
316 EXPECT_TRUE(LoadFrame(CreateYuvSample(kWidth, kHeight, 12).get(), 295 EXPECT_TRUE(LoadFrame(CreateYuvSample(kWidth, kHeight, 12).get(),
317 cricket::FOURCC_I420, kWidth, kHeight, &applied0)); 296 cricket::FOURCC_I420, kWidth, kHeight, &applied0));
318 297
319 // Claim that this frame needs to be rotated for 90 degree. 298 // Claim that this frame needs to be rotated for 90 degree.
320 applied0.set_rotation(webrtc::kVideoRotation_90); 299 applied0.set_rotation(webrtc::kVideoRotation_90);
321 300
322 // 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.
323 WebRtcVideoTestFrame* applied90 = const_cast<WebRtcVideoTestFrame*>( 302 WebRtcVideoTestFrame* applied90 = const_cast<WebRtcVideoTestFrame*>(
324 static_cast<const WebRtcVideoTestFrame*>( 303 static_cast<const WebRtcVideoTestFrame*>(
325 applied0.GetCopyWithRotationApplied())); 304 applied0.GetCopyWithRotationApplied()));
326 EXPECT_TRUE(applied90); 305 EXPECT_TRUE(applied90);
327 EXPECT_EQ(applied90->rotation(), webrtc::kVideoRotation_0); 306 EXPECT_EQ(applied90->rotation(), webrtc::kVideoRotation_0);
328 EXPECT_FALSE(IsEqual(applied0, *applied90, 0)); 307 EXPECT_FALSE(IsEqual(applied0, *applied90, 0));
329 308
330 // Claim the frame 2 needs to be rotated for another 270 degree. The output 309 // Claim the frame 2 needs to be rotated for another 270 degree. The output
331 // from frame 2 rotation should be the same as frame 1. 310 // from frame 2 rotation should be the same as frame 1.
332 applied90->set_rotation(webrtc::kVideoRotation_270); 311 applied90->set_rotation(webrtc::kVideoRotation_270);
333 const cricket::VideoFrame* applied360 = 312 const cricket::VideoFrame* applied360 =
334 applied90->GetCopyWithRotationApplied(); 313 applied90->GetCopyWithRotationApplied();
335 EXPECT_TRUE(applied360); 314 EXPECT_TRUE(applied360);
336 EXPECT_EQ(applied360->rotation(), webrtc::kVideoRotation_0); 315 EXPECT_EQ(applied360->rotation(), webrtc::kVideoRotation_0);
337 EXPECT_TRUE(IsEqual(applied0, *applied360, 0)); 316 EXPECT_TRUE(IsEqual(applied0, *applied360, 0));
338 } 317 }
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoframe.cc ('k') | webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698