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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
166 } else { | 166 } else { |
167 current_delay_ms_ = target_delay_ms; | 167 current_delay_ms_ = target_delay_ms; |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 int32_t VCMTiming::StopDecodeTimer(uint32_t time_stamp, | 171 int32_t VCMTiming::StopDecodeTimer(uint32_t time_stamp, |
172 int32_t decode_time_ms, | 172 int32_t decode_time_ms, |
173 int64_t now_ms, | 173 int64_t now_ms, |
174 int64_t render_time_ms) { | 174 int64_t render_time_ms) { |
175 CriticalSectionScoped cs(crit_sect_); | 175 CriticalSectionScoped cs(crit_sect_); |
176 codec_timer_.MaxFilter(decode_time_ms, now_ms); | 176 codec_timer_.AddTiming(decode_time_ms, now_ms); |
177 assert(decode_time_ms >= 0); | 177 assert(decode_time_ms >= 0); |
178 last_decode_ms_ = decode_time_ms; | 178 last_decode_ms_ = decode_time_ms; |
179 | 179 |
180 // Update stats. | 180 // Update stats. |
181 ++num_decoded_frames_; | 181 ++num_decoded_frames_; |
182 if (num_decoded_frames_ == 1) { | 182 if (num_decoded_frames_ == 1) { |
183 first_decoded_frame_ms_ = now_ms; | 183 first_decoded_frame_ms_ = now_ms; |
184 } | 184 } |
185 int time_until_rendering_ms = render_time_ms - render_delay_ms_ - now_ms; | 185 int time_until_rendering_ms = render_time_ms - render_delay_ms_ - now_ms; |
186 if (time_until_rendering_ms < 0) { | 186 if (time_until_rendering_ms < 0) { |
(...skipping 22 matching lines...) Expand all Loading... | |
209 if (estimated_complete_time_ms == -1) { | 209 if (estimated_complete_time_ms == -1) { |
210 estimated_complete_time_ms = now_ms; | 210 estimated_complete_time_ms = now_ms; |
211 } | 211 } |
212 | 212 |
213 // Make sure that we have at least the playout delay. | 213 // Make sure that we have at least the playout delay. |
214 uint32_t actual_delay = std::max(current_delay_ms_, min_playout_delay_ms_); | 214 uint32_t actual_delay = std::max(current_delay_ms_, min_playout_delay_ms_); |
215 return estimated_complete_time_ms + actual_delay; | 215 return estimated_complete_time_ms + actual_delay; |
216 } | 216 } |
217 | 217 |
218 // Must be called from inside a critical section. | 218 // Must be called from inside a critical section. |
219 int32_t VCMTiming::MaxDecodeTimeMs( | 219 int32_t VCMTiming::MaxDecodeTimeMs( |
magjed_webrtc
2016/03/04 14:19:41
Do you want me to change this function name as wel
philipel
2016/03/04 15:20:13
Yes, RequiredDecodeTimeMs should work here as well
| |
220 FrameType frame_type /*= kVideoFrameDelta*/) const { | 220 FrameType frame_type /*= kVideoFrameDelta*/) const { |
221 const int32_t decode_time_ms = codec_timer_.RequiredDecodeTimeMs(frame_type); | 221 const int32_t decode_time_ms = codec_timer_.RequiredDecodeTimeMs(); |
222 assert(decode_time_ms >= 0); | 222 assert(decode_time_ms >= 0); |
223 return decode_time_ms; | 223 return decode_time_ms; |
224 } | 224 } |
225 | 225 |
226 uint32_t VCMTiming::MaxWaitingTime(int64_t render_time_ms, | 226 uint32_t VCMTiming::MaxWaitingTime(int64_t render_time_ms, |
227 int64_t now_ms) const { | 227 int64_t now_ms) const { |
228 CriticalSectionScoped cs(crit_sect_); | 228 CriticalSectionScoped cs(crit_sect_); |
229 | 229 |
230 const int64_t max_wait_time_ms = | 230 const int64_t max_wait_time_ms = |
231 render_time_ms - now_ms - MaxDecodeTimeMs() - render_delay_ms_; | 231 render_time_ms - now_ms - MaxDecodeTimeMs() - render_delay_ms_; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
275 *decode_ms = last_decode_ms_; | 275 *decode_ms = last_decode_ms_; |
276 *max_decode_ms = MaxDecodeTimeMs(); | 276 *max_decode_ms = MaxDecodeTimeMs(); |
277 *current_delay_ms = current_delay_ms_; | 277 *current_delay_ms = current_delay_ms_; |
278 *target_delay_ms = TargetDelayInternal(); | 278 *target_delay_ms = TargetDelayInternal(); |
279 *jitter_buffer_ms = jitter_delay_ms_; | 279 *jitter_buffer_ms = jitter_delay_ms_; |
280 *min_playout_delay_ms = min_playout_delay_ms_; | 280 *min_playout_delay_ms = min_playout_delay_ms_; |
281 *render_delay_ms = render_delay_ms_; | 281 *render_delay_ms = render_delay_ms_; |
282 } | 282 } |
283 | 283 |
284 } // namespace webrtc | 284 } // namespace webrtc |
OLD | NEW |