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