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

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

Issue 1888593004: Delete all use of tick_util.h. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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/include/incoming_video_stream.h" 11 #include "webrtc/common_video/include/incoming_video_stream.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 14
15 #if defined(_WIN32) 15 #if defined(_WIN32)
16 #include <windows.h> 16 #include <windows.h>
17 #elif defined(WEBRTC_LINUX) 17 #elif defined(WEBRTC_LINUX)
18 #include <sys/time.h> 18 #include <sys/time.h>
19 #include <time.h> 19 #include <time.h>
20 #else 20 #else
21 #include <sys/time.h> 21 #include <sys/time.h>
22 #endif 22 #endif
23 23
24 #include "webrtc/base/platform_thread.h" 24 #include "webrtc/base/platform_thread.h"
25 #include "webrtc/base/timeutils.h"
25 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 26 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
26 #include "webrtc/common_video/video_render_frames.h" 27 #include "webrtc/common_video/video_render_frames.h"
27 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" 28 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
28 #include "webrtc/system_wrappers/include/event_wrapper.h" 29 #include "webrtc/system_wrappers/include/event_wrapper.h"
29 #include "webrtc/system_wrappers/include/tick_util.h"
30 #include "webrtc/system_wrappers/include/trace.h" 30 #include "webrtc/system_wrappers/include/trace.h"
31 31
32 namespace webrtc { 32 namespace webrtc {
33 33
34 IncomingVideoStream::IncomingVideoStream(uint32_t stream_id, 34 IncomingVideoStream::IncomingVideoStream(uint32_t stream_id,
35 bool disable_prerenderer_smoothing) 35 bool disable_prerenderer_smoothing)
36 : stream_id_(stream_id), 36 : stream_id_(stream_id),
37 disable_prerenderer_smoothing_(disable_prerenderer_smoothing), 37 disable_prerenderer_smoothing_(disable_prerenderer_smoothing),
38 incoming_render_thread_(), 38 incoming_render_thread_(),
39 deliver_buffer_event_(EventTimerWrapper::Create()), 39 deliver_buffer_event_(EventTimerWrapper::Create()),
(...skipping 21 matching lines...) Expand all
61 int32_t IncomingVideoStream::RenderFrame(const uint32_t stream_id, 61 int32_t IncomingVideoStream::RenderFrame(const uint32_t stream_id,
62 const VideoFrame& video_frame) { 62 const VideoFrame& video_frame) {
63 rtc::CritScope csS(&stream_critsect_); 63 rtc::CritScope csS(&stream_critsect_);
64 64
65 if (!running_) { 65 if (!running_) {
66 return -1; 66 return -1;
67 } 67 }
68 68
69 // Rate statistics. 69 // Rate statistics.
70 num_frames_since_last_calculation_++; 70 num_frames_since_last_calculation_++;
71 int64_t now_ms = TickTime::MillisecondTimestamp(); 71 int64_t now_ms = rtc::Time64();
72 if (now_ms >= last_rate_calculation_time_ms_ + kFrameRatePeriodMs) { 72 if (now_ms >= last_rate_calculation_time_ms_ + kFrameRatePeriodMs) {
73 incoming_rate_ = 73 incoming_rate_ =
74 static_cast<uint32_t>(1000 * num_frames_since_last_calculation_ / 74 static_cast<uint32_t>(1000 * num_frames_since_last_calculation_ /
75 (now_ms - last_rate_calculation_time_ms_)); 75 (now_ms - last_rate_calculation_time_ms_));
76 num_frames_since_last_calculation_ = 0; 76 num_frames_since_last_calculation_ = 0;
77 last_rate_calculation_time_ms_ = now_ms; 77 last_rate_calculation_time_ms_ = now_ms;
78 } 78 }
79 79
80 // Hand over or insert frame. 80 // Hand over or insert frame.
81 if (disable_prerenderer_smoothing_) { 81 if (disable_prerenderer_smoothing_) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 void IncomingVideoStream::DeliverFrame(const VideoFrame& video_frame) { 226 void IncomingVideoStream::DeliverFrame(const VideoFrame& video_frame) {
227 rtc::CritScope cs(&thread_critsect_); 227 rtc::CritScope cs(&thread_critsect_);
228 if (video_frame.IsZeroSize()) { 228 if (video_frame.IsZeroSize()) {
229 if (render_callback_) { 229 if (render_callback_) {
230 if (last_render_time_ms_ == 0 && !start_image_.IsZeroSize()) { 230 if (last_render_time_ms_ == 0 && !start_image_.IsZeroSize()) {
231 // We have not rendered anything and have a start image. 231 // We have not rendered anything and have a start image.
232 temp_frame_.CopyFrame(start_image_); 232 temp_frame_.CopyFrame(start_image_);
233 render_callback_->RenderFrame(stream_id_, temp_frame_); 233 render_callback_->RenderFrame(stream_id_, temp_frame_);
234 } else if (!timeout_image_.IsZeroSize() && 234 } else if (!timeout_image_.IsZeroSize() &&
235 last_render_time_ms_ + timeout_time_ < 235 last_render_time_ms_ + timeout_time_ <
236 TickTime::MillisecondTimestamp()) { 236 rtc::Time64()) {
237 // Render a timeout image. 237 // Render a timeout image.
238 temp_frame_.CopyFrame(timeout_image_); 238 temp_frame_.CopyFrame(timeout_image_);
239 render_callback_->RenderFrame(stream_id_, temp_frame_); 239 render_callback_->RenderFrame(stream_id_, temp_frame_);
240 } 240 }
241 } 241 }
242 242
243 // No frame. 243 // No frame.
244 return; 244 return;
245 } 245 }
246 246
247 // Send frame for rendering. 247 // Send frame for rendering.
248 if (external_callback_) { 248 if (external_callback_) {
249 external_callback_->RenderFrame(stream_id_, video_frame); 249 external_callback_->RenderFrame(stream_id_, video_frame);
250 } else if (render_callback_) { 250 } else if (render_callback_) {
251 render_callback_->RenderFrame(stream_id_, video_frame); 251 render_callback_->RenderFrame(stream_id_, video_frame);
252 } 252 }
253 253
254 // We're done with this frame. 254 // We're done with this frame.
255 last_render_time_ms_ = video_frame.render_time_ms(); 255 last_render_time_ms_ = video_frame.render_time_ms();
256 } 256 }
257 257
258 } // namespace webrtc 258 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698