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

Side by Side Diff: webrtc/modules/audio_coding/neteq/delay_manager.cc

Issue 2870043003: Handle padded audio packets correctly (Closed)
Patch Set: const size_t Created 3 years, 7 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
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 10
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 } 367 }
368 368
369 void DelayManager::LastDecodedWasCngOrDtmf(bool it_was) { 369 void DelayManager::LastDecodedWasCngOrDtmf(bool it_was) {
370 if (it_was) { 370 if (it_was) {
371 last_pack_cng_or_dtmf_ = 1; 371 last_pack_cng_or_dtmf_ = 1;
372 } else if (last_pack_cng_or_dtmf_ != 0) { 372 } else if (last_pack_cng_or_dtmf_ != 0) {
373 last_pack_cng_or_dtmf_ = -1; 373 last_pack_cng_or_dtmf_ = -1;
374 } 374 }
375 } 375 }
376 376
377 void DelayManager::RegisterEmptyPacket() {
378 ++last_seq_no_;
379 }
380
377 bool DelayManager::SetMinimumDelay(int delay_ms) { 381 bool DelayManager::SetMinimumDelay(int delay_ms) {
378 // Minimum delay shouldn't be more than maximum delay, if any maximum is set. 382 // Minimum delay shouldn't be more than maximum delay, if any maximum is set.
379 // Also, if possible check |delay| to less than 75% of 383 // Also, if possible check |delay| to less than 75% of
380 // |max_packets_in_buffer_|. 384 // |max_packets_in_buffer_|.
381 if ((maximum_delay_ms_ > 0 && delay_ms > maximum_delay_ms_) || 385 if ((maximum_delay_ms_ > 0 && delay_ms > maximum_delay_ms_) ||
382 (packet_len_ms_ > 0 && 386 (packet_len_ms_ > 0 &&
383 delay_ms > 387 delay_ms >
384 static_cast<int>(3 * max_packets_in_buffer_ * packet_len_ms_ / 4))) { 388 static_cast<int>(3 * max_packets_in_buffer_ * packet_len_ms_ / 4))) {
385 return false; 389 return false;
386 } 390 }
(...skipping 21 matching lines...) Expand all
408 int DelayManager::base_target_level() const { return base_target_level_; } 412 int DelayManager::base_target_level() const { return base_target_level_; }
409 void DelayManager::set_streaming_mode(bool value) { streaming_mode_ = value; } 413 void DelayManager::set_streaming_mode(bool value) { streaming_mode_ = value; }
410 int DelayManager::last_pack_cng_or_dtmf() const { 414 int DelayManager::last_pack_cng_or_dtmf() const {
411 return last_pack_cng_or_dtmf_; 415 return last_pack_cng_or_dtmf_;
412 } 416 }
413 417
414 void DelayManager::set_last_pack_cng_or_dtmf(int value) { 418 void DelayManager::set_last_pack_cng_or_dtmf(int value) {
415 last_pack_cng_or_dtmf_ = value; 419 last_pack_cng_or_dtmf_ = value;
416 } 420 }
417 } // namespace webrtc 421 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/delay_manager.h ('k') | webrtc/modules/audio_coding/neteq/delay_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698