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

Side by Side Diff: webrtc/common_video/video_render_frames.cc

Issue 1888593004: Delete all use of tick_util.h. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 7 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) 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
11 #include "webrtc/common_video/video_render_frames.h" 11 #include "webrtc/common_video/video_render_frames.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 14
15 #include "webrtc/base/timeutils.h"
15 #include "webrtc/modules/include/module_common_types.h" 16 #include "webrtc/modules/include/module_common_types.h"
16 #include "webrtc/system_wrappers/include/tick_util.h"
17 #include "webrtc/system_wrappers/include/trace.h" 17 #include "webrtc/system_wrappers/include/trace.h"
18 18
19 namespace webrtc { 19 namespace webrtc {
20 20
21 const uint32_t KEventMaxWaitTimeMs = 200; 21 const uint32_t KEventMaxWaitTimeMs = 200;
22 const uint32_t kMinRenderDelayMs = 10; 22 const uint32_t kMinRenderDelayMs = 10;
23 const uint32_t kMaxRenderDelayMs = 500; 23 const uint32_t kMaxRenderDelayMs = 500;
24 24
25 VideoRenderFrames::VideoRenderFrames() 25 VideoRenderFrames::VideoRenderFrames()
26 : render_delay_ms_(10) { 26 : render_delay_ms_(10) {
27 } 27 }
28 28
29 int32_t VideoRenderFrames::AddFrame(const VideoFrame& new_frame) { 29 int32_t VideoRenderFrames::AddFrame(const VideoFrame& new_frame) {
30 const int64_t time_now = TickTime::MillisecondTimestamp(); 30 const int64_t time_now = rtc::TimeMillis();
31 31
32 // Drop old frames only when there are other frames in the queue, otherwise, a 32 // Drop old frames only when there are other frames in the queue, otherwise, a
33 // really slow system never renders any frames. 33 // really slow system never renders any frames.
34 if (!incoming_frames_.empty() && 34 if (!incoming_frames_.empty() &&
35 new_frame.render_time_ms() + KOldRenderTimestampMS < time_now) { 35 new_frame.render_time_ms() + KOldRenderTimestampMS < time_now) {
36 WEBRTC_TRACE(kTraceWarning, 36 WEBRTC_TRACE(kTraceWarning,
37 kTraceVideoRenderer, 37 kTraceVideoRenderer,
38 -1, 38 -1,
39 "%s: too old frame, timestamp=%u.", 39 "%s: too old frame, timestamp=%u.",
40 __FUNCTION__, 40 __FUNCTION__,
(...skipping 26 matching lines...) Expand all
67 incoming_frames_.clear(); 67 incoming_frames_.clear();
68 return 0; 68 return 0;
69 } 69 }
70 70
71 uint32_t VideoRenderFrames::TimeToNextFrameRelease() { 71 uint32_t VideoRenderFrames::TimeToNextFrameRelease() {
72 if (incoming_frames_.empty()) { 72 if (incoming_frames_.empty()) {
73 return KEventMaxWaitTimeMs; 73 return KEventMaxWaitTimeMs;
74 } 74 }
75 const int64_t time_to_release = incoming_frames_.front().render_time_ms() - 75 const int64_t time_to_release = incoming_frames_.front().render_time_ms() -
76 render_delay_ms_ - 76 render_delay_ms_ -
77 TickTime::MillisecondTimestamp(); 77 rtc::TimeMillis();
78 return time_to_release < 0 ? 0u : static_cast<uint32_t>(time_to_release); 78 return time_to_release < 0 ? 0u : static_cast<uint32_t>(time_to_release);
79 } 79 }
80 80
81 int32_t VideoRenderFrames::SetRenderDelay( 81 int32_t VideoRenderFrames::SetRenderDelay(
82 const uint32_t render_delay) { 82 const uint32_t render_delay) {
83 if (render_delay < kMinRenderDelayMs || 83 if (render_delay < kMinRenderDelayMs ||
84 render_delay > kMaxRenderDelayMs) { 84 render_delay > kMaxRenderDelayMs) {
85 WEBRTC_TRACE(kTraceWarning, kTraceVideoRenderer, 85 WEBRTC_TRACE(kTraceWarning, kTraceVideoRenderer,
86 -1, "%s(%d): Invalid argument.", __FUNCTION__, 86 -1, "%s(%d): Invalid argument.", __FUNCTION__,
87 render_delay); 87 render_delay);
88 return -1; 88 return -1;
89 } 89 }
90 90
91 render_delay_ms_ = render_delay; 91 render_delay_ms_ = render_delay;
92 return 0; 92 return 0;
93 } 93 }
94 94
95 } // namespace webrtc 95 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/common_video/libyuv/scaler_unittest.cc ('k') | webrtc/modules/audio_coding/acm2/acm_receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698