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

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

Issue 1158273010: Re-land "Convert native handles to buffers before encoding." (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 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
« no previous file with comments | « talk/app/webrtc/java/jni/native_handle_impl.h ('k') | webrtc/common_video/i420_buffer_pool.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 11 matching lines...) Expand all
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #include <string.h> 28 #include <string.h>
29 29
30 #include "talk/media/base/videoframe_unittest.h" 30 #include "talk/media/base/videoframe_unittest.h"
31 #include "talk/media/webrtc/webrtcvideoframe.h" 31 #include "talk/media/webrtc/webrtcvideoframe.h"
32 #include "webrtc/test/fake_texture_frame.h"
32 33
33 namespace { 34 namespace {
34 35
35 class WebRtcVideoTestFrame : public cricket::WebRtcVideoFrame { 36 class WebRtcVideoTestFrame : public cricket::WebRtcVideoFrame {
36 public: 37 public:
37 using cricket::WebRtcVideoFrame::SetRotation; 38 using cricket::WebRtcVideoFrame::SetRotation;
38 39
39 virtual VideoFrame* CreateEmptyFrame(int w, 40 virtual VideoFrame* CreateEmptyFrame(int w,
40 int h, 41 int h,
41 size_t pixel_width, 42 size_t pixel_width,
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 291
291 TEST_F(WebRtcVideoFrameTest, InitRotated90ApplyRotation) { 292 TEST_F(WebRtcVideoFrameTest, InitRotated90ApplyRotation) {
292 TestInit(640, 360, webrtc::kVideoRotation_90, true); 293 TestInit(640, 360, webrtc::kVideoRotation_90, true);
293 } 294 }
294 295
295 TEST_F(WebRtcVideoFrameTest, InitRotated90DontApplyRotation) { 296 TEST_F(WebRtcVideoFrameTest, InitRotated90DontApplyRotation) {
296 TestInit(640, 360, webrtc::kVideoRotation_90, false); 297 TestInit(640, 360, webrtc::kVideoRotation_90, false);
297 } 298 }
298 299
299 TEST_F(WebRtcVideoFrameTest, TextureInitialValues) { 300 TEST_F(WebRtcVideoFrameTest, TextureInitialValues) {
300 void* dummy_handle = reinterpret_cast<void*>(0x1); 301 webrtc::test::FakeNativeHandle* dummy_handle =
301 webrtc::TextureBuffer* buffer = 302 new webrtc::test::FakeNativeHandle();
302 new rtc::RefCountedObject<webrtc::TextureBuffer>(dummy_handle, 640, 480, 303 webrtc::NativeHandleBuffer* buffer =
303 rtc::Callback0<void>()); 304 new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>(
305 dummy_handle, 640, 480);
304 cricket::WebRtcVideoFrame frame(buffer, 100, 200, webrtc::kVideoRotation_0); 306 cricket::WebRtcVideoFrame frame(buffer, 100, 200, webrtc::kVideoRotation_0);
305 EXPECT_EQ(dummy_handle, frame.GetNativeHandle()); 307 EXPECT_EQ(dummy_handle, frame.GetNativeHandle());
306 EXPECT_EQ(640u, frame.GetWidth()); 308 EXPECT_EQ(640u, frame.GetWidth());
307 EXPECT_EQ(480u, frame.GetHeight()); 309 EXPECT_EQ(480u, frame.GetHeight());
308 EXPECT_EQ(100, frame.GetElapsedTime()); 310 EXPECT_EQ(100, frame.GetElapsedTime());
309 EXPECT_EQ(200, frame.GetTimeStamp()); 311 EXPECT_EQ(200, frame.GetTimeStamp());
310 frame.SetElapsedTime(300); 312 frame.SetElapsedTime(300);
311 EXPECT_EQ(300, frame.GetElapsedTime()); 313 EXPECT_EQ(300, frame.GetElapsedTime());
312 frame.SetTimeStamp(400); 314 frame.SetTimeStamp(400);
313 EXPECT_EQ(400, frame.GetTimeStamp()); 315 EXPECT_EQ(400, frame.GetTimeStamp());
314 } 316 }
315 317
316 TEST_F(WebRtcVideoFrameTest, CopyTextureFrame) { 318 TEST_F(WebRtcVideoFrameTest, CopyTextureFrame) {
317 void* dummy_handle = reinterpret_cast<void*>(0x1); 319 webrtc::test::FakeNativeHandle* dummy_handle =
318 webrtc::TextureBuffer* buffer = 320 new webrtc::test::FakeNativeHandle();
319 new rtc::RefCountedObject<webrtc::TextureBuffer>(dummy_handle, 640, 480, 321 webrtc::NativeHandleBuffer* buffer =
320 rtc::Callback0<void>()); 322 new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>(
323 dummy_handle, 640, 480);
321 cricket::WebRtcVideoFrame frame1(buffer, 100, 200, webrtc::kVideoRotation_0); 324 cricket::WebRtcVideoFrame frame1(buffer, 100, 200, webrtc::kVideoRotation_0);
322 cricket::VideoFrame* frame2 = frame1.Copy(); 325 cricket::VideoFrame* frame2 = frame1.Copy();
323 EXPECT_EQ(frame1.GetNativeHandle(), frame2->GetNativeHandle()); 326 EXPECT_EQ(frame1.GetNativeHandle(), frame2->GetNativeHandle());
324 EXPECT_EQ(frame1.GetWidth(), frame2->GetWidth()); 327 EXPECT_EQ(frame1.GetWidth(), frame2->GetWidth());
325 EXPECT_EQ(frame1.GetHeight(), frame2->GetHeight()); 328 EXPECT_EQ(frame1.GetHeight(), frame2->GetHeight());
326 EXPECT_EQ(frame1.GetElapsedTime(), frame2->GetElapsedTime()); 329 EXPECT_EQ(frame1.GetElapsedTime(), frame2->GetElapsedTime());
327 EXPECT_EQ(frame1.GetTimeStamp(), frame2->GetTimeStamp()); 330 EXPECT_EQ(frame1.GetTimeStamp(), frame2->GetTimeStamp());
328 delete frame2; 331 delete frame2;
329 } 332 }
330 333
(...skipping 17 matching lines...) Expand all
348 351
349 // Claim the frame 2 needs to be rotated for another 270 degree. The output 352 // Claim the frame 2 needs to be rotated for another 270 degree. The output
350 // from frame 2 rotation should be the same as frame 1. 353 // from frame 2 rotation should be the same as frame 1.
351 applied90->SetRotation(webrtc::kVideoRotation_270); 354 applied90->SetRotation(webrtc::kVideoRotation_270);
352 const cricket::VideoFrame* applied360 = 355 const cricket::VideoFrame* applied360 =
353 applied90->GetCopyWithRotationApplied(); 356 applied90->GetCopyWithRotationApplied();
354 EXPECT_TRUE(applied360); 357 EXPECT_TRUE(applied360);
355 EXPECT_EQ(applied360->GetVideoRotation(), webrtc::kVideoRotation_0); 358 EXPECT_EQ(applied360->GetVideoRotation(), webrtc::kVideoRotation_0);
356 EXPECT_TRUE(IsEqual(applied0, *applied360, 0)); 359 EXPECT_TRUE(IsEqual(applied0, *applied360, 0));
357 } 360 }
OLDNEW
« no previous file with comments | « talk/app/webrtc/java/jni/native_handle_impl.h ('k') | webrtc/common_video/i420_buffer_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698