Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: webrtc/modules/video_coding/jitter_buffer.cc

Issue 2073073003: Remove some dead code from VCMJitterBuffer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/video_coding/jitter_buffer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "webrtc/modules/video_coding/jitter_buffer.h" 10 #include "webrtc/modules/video_coding/jitter_buffer.h"
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 } else { 468 } else {
469 // No frames since last call 469 // No frames since last call
470 time_last_incoming_frame_count_ = clock_->TimeInMilliseconds(); 470 time_last_incoming_frame_count_ = clock_->TimeInMilliseconds();
471 *framerate = 0; 471 *framerate = 0;
472 *bitrate = 0; 472 *bitrate = 0;
473 incoming_frame_rate_ = 0; 473 incoming_frame_rate_ = 0;
474 incoming_bit_rate_ = 0; 474 incoming_bit_rate_ = 0;
475 } 475 }
476 } 476 }
477 477
478 // Answers the question:
479 // Will the packet sequence be complete if the next frame is grabbed for
480 // decoding right now? That is, have we lost a frame between the last decoded
481 // frame and the next, or is the next
482 // frame missing one or more packets?
483 bool VCMJitterBuffer::CompleteSequenceWithNextFrame() {
484 CriticalSectionScoped cs(crit_sect_);
485 // Finding oldest frame ready for decoder, check sequence number and size
486 CleanUpOldOrEmptyFrames();
487 if (!decodable_frames_.empty()) {
488 if (decodable_frames_.Front()->GetState() == kStateComplete) {
489 return true;
490 }
491 } else if (incomplete_frames_.size() <= 1) {
492 // Frame not ready to be decoded.
493 return true;
494 }
495 return false;
496 }
497
498 // Returns immediately or a |max_wait_time_ms| ms event hang waiting for a 478 // Returns immediately or a |max_wait_time_ms| ms event hang waiting for a
499 // complete frame, |max_wait_time_ms| decided by caller. 479 // complete frame, |max_wait_time_ms| decided by caller.
500 VCMEncodedFrame* VCMJitterBuffer::NextCompleteFrame(uint32_t max_wait_time_ms) { 480 VCMEncodedFrame* VCMJitterBuffer::NextCompleteFrame(uint32_t max_wait_time_ms) {
501 crit_sect_->Enter(); 481 crit_sect_->Enter();
502 if (!running_) { 482 if (!running_) {
503 crit_sect_->Leave(); 483 crit_sect_->Leave();
504 return nullptr; 484 return nullptr;
505 } 485 }
506 CleanUpOldOrEmptyFrames(); 486 CleanUpOldOrEmptyFrames();
507 487
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 1164
1185 void VCMJitterBuffer::DropPacketsFromNackList( 1165 void VCMJitterBuffer::DropPacketsFromNackList(
1186 uint16_t last_decoded_sequence_number) { 1166 uint16_t last_decoded_sequence_number) {
1187 // Erase all sequence numbers from the NACK list which we won't need any 1167 // Erase all sequence numbers from the NACK list which we won't need any
1188 // longer. 1168 // longer.
1189 missing_sequence_numbers_.erase( 1169 missing_sequence_numbers_.erase(
1190 missing_sequence_numbers_.begin(), 1170 missing_sequence_numbers_.begin(),
1191 missing_sequence_numbers_.upper_bound(last_decoded_sequence_number)); 1171 missing_sequence_numbers_.upper_bound(last_decoded_sequence_number));
1192 } 1172 }
1193 1173
1194 int64_t VCMJitterBuffer::LastDecodedTimestamp() const {
1195 CriticalSectionScoped cs(crit_sect_);
1196 return last_decoded_state_.time_stamp();
1197 }
1198
1199 void VCMJitterBuffer::RegisterStatsCallback( 1174 void VCMJitterBuffer::RegisterStatsCallback(
1200 VCMReceiveStatisticsCallback* callback) { 1175 VCMReceiveStatisticsCallback* callback) {
1201 CriticalSectionScoped cs(crit_sect_); 1176 CriticalSectionScoped cs(crit_sect_);
1202 stats_callback_ = callback; 1177 stats_callback_ = callback;
1203 } 1178 }
1204 1179
1205 VCMFrameBuffer* VCMJitterBuffer::GetEmptyFrame() { 1180 VCMFrameBuffer* VCMJitterBuffer::GetEmptyFrame() {
1206 if (free_frames_.empty()) { 1181 if (free_frames_.empty()) {
1207 if (!TryToIncreaseJitterBufferSize()) { 1182 if (!TryToIncreaseJitterBufferSize()) {
1208 return NULL; 1183 return NULL;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 if (nack_module_) 1355 if (nack_module_)
1381 return nack_module_->TimeUntilNextProcess(); 1356 return nack_module_->TimeUntilNextProcess();
1382 return std::numeric_limits<int64_t>::max(); 1357 return std::numeric_limits<int64_t>::max();
1383 } 1358 }
1384 1359
1385 void VCMJitterBuffer::Process() { 1360 void VCMJitterBuffer::Process() {
1386 if (nack_module_) 1361 if (nack_module_)
1387 nack_module_->Process(); 1362 nack_module_->Process();
1388 } 1363 }
1389 } // namespace webrtc 1364 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/jitter_buffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698