OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 13 matching lines...) Expand all Loading... |
24 | 24 |
25 #elif defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) | 25 #elif defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) |
26 | 26 |
27 #include <X11/Xlib.h> | 27 #include <X11/Xlib.h> |
28 #include <X11/Xutil.h> | 28 #include <X11/Xutil.h> |
29 #include <iostream> | 29 #include <iostream> |
30 #include <sys/time.h> | 30 #include <sys/time.h> |
31 | 31 |
32 #endif | 32 #endif |
33 | 33 |
| 34 #include "webrtc/base/timeutils.h" |
34 #include "webrtc/common_types.h" | 35 #include "webrtc/common_types.h" |
35 #include "webrtc/modules/include/module_common_types.h" | 36 #include "webrtc/modules/include/module_common_types.h" |
36 #include "webrtc/modules/utility/include/process_thread.h" | 37 #include "webrtc/modules/utility/include/process_thread.h" |
37 #include "webrtc/modules/video_render/video_render.h" | 38 #include "webrtc/modules/video_render/video_render.h" |
38 #include "webrtc/modules/video_render/video_render_defines.h" | 39 #include "webrtc/modules/video_render/video_render_defines.h" |
39 #include "webrtc/system_wrappers/include/sleep.h" | 40 #include "webrtc/system_wrappers/include/sleep.h" |
40 #include "webrtc/system_wrappers/include/tick_util.h" | |
41 #include "webrtc/system_wrappers/include/trace.h" | 41 #include "webrtc/system_wrappers/include/trace.h" |
42 | 42 |
43 using namespace webrtc; | 43 using namespace webrtc; |
44 | 44 |
45 void GetTestVideoFrame(VideoFrame* frame, uint8_t startColor); | 45 void GetTestVideoFrame(VideoFrame* frame, uint8_t startColor); |
46 int TestSingleStream(VideoRender* renderModule); | 46 int TestSingleStream(VideoRender* renderModule); |
47 int TestFullscreenStream(VideoRender* &renderModule, | 47 int TestFullscreenStream(VideoRender* &renderModule, |
48 void* window, | 48 void* window, |
49 const VideoRenderType videoRenderType); | 49 const VideoRenderType videoRenderType); |
50 int TestBitmapText(VideoRender* renderModule); | 50 int TestBitmapText(VideoRender* renderModule); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 const int height = 288; | 306 const int height = 288; |
307 | 307 |
308 VideoFrame videoFrame0; | 308 VideoFrame videoFrame0; |
309 videoFrame0.CreateEmptyFrame(width, height, width, half_width, half_width); | 309 videoFrame0.CreateEmptyFrame(width, height, width, half_width, half_width); |
310 | 310 |
311 const uint32_t renderDelayMs = 500; | 311 const uint32_t renderDelayMs = 500; |
312 | 312 |
313 for (int i=0; i<TEST_FRAME_NUM; i++) { | 313 for (int i=0; i<TEST_FRAME_NUM; i++) { |
314 GetTestVideoFrame(&videoFrame0, TEST_STREAM0_START_COLOR); | 314 GetTestVideoFrame(&videoFrame0, TEST_STREAM0_START_COLOR); |
315 // Render this frame with the specified delay | 315 // Render this frame with the specified delay |
316 videoFrame0.set_render_time_ms(TickTime::MillisecondTimestamp() | 316 videoFrame0.set_render_time_ms(rtc::Time64() |
317 + renderDelayMs); | 317 + renderDelayMs); |
318 renderCallback0->RenderFrame(streamId0, videoFrame0); | 318 renderCallback0->RenderFrame(streamId0, videoFrame0); |
319 SleepMs(1000/TEST_FRAME_RATE); | 319 SleepMs(1000/TEST_FRAME_RATE); |
320 } | 320 } |
321 | 321 |
322 | 322 |
323 // Shut down | 323 // Shut down |
324 printf("Closing...\n"); | 324 printf("Closing...\n"); |
325 error = renderModule->StopRender(streamId0); | 325 error = renderModule->StopRender(streamId0); |
326 assert(error == 0); | 326 assert(error == 0); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 const int height = 288; | 380 const int height = 288; |
381 | 381 |
382 VideoFrame videoFrame0; | 382 VideoFrame videoFrame0; |
383 videoFrame0.CreateEmptyFrame(width, height, width, half_width, half_width); | 383 videoFrame0.CreateEmptyFrame(width, height, width, half_width, half_width); |
384 | 384 |
385 const uint32_t renderDelayMs = 500; | 385 const uint32_t renderDelayMs = 500; |
386 | 386 |
387 for (int i=0; i<TEST_FRAME_NUM; i++) { | 387 for (int i=0; i<TEST_FRAME_NUM; i++) { |
388 GetTestVideoFrame(&videoFrame0, TEST_STREAM0_START_COLOR); | 388 GetTestVideoFrame(&videoFrame0, TEST_STREAM0_START_COLOR); |
389 // Render this frame with the specified delay | 389 // Render this frame with the specified delay |
390 videoFrame0.set_render_time_ms(TickTime::MillisecondTimestamp() + | 390 videoFrame0.set_render_time_ms(rtc::Time64() + |
391 renderDelayMs); | 391 renderDelayMs); |
392 renderCallback0->RenderFrame(streamId0, videoFrame0); | 392 renderCallback0->RenderFrame(streamId0, videoFrame0); |
393 SleepMs(1000/TEST_FRAME_RATE); | 393 SleepMs(1000/TEST_FRAME_RATE); |
394 } | 394 } |
395 // Sleep and let all frames be rendered before closing | 395 // Sleep and let all frames be rendered before closing |
396 SleepMs(renderDelayMs*2); | 396 SleepMs(renderDelayMs*2); |
397 | 397 |
398 | 398 |
399 // Shut down | 399 // Shut down |
400 printf("Closing...\n"); | 400 printf("Closing...\n"); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 videoFrame2.CreateEmptyFrame(width, height, width, half_width, half_width); | 465 videoFrame2.CreateEmptyFrame(width, height, width, half_width, half_width); |
466 VideoFrame videoFrame3; | 466 VideoFrame videoFrame3; |
467 videoFrame3.CreateEmptyFrame(width, height, width, half_width, half_width); | 467 videoFrame3.CreateEmptyFrame(width, height, width, half_width, half_width); |
468 | 468 |
469 const uint32_t renderDelayMs = 500; | 469 const uint32_t renderDelayMs = 500; |
470 | 470 |
471 // Render frames with the specified delay. | 471 // Render frames with the specified delay. |
472 for (int i=0; i<TEST_FRAME_NUM; i++) { | 472 for (int i=0; i<TEST_FRAME_NUM; i++) { |
473 GetTestVideoFrame(&videoFrame0, TEST_STREAM0_START_COLOR); | 473 GetTestVideoFrame(&videoFrame0, TEST_STREAM0_START_COLOR); |
474 | 474 |
475 videoFrame0.set_render_time_ms(TickTime::MillisecondTimestamp() + | 475 videoFrame0.set_render_time_ms(rtc::Time64() + |
476 renderDelayMs); | 476 renderDelayMs); |
477 renderCallback0->RenderFrame(streamId0, videoFrame0); | 477 renderCallback0->RenderFrame(streamId0, videoFrame0); |
478 | 478 |
479 GetTestVideoFrame(&videoFrame1, TEST_STREAM1_START_COLOR); | 479 GetTestVideoFrame(&videoFrame1, TEST_STREAM1_START_COLOR); |
480 videoFrame1.set_render_time_ms(TickTime::MillisecondTimestamp() + | 480 videoFrame1.set_render_time_ms(rtc::Time64() + |
481 renderDelayMs); | 481 renderDelayMs); |
482 renderCallback1->RenderFrame(streamId1, videoFrame1); | 482 renderCallback1->RenderFrame(streamId1, videoFrame1); |
483 | 483 |
484 GetTestVideoFrame(&videoFrame2, TEST_STREAM2_START_COLOR); | 484 GetTestVideoFrame(&videoFrame2, TEST_STREAM2_START_COLOR); |
485 videoFrame2.set_render_time_ms(TickTime::MillisecondTimestamp() + | 485 videoFrame2.set_render_time_ms(rtc::Time64() + |
486 renderDelayMs); | 486 renderDelayMs); |
487 renderCallback2->RenderFrame(streamId2, videoFrame2); | 487 renderCallback2->RenderFrame(streamId2, videoFrame2); |
488 | 488 |
489 GetTestVideoFrame(&videoFrame3, TEST_STREAM3_START_COLOR); | 489 GetTestVideoFrame(&videoFrame3, TEST_STREAM3_START_COLOR); |
490 videoFrame3.set_render_time_ms(TickTime::MillisecondTimestamp() + | 490 videoFrame3.set_render_time_ms(rtc::Time64() + |
491 renderDelayMs); | 491 renderDelayMs); |
492 renderCallback3->RenderFrame(streamId3, videoFrame3); | 492 renderCallback3->RenderFrame(streamId3, videoFrame3); |
493 | 493 |
494 SleepMs(1000/TEST_FRAME_RATE); | 494 SleepMs(1000/TEST_FRAME_RATE); |
495 } | 495 } |
496 | 496 |
497 // Shut down | 497 // Shut down |
498 printf("Closing...\n"); | 498 printf("Closing...\n"); |
499 error = renderModule->StopRender(streamId0); | 499 error = renderModule->StopRender(streamId0); |
500 assert(error == 0); | 500 assert(error == 0); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 | 538 |
539 const int width = 352; | 539 const int width = 352; |
540 const int half_width = (width + 1) / 2; | 540 const int half_width = (width + 1) / 2; |
541 const int height = 288; | 541 const int height = 288; |
542 VideoFrame videoFrame0; | 542 VideoFrame videoFrame0; |
543 videoFrame0.CreateEmptyFrame(width, height, width, half_width, half_width); | 543 videoFrame0.CreateEmptyFrame(width, height, width, half_width, half_width); |
544 | 544 |
545 const uint32_t renderDelayMs = 500; | 545 const uint32_t renderDelayMs = 500; |
546 int frameCount = TEST_FRAME_NUM; | 546 int frameCount = TEST_FRAME_NUM; |
547 for (int i=0; i<frameCount; i++) { | 547 for (int i=0; i<frameCount; i++) { |
548 videoFrame0.set_render_time_ms(TickTime::MillisecondTimestamp() + | 548 videoFrame0.set_render_time_ms(rtc::Time64() + |
549 renderDelayMs); | 549 renderDelayMs); |
550 renderCallback0->RenderFrame(streamId0, videoFrame0); | 550 renderCallback0->RenderFrame(streamId0, videoFrame0); |
551 SleepMs(33); | 551 SleepMs(33); |
552 } | 552 } |
553 | 553 |
554 // Sleep and let all frames be rendered before closing | 554 // Sleep and let all frames be rendered before closing |
555 SleepMs(2*renderDelayMs); | 555 SleepMs(2*renderDelayMs); |
556 | 556 |
557 // Shut down | 557 // Shut down |
558 printf("Closing...\n"); | 558 printf("Closing...\n"); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 Display* display; | 636 Display* display; |
637 WebRtcCreateWindow(&testWindow, &display, 0, 352, 288); | 637 WebRtcCreateWindow(&testWindow, &display, 0, 352, 288); |
638 VideoRenderType windowType = kRenderX11; | 638 VideoRenderType windowType = kRenderX11; |
639 window = (void*)testWindow; | 639 window = (void*)testWindow; |
640 #endif // WEBRTC_LINUX | 640 #endif // WEBRTC_LINUX |
641 | 641 |
642 RunVideoRenderTests(window, windowType); | 642 RunVideoRenderTests(window, windowType); |
643 return 0; | 643 return 0; |
644 } | 644 } |
645 #endif // !WEBRTC_MAC | 645 #endif // !WEBRTC_MAC |
OLD | NEW |