OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // Gets the frame assigned to the timestamp of the packet. May recycle | 199 // Gets the frame assigned to the timestamp of the packet. May recycle |
200 // existing frames if no free frames are available. Returns an error code if | 200 // existing frames if no free frames are available. Returns an error code if |
201 // failing, or kNoError on success. |frame_list| contains which list the | 201 // failing, or kNoError on success. |frame_list| contains which list the |
202 // packet was in, or NULL if it was not in a FrameList (a new frame). | 202 // packet was in, or NULL if it was not in a FrameList (a new frame). |
203 VCMFrameBufferEnum GetFrame(const VCMPacket& packet, | 203 VCMFrameBufferEnum GetFrame(const VCMPacket& packet, |
204 VCMFrameBuffer** frame, | 204 VCMFrameBuffer** frame, |
205 FrameList** frame_list) | 205 FrameList** frame_list) |
206 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 206 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
207 | 207 |
208 // Returns true if |frame| is continuous in |decoding_state|, not taking | 208 // Returns true if |frame| is continuous in |decoding_state|, not taking |
209 // decodable frames into account. | 209 // decodable frames into account and optionally ignoring |decode_error_mode|. |
210 bool IsContinuousInState(const VCMFrameBuffer& frame, | 210 bool IsContinuousInState(const VCMFrameBuffer& frame, |
211 const VCMDecodingState& decoding_state) const | 211 const VCMDecodingState& decoding_state, |
| 212 bool ignore_error_mode) const |
212 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 213 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
213 // Returns true if |frame| is continuous in the |last_decoded_state_|, taking | 214 // Returns true if |frame| is continuous in the |last_decoded_state_|, taking |
214 // all decodable frames into account. | 215 // all decodable frames into account and optionally ignoring the |
215 bool IsContinuous(const VCMFrameBuffer& frame) const | 216 // |decode_error_mode|. |
| 217 bool IsContinuous(const VCMFrameBuffer& frame, bool ignore_error_mode) const |
216 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 218 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
217 // Looks for frames in |incomplete_frames_| which are continuous in the | 219 // Looks for frames in |incomplete_frames_| which are continuous in the |
218 // provided |decoded_state|. Starts the search from the timestamp of | 220 // provided |decoded_state|. Starts the search from the timestamp of |
219 // |decoded_state|. | 221 // |decoded_state|. |
220 void FindAndInsertContinuousFramesWithState( | 222 void FindAndInsertContinuousFramesWithState( |
221 const VCMDecodingState& decoded_state) | 223 const VCMDecodingState& decoded_state) |
222 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 224 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
223 // Looks for frames in |incomplete_frames_| which are continuous in | 225 // Looks for frames in |incomplete_frames_| which are continuous in |
224 // |last_decoded_state_| taking all decodable frames into account. Starts | 226 // |last_decoded_state_| taking all decodable frames into account. Starts |
225 // the search from |new_frame|. | 227 // the search from |new_frame|. |
226 void FindAndInsertContinuousFrames(const VCMFrameBuffer& new_frame) | 228 void FindAndInsertContinuousFrames(const VCMFrameBuffer& new_frame) |
227 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 229 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| 230 // Returns true if no continuous decodable frame has been received for too |
| 231 // long and NACKs are disabled, so a keyframe should be requested from the |
| 232 // sender. Ensures that keyframes are not requested too often. |
| 233 bool TooManyDiscontinuousFrames(int64_t now_ms) |
| 234 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
228 VCMFrameBuffer* NextFrame() const EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 235 VCMFrameBuffer* NextFrame() const EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
229 // Returns true if the NACK list was updated to cover sequence numbers up to | 236 // Returns true if the NACK list was updated to cover sequence numbers up to |
230 // |sequence_number|. If false a key frame is needed to get into a state where | 237 // |sequence_number|. If false a key frame is needed to get into a state where |
231 // we can continue decoding. | 238 // we can continue decoding. |
232 bool UpdateNackList(uint16_t sequence_number) | 239 bool UpdateNackList(uint16_t sequence_number) |
233 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 240 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
234 bool TooLargeNackList() const; | 241 bool TooLargeNackList() const; |
235 // Returns true if the NACK list was reduced without problem. If false a key | 242 // Returns true if the NACK list was reduced without problem. If false a key |
236 // frame is needed to get into a state where we can continue decoding. | 243 // frame is needed to get into a state where we can continue decoding. |
237 bool HandleTooLargeNackList() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 244 bool HandleTooLargeNackList() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // Number of frames in a row that have been too old. | 332 // Number of frames in a row that have been too old. |
326 int num_consecutive_old_frames_; | 333 int num_consecutive_old_frames_; |
327 // Number of packets in a row that have been too old. | 334 // Number of packets in a row that have been too old. |
328 int num_consecutive_old_packets_; | 335 int num_consecutive_old_packets_; |
329 // Number of packets received. | 336 // Number of packets received. |
330 int num_packets_ GUARDED_BY(crit_sect_); | 337 int num_packets_ GUARDED_BY(crit_sect_); |
331 // Number of duplicated packets received. | 338 // Number of duplicated packets received. |
332 int num_duplicated_packets_ GUARDED_BY(crit_sect_); | 339 int num_duplicated_packets_ GUARDED_BY(crit_sect_); |
333 // Number of packets discarded by the jitter buffer. | 340 // Number of packets discarded by the jitter buffer. |
334 int num_discarded_packets_ GUARDED_BY(crit_sect_); | 341 int num_discarded_packets_ GUARDED_BY(crit_sect_); |
| 342 // Time when last decodable frame was received. |
| 343 int64_t time_last_decodable_frame_ GUARDED_BY(crit_sect_); |
335 // Time when first packet is received. | 344 // Time when first packet is received. |
336 int64_t time_first_packet_ms_ GUARDED_BY(crit_sect_); | 345 int64_t time_first_packet_ms_ GUARDED_BY(crit_sect_); |
337 | 346 |
338 // Jitter estimation. | 347 // Jitter estimation. |
339 // Filter for estimating jitter. | 348 // Filter for estimating jitter. |
340 VCMJitterEstimator jitter_estimate_; | 349 VCMJitterEstimator jitter_estimate_; |
341 // Calculates network delays used for jitter calculations. | 350 // Calculates network delays used for jitter calculations. |
342 VCMInterFrameDelay inter_frame_delay_; | 351 VCMInterFrameDelay inter_frame_delay_; |
343 VCMJitterSample waiting_for_completion_; | 352 VCMJitterSample waiting_for_completion_; |
344 int64_t rtt_ms_; | 353 int64_t rtt_ms_; |
(...skipping 13 matching lines...) Expand all Loading... |
358 // Estimated rolling average of packets per frame | 367 // Estimated rolling average of packets per frame |
359 float average_packets_per_frame_; | 368 float average_packets_per_frame_; |
360 // average_packets_per_frame converges fast if we have fewer than this many | 369 // average_packets_per_frame converges fast if we have fewer than this many |
361 // frames. | 370 // frames. |
362 int frame_counter_; | 371 int frame_counter_; |
363 DISALLOW_COPY_AND_ASSIGN(VCMJitterBuffer); | 372 DISALLOW_COPY_AND_ASSIGN(VCMJitterBuffer); |
364 }; | 373 }; |
365 } // namespace webrtc | 374 } // namespace webrtc |
366 | 375 |
367 #endif // WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_JITTER_BUFFER_H_ | 376 #endif // WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_JITTER_BUFFER_H_ |
OLD | NEW |