| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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/modules/video_coding/timing.h" | 11 #include "webrtc/modules/video_coding/timing.h" |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 | 14 |
| 15 #include "webrtc/modules/video_coding/internal_defines.h" | 15 #include "webrtc/modules/video_coding/internal_defines.h" |
| 16 #include "webrtc/modules/video_coding/jitter_buffer_common.h" | 16 #include "webrtc/modules/video_coding/jitter_buffer_common.h" |
| 17 #include "webrtc/system_wrappers/include/clock.h" | 17 #include "webrtc/system_wrappers/include/clock.h" |
| 18 #include "webrtc/system_wrappers/include/metrics.h" | 18 #include "webrtc/system_wrappers/include/metrics.h" |
| 19 #include "webrtc/system_wrappers/include/timestamp_extrapolator.h" | 19 #include "webrtc/system_wrappers/include/timestamp_extrapolator.h" |
| 20 | 20 |
| 21 namespace webrtc { | 21 namespace webrtc { |
| 22 | 22 |
| 23 VCMTiming::VCMTiming(Clock* clock, VCMTiming* master_timing) | 23 VCMTiming::VCMTiming(Clock* clock, VCMTiming* master_timing) |
| 24 : clock_(clock), | 24 : clock_(clock), |
| 25 master_(false), | 25 master_(false), |
| 26 ts_extrapolator_(), | 26 ts_extrapolator_(), |
| 27 codec_timer_(new VCMCodecTimer()), | 27 codec_timer_(new VCMCodecTimer()), |
| 28 render_delay_ms_(kDefaultRenderDelayMs), | 28 render_delay_ms_(kDefaultRenderDelayMs), |
| 29 min_playout_delay_ms_(0), | 29 min_playout_delay_ms_(0), |
| 30 max_playout_delay_ms_(10000), | 30 max_playout_delay_ms_(10000), |
| 31 jitter_delay_ms_(0), | 31 jitter_delay_ms_(0), |
| 32 current_delay_ms_(0), | 32 current_delay_ms_(0), |
| 33 last_decode_ms_(0), | 33 last_decode_ms_(0), |
| 34 prev_frame_timestamp_(0), | 34 prev_frame_timestamp_(0), |
| 35 num_decoded_frames_(0), | 35 timing_frame_info_(), |
| 36 num_delayed_decoded_frames_(0), | 36 num_decoded_frames_(0), |
| 37 first_decoded_frame_ms_(-1), | 37 num_delayed_decoded_frames_(0), |
| 38 sum_missed_render_deadline_ms_(0) { | 38 first_decoded_frame_ms_(-1), |
| 39 sum_missed_render_deadline_ms_(0) { |
| 39 if (master_timing == NULL) { | 40 if (master_timing == NULL) { |
| 40 master_ = true; | 41 master_ = true; |
| 41 ts_extrapolator_ = new TimestampExtrapolator(clock_->TimeInMilliseconds()); | 42 ts_extrapolator_ = new TimestampExtrapolator(clock_->TimeInMilliseconds()); |
| 42 } else { | 43 } else { |
| 43 ts_extrapolator_ = master_timing->ts_extrapolator_; | 44 ts_extrapolator_ = master_timing->ts_extrapolator_; |
| 44 } | 45 } |
| 45 } | 46 } |
| 46 | 47 |
| 47 VCMTiming::~VCMTiming() { | 48 VCMTiming::~VCMTiming() { |
| 48 UpdateHistograms(); | 49 UpdateHistograms(); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 *decode_ms = last_decode_ms_; | 298 *decode_ms = last_decode_ms_; |
| 298 *max_decode_ms = RequiredDecodeTimeMs(); | 299 *max_decode_ms = RequiredDecodeTimeMs(); |
| 299 *current_delay_ms = current_delay_ms_; | 300 *current_delay_ms = current_delay_ms_; |
| 300 *target_delay_ms = TargetDelayInternal(); | 301 *target_delay_ms = TargetDelayInternal(); |
| 301 *jitter_buffer_ms = jitter_delay_ms_; | 302 *jitter_buffer_ms = jitter_delay_ms_; |
| 302 *min_playout_delay_ms = min_playout_delay_ms_; | 303 *min_playout_delay_ms = min_playout_delay_ms_; |
| 303 *render_delay_ms = render_delay_ms_; | 304 *render_delay_ms = render_delay_ms_; |
| 304 return (num_decoded_frames_ > 0); | 305 return (num_decoded_frames_ > 0); |
| 305 } | 306 } |
| 306 | 307 |
| 308 void VCMTiming::SetTimingFrameInfo(const TimingFrameInfo& info) { |
| 309 rtc::CritScope cs(&crit_sect_); |
| 310 timing_frame_info_.emplace(info); |
| 311 } |
| 312 |
| 313 rtc::Optional<TimingFrameInfo> VCMTiming::GetTimingFrameInfo() { |
| 314 rtc::CritScope cs(&crit_sect_); |
| 315 return timing_frame_info_; |
| 316 } |
| 317 |
| 307 } // namespace webrtc | 318 } // namespace webrtc |
| OLD | NEW |