| 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 #ifndef WEBRTC_MODULES_VIDEO_CODING_TIMING_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_TIMING_H_ |
| 12 #define WEBRTC_MODULES_VIDEO_CODING_TIMING_H_ | 12 #define WEBRTC_MODULES_VIDEO_CODING_TIMING_H_ |
| 13 | 13 |
| 14 #include <memory> |
| 15 |
| 14 #include "webrtc/base/thread_annotations.h" | 16 #include "webrtc/base/thread_annotations.h" |
| 15 #include "webrtc/modules/video_coding/codec_timer.h" | 17 #include "webrtc/modules/video_coding/codec_timer.h" |
| 16 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 18 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
| 17 #include "webrtc/typedefs.h" | 19 #include "webrtc/typedefs.h" |
| 18 | 20 |
| 19 namespace webrtc { | 21 namespace webrtc { |
| 20 | 22 |
| 21 class Clock; | 23 class Clock; |
| 22 class TimestampExtrapolator; | 24 class TimestampExtrapolator; |
| 23 | 25 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 int* current_delay_ms, | 89 int* current_delay_ms, |
| 88 int* target_delay_ms, | 90 int* target_delay_ms, |
| 89 int* jitter_buffer_ms, | 91 int* jitter_buffer_ms, |
| 90 int* min_playout_delay_ms, | 92 int* min_playout_delay_ms, |
| 91 int* render_delay_ms) const; | 93 int* render_delay_ms) const; |
| 92 | 94 |
| 93 enum { kDefaultRenderDelayMs = 10 }; | 95 enum { kDefaultRenderDelayMs = 10 }; |
| 94 enum { kDelayMaxChangeMsPerS = 100 }; | 96 enum { kDelayMaxChangeMsPerS = 100 }; |
| 95 | 97 |
| 96 protected: | 98 protected: |
| 97 int32_t MaxDecodeTimeMs(FrameType frame_type = kVideoFrameDelta) const | 99 int64_t RequiredDecodeTimeMs() const |
| 98 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 100 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| 99 int64_t RenderTimeMsInternal(uint32_t frame_timestamp, int64_t now_ms) const | 101 int64_t RenderTimeMsInternal(uint32_t frame_timestamp, int64_t now_ms) const |
| 100 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 102 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| 101 uint32_t TargetDelayInternal() const EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 103 uint32_t TargetDelayInternal() const EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| 102 | 104 |
| 103 private: | 105 private: |
| 104 void UpdateHistograms() const; | 106 void UpdateHistograms() const; |
| 105 | 107 |
| 106 CriticalSectionWrapper* crit_sect_; | 108 CriticalSectionWrapper* crit_sect_; |
| 107 Clock* const clock_; | 109 Clock* const clock_; |
| 108 bool master_ GUARDED_BY(crit_sect_); | 110 bool master_ GUARDED_BY(crit_sect_); |
| 109 TimestampExtrapolator* ts_extrapolator_ GUARDED_BY(crit_sect_); | 111 TimestampExtrapolator* ts_extrapolator_ GUARDED_BY(crit_sect_); |
| 110 VCMCodecTimer codec_timer_ GUARDED_BY(crit_sect_); | 112 std::unique_ptr<VCMCodecTimer> codec_timer_ GUARDED_BY(crit_sect_); |
| 111 uint32_t render_delay_ms_ GUARDED_BY(crit_sect_); | 113 uint32_t render_delay_ms_ GUARDED_BY(crit_sect_); |
| 112 uint32_t min_playout_delay_ms_ GUARDED_BY(crit_sect_); | 114 uint32_t min_playout_delay_ms_ GUARDED_BY(crit_sect_); |
| 113 uint32_t jitter_delay_ms_ GUARDED_BY(crit_sect_); | 115 uint32_t jitter_delay_ms_ GUARDED_BY(crit_sect_); |
| 114 uint32_t current_delay_ms_ GUARDED_BY(crit_sect_); | 116 uint32_t current_delay_ms_ GUARDED_BY(crit_sect_); |
| 115 int last_decode_ms_ GUARDED_BY(crit_sect_); | 117 int last_decode_ms_ GUARDED_BY(crit_sect_); |
| 116 uint32_t prev_frame_timestamp_ GUARDED_BY(crit_sect_); | 118 uint32_t prev_frame_timestamp_ GUARDED_BY(crit_sect_); |
| 117 | 119 |
| 118 // Statistics. | 120 // Statistics. |
| 119 size_t num_decoded_frames_ GUARDED_BY(crit_sect_); | 121 size_t num_decoded_frames_ GUARDED_BY(crit_sect_); |
| 120 size_t num_delayed_decoded_frames_ GUARDED_BY(crit_sect_); | 122 size_t num_delayed_decoded_frames_ GUARDED_BY(crit_sect_); |
| 121 int64_t first_decoded_frame_ms_ GUARDED_BY(crit_sect_); | 123 int64_t first_decoded_frame_ms_ GUARDED_BY(crit_sect_); |
| 122 uint64_t sum_missed_render_deadline_ms_ GUARDED_BY(crit_sect_); | 124 uint64_t sum_missed_render_deadline_ms_ GUARDED_BY(crit_sect_); |
| 123 }; | 125 }; |
| 124 } // namespace webrtc | 126 } // namespace webrtc |
| 125 | 127 |
| 126 #endif // WEBRTC_MODULES_VIDEO_CODING_TIMING_H_ | 128 #endif // WEBRTC_MODULES_VIDEO_CODING_TIMING_H_ |
| OLD | NEW |