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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 CriticalSectionScoped cs(crit_sect_); | 279 CriticalSectionScoped cs(crit_sect_); |
280 if (desired_delay_ms < 0 || desired_delay_ms > kMaxReceiverDelayMs) { | 280 if (desired_delay_ms < 0 || desired_delay_ms > kMaxReceiverDelayMs) { |
281 return -1; | 281 return -1; |
282 } | 282 } |
283 max_video_delay_ms_ = desired_delay_ms + kMaxVideoDelayMs; | 283 max_video_delay_ms_ = desired_delay_ms + kMaxVideoDelayMs; |
284 // Initializing timing to the desired delay. | 284 // Initializing timing to the desired delay. |
285 timing_->set_min_playout_delay(desired_delay_ms); | 285 timing_->set_min_playout_delay(desired_delay_ms); |
286 return 0; | 286 return 0; |
287 } | 287 } |
288 | 288 |
289 int VCMReceiver::RenderBufferSizeMs() { | |
290 uint32_t timestamp_start = 0u; | |
291 uint32_t timestamp_end = 0u; | |
292 // Render timestamps are computed just prior to decoding. Therefore this is | |
293 // only an estimate based on frames' timestamps and current timing state. | |
294 jitter_buffer_.RenderBufferSize(×tamp_start, ×tamp_end); | |
295 if (timestamp_start == timestamp_end) { | |
296 return 0; | |
297 } | |
298 // Update timing. | |
299 const int64_t now_ms = clock_->TimeInMilliseconds(); | |
300 timing_->SetJitterDelay(jitter_buffer_.EstimatedJitterMs()); | |
301 // Get render timestamps. | |
302 uint32_t render_start = timing_->RenderTimeMs(timestamp_start, now_ms); | |
303 uint32_t render_end = timing_->RenderTimeMs(timestamp_end, now_ms); | |
304 return render_end - render_start; | |
305 } | |
306 | |
307 void VCMReceiver::RegisterStatsCallback( | 289 void VCMReceiver::RegisterStatsCallback( |
308 VCMReceiveStatisticsCallback* callback) { | 290 VCMReceiveStatisticsCallback* callback) { |
309 jitter_buffer_.RegisterStatsCallback(callback); | 291 jitter_buffer_.RegisterStatsCallback(callback); |
310 } | 292 } |
311 | 293 |
312 } // namespace webrtc | 294 } // namespace webrtc |
OLD | NEW |