| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 bool MissingTooOldPacket(uint16_t latest_sequence_number) const | 254 bool MissingTooOldPacket(uint16_t latest_sequence_number) const |
| 255 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 255 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| 256 // Returns true if the too old packets was successfully removed from the NACK | 256 // Returns true if the too old packets was successfully removed from the NACK |
| 257 // list. If false, a key frame is needed to get into a state where we can | 257 // list. If false, a key frame is needed to get into a state where we can |
| 258 // continue decoding. | 258 // continue decoding. |
| 259 bool HandleTooOldPackets(uint16_t latest_sequence_number) | 259 bool HandleTooOldPackets(uint16_t latest_sequence_number) |
| 260 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 260 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| 261 // Drops all packets in the NACK list up until |last_decoded_sequence_number|. | 261 // Drops all packets in the NACK list up until |last_decoded_sequence_number|. |
| 262 void DropPacketsFromNackList(uint16_t last_decoded_sequence_number); | 262 void DropPacketsFromNackList(uint16_t last_decoded_sequence_number); |
| 263 | 263 |
| 264 void ReleaseFrameIfNotDecoding(VCMFrameBuffer* frame); | |
| 265 | |
| 266 // Gets an empty frame, creating a new frame if necessary (i.e. increases | 264 // Gets an empty frame, creating a new frame if necessary (i.e. increases |
| 267 // jitter buffer size). | 265 // jitter buffer size). |
| 268 VCMFrameBuffer* GetEmptyFrame() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 266 VCMFrameBuffer* GetEmptyFrame() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| 269 | 267 |
| 270 // Attempts to increase the size of the jitter buffer. Returns true on | 268 // Attempts to increase the size of the jitter buffer. Returns true on |
| 271 // success, false otherwise. | 269 // success, false otherwise. |
| 272 bool TryToIncreaseJitterBufferSize() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 270 bool TryToIncreaseJitterBufferSize() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| 273 | 271 |
| 274 // Recycles oldest frames until a key frame is found. Used if jitter buffer is | 272 // Recycles oldest frames until a key frame is found. Used if jitter buffer is |
| 275 // completely full. Returns true if a key frame was found. | 273 // completely full. Returns true if a key frame was found. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 303 | 301 |
| 304 // Returns true if we should wait for retransmissions, false otherwise. | 302 // Returns true if we should wait for retransmissions, false otherwise. |
| 305 bool WaitForRetransmissions(); | 303 bool WaitForRetransmissions(); |
| 306 | 304 |
| 307 int NonContinuousOrIncompleteDuration() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 305 int NonContinuousOrIncompleteDuration() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| 308 | 306 |
| 309 uint16_t EstimatedLowSequenceNumber(const VCMFrameBuffer& frame) const; | 307 uint16_t EstimatedLowSequenceNumber(const VCMFrameBuffer& frame) const; |
| 310 | 308 |
| 311 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 309 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| 312 | 310 |
| 311 // Reset frame buffer and return it to free_frames_. |
| 312 void RecycleFrameBuffer(VCMFrameBuffer* frame) |
| 313 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| 314 |
| 313 Clock* clock_; | 315 Clock* clock_; |
| 314 // If we are running (have started) or not. | 316 // If we are running (have started) or not. |
| 315 bool running_; | 317 bool running_; |
| 316 CriticalSectionWrapper* crit_sect_; | 318 CriticalSectionWrapper* crit_sect_; |
| 317 // Event to signal when we have a frame ready for decoder. | 319 // Event to signal when we have a frame ready for decoder. |
| 318 std::unique_ptr<EventWrapper> frame_event_; | 320 std::unique_ptr<EventWrapper> frame_event_; |
| 319 // Number of allocated frames. | 321 // Number of allocated frames. |
| 320 int max_number_of_frames_; | 322 int max_number_of_frames_; |
| 321 UnorderedFrameList free_frames_ GUARDED_BY(crit_sect_); | 323 UnorderedFrameList free_frames_ GUARDED_BY(crit_sect_); |
| 322 FrameList decodable_frames_ GUARDED_BY(crit_sect_); | 324 FrameList decodable_frames_ GUARDED_BY(crit_sect_); |
| 323 FrameList incomplete_frames_ GUARDED_BY(crit_sect_); | 325 FrameList incomplete_frames_ GUARDED_BY(crit_sect_); |
| 324 VCMDecodingState last_decoded_state_ GUARDED_BY(crit_sect_); | 326 VCMDecodingState last_decoded_state_ GUARDED_BY(crit_sect_); |
| 325 bool first_packet_since_reset_; | 327 bool first_packet_since_reset_; |
| 326 | 328 |
| 327 // Statistics. | 329 // Statistics. |
| 328 VCMReceiveStatisticsCallback* stats_callback_ GUARDED_BY(crit_sect_); | 330 VCMReceiveStatisticsCallback* stats_callback_ GUARDED_BY(crit_sect_); |
| 329 // Frame counts for each type (key, delta, ...) | 331 // Frame counts for each type (key, delta, ...) |
| 330 FrameCounts receive_statistics_; | 332 FrameCounts receive_statistics_; |
| 331 // Latest calculated frame rates of incoming stream. | 333 // Latest calculated frame rates of incoming stream. |
| 332 unsigned int incoming_frame_rate_; | 334 unsigned int incoming_frame_rate_; |
| 333 unsigned int incoming_frame_count_; | 335 unsigned int incoming_frame_count_; |
| 334 int64_t time_last_incoming_frame_count_; | 336 int64_t time_last_incoming_frame_count_; |
| 335 unsigned int incoming_bit_count_; | 337 unsigned int incoming_bit_count_; |
| 336 unsigned int incoming_bit_rate_; | 338 unsigned int incoming_bit_rate_; |
| 337 // Number of frames in a row that have been too old. | |
| 338 int num_consecutive_old_frames_; | |
| 339 // Number of packets in a row that have been too old. | 339 // Number of packets in a row that have been too old. |
| 340 int num_consecutive_old_packets_; | 340 int num_consecutive_old_packets_; |
| 341 // Number of packets received. | 341 // Number of packets received. |
| 342 int num_packets_ GUARDED_BY(crit_sect_); | 342 int num_packets_ GUARDED_BY(crit_sect_); |
| 343 // Number of duplicated packets received. | 343 // Number of duplicated packets received. |
| 344 int num_duplicated_packets_ GUARDED_BY(crit_sect_); | 344 int num_duplicated_packets_ GUARDED_BY(crit_sect_); |
| 345 // Number of packets discarded by the jitter buffer. | 345 // Number of packets discarded by the jitter buffer. |
| 346 int num_discarded_packets_ GUARDED_BY(crit_sect_); | 346 int num_discarded_packets_ GUARDED_BY(crit_sect_); |
| 347 // Time when first packet is received. | 347 // Time when first packet is received. |
| 348 int64_t time_first_packet_ms_ GUARDED_BY(crit_sect_); | 348 int64_t time_first_packet_ms_ GUARDED_BY(crit_sect_); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 371 float average_packets_per_frame_; | 371 float average_packets_per_frame_; |
| 372 // average_packets_per_frame converges fast if we have fewer than this many | 372 // average_packets_per_frame converges fast if we have fewer than this many |
| 373 // frames. | 373 // frames. |
| 374 int frame_counter_; | 374 int frame_counter_; |
| 375 | 375 |
| 376 RTC_DISALLOW_COPY_AND_ASSIGN(VCMJitterBuffer); | 376 RTC_DISALLOW_COPY_AND_ASSIGN(VCMJitterBuffer); |
| 377 }; | 377 }; |
| 378 } // namespace webrtc | 378 } // namespace webrtc |
| 379 | 379 |
| 380 #endif // WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_H_ | 380 #endif // WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_H_ |
| OLD | NEW |