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 |
(...skipping 23 matching lines...) Expand all Loading... | |
34 void Reset(); | 34 void Reset(); |
35 void ResetDecodeTime(); | 35 void ResetDecodeTime(); |
36 | 36 |
37 // Set the amount of time needed to render an image. Defaults to 10 ms. | 37 // Set the amount of time needed to render an image. Defaults to 10 ms. |
38 void set_render_delay(uint32_t render_delay_ms); | 38 void set_render_delay(uint32_t render_delay_ms); |
39 | 39 |
40 // Set the minimum time the video must be delayed on the receiver to | 40 // Set the minimum time the video must be delayed on the receiver to |
41 // get the desired jitter buffer level. | 41 // get the desired jitter buffer level. |
42 void SetJitterDelay(uint32_t required_delay_ms); | 42 void SetJitterDelay(uint32_t required_delay_ms); |
43 | 43 |
44 // Set the minimum playout delay required to sync video with audio. | 44 // Set the minimum playout delay from capture to render in ms. |
45 void set_min_playout_delay(uint32_t min_playout_delay); | 45 void set_min_playout_delay(uint32_t min_playout_delay_ms); |
stefan-webrtc
2016/05/28 05:01:45
I'd prefer these to all be ints instead since it d
Irfan
2016/06/01 08:38:33
I cleaned up all the delay variables here alongsid
| |
46 | |
47 // Returns the minimum playout delay from capture to render in ms. | |
48 uint32_t min_playout_delay(); | |
49 | |
50 // Set the maximum playout delay from capture to render in ms. | |
51 void set_max_playout_delay(uint32_t max_playout_delay_ms); | |
52 | |
53 // Returns the maximum playout delay from capture to render in ms. | |
54 uint32_t max_playout_delay(); | |
46 | 55 |
47 // Increases or decreases the current delay to get closer to the target delay. | 56 // Increases or decreases the current delay to get closer to the target delay. |
48 // Calculates how long it has been since the previous call to this function, | 57 // Calculates how long it has been since the previous call to this function, |
49 // and increases/decreases the delay in proportion to the time difference. | 58 // and increases/decreases the delay in proportion to the time difference. |
50 void UpdateCurrentDelay(uint32_t frame_timestamp); | 59 void UpdateCurrentDelay(uint32_t frame_timestamp); |
51 | 60 |
52 // Increases or decreases the current delay to get closer to the target delay. | 61 // Increases or decreases the current delay to get closer to the target delay. |
53 // Given the actual decode time in ms and the render time in ms for a frame, | 62 // Given the actual decode time in ms and the render time in ms for a frame, |
54 // this function calculates how late the frame is and increases the delay | 63 // this function calculates how late the frame is and increases the delay |
55 // accordingly. | 64 // accordingly. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 | 113 |
105 private: | 114 private: |
106 void UpdateHistograms() const; | 115 void UpdateHistograms() const; |
107 | 116 |
108 CriticalSectionWrapper* crit_sect_; | 117 CriticalSectionWrapper* crit_sect_; |
109 Clock* const clock_; | 118 Clock* const clock_; |
110 bool master_ GUARDED_BY(crit_sect_); | 119 bool master_ GUARDED_BY(crit_sect_); |
111 TimestampExtrapolator* ts_extrapolator_ GUARDED_BY(crit_sect_); | 120 TimestampExtrapolator* ts_extrapolator_ GUARDED_BY(crit_sect_); |
112 std::unique_ptr<VCMCodecTimer> codec_timer_ GUARDED_BY(crit_sect_); | 121 std::unique_ptr<VCMCodecTimer> codec_timer_ GUARDED_BY(crit_sect_); |
113 uint32_t render_delay_ms_ GUARDED_BY(crit_sect_); | 122 uint32_t render_delay_ms_ GUARDED_BY(crit_sect_); |
123 // Best-effort playout delay range for frames from capture to render. | |
124 // The receiver tries to keep the delay between |min_playout_delay_ms_| | |
125 // and |max_playout_delay_ms_| taking the network jitter into account. | |
126 // A special case is where min_playout_delay_ms_ = max_playout_delay_ms_ = 0, | |
127 // in which case the receiver tries to play the frames as they arrive. | |
114 uint32_t min_playout_delay_ms_ GUARDED_BY(crit_sect_); | 128 uint32_t min_playout_delay_ms_ GUARDED_BY(crit_sect_); |
129 uint32_t max_playout_delay_ms_ GUARDED_BY(crit_sect_); | |
115 uint32_t jitter_delay_ms_ GUARDED_BY(crit_sect_); | 130 uint32_t jitter_delay_ms_ GUARDED_BY(crit_sect_); |
116 uint32_t current_delay_ms_ GUARDED_BY(crit_sect_); | 131 uint32_t current_delay_ms_ GUARDED_BY(crit_sect_); |
117 int last_decode_ms_ GUARDED_BY(crit_sect_); | 132 int last_decode_ms_ GUARDED_BY(crit_sect_); |
118 uint32_t prev_frame_timestamp_ GUARDED_BY(crit_sect_); | 133 uint32_t prev_frame_timestamp_ GUARDED_BY(crit_sect_); |
119 | 134 |
120 // Statistics. | 135 // Statistics. |
121 size_t num_decoded_frames_ GUARDED_BY(crit_sect_); | 136 size_t num_decoded_frames_ GUARDED_BY(crit_sect_); |
122 size_t num_delayed_decoded_frames_ GUARDED_BY(crit_sect_); | 137 size_t num_delayed_decoded_frames_ GUARDED_BY(crit_sect_); |
123 int64_t first_decoded_frame_ms_ GUARDED_BY(crit_sect_); | 138 int64_t first_decoded_frame_ms_ GUARDED_BY(crit_sect_); |
124 uint64_t sum_missed_render_deadline_ms_ GUARDED_BY(crit_sect_); | 139 uint64_t sum_missed_render_deadline_ms_ GUARDED_BY(crit_sect_); |
125 }; | 140 }; |
126 } // namespace webrtc | 141 } // namespace webrtc |
127 | 142 |
128 #endif // WEBRTC_MODULES_VIDEO_CODING_TIMING_H_ | 143 #endif // WEBRTC_MODULES_VIDEO_CODING_TIMING_H_ |
OLD | NEW |