From cafb497cc14e0f6d1933b8b8814d886081eb8788 Mon Sep 17 00:00:00 2001 From: ossu Date: Mon, 2 Jan 2017 07:00:50 -0800 Subject: [PATCH] Limit NetEqImpl::ExtractPackets to returning one CNG packet BUG=chromium:668834 Review-Url: https://codereview.webrtc.org/2609043002 Cr-Commit-Position: refs/heads/master@{#15868} --- webrtc/modules/audio_coding/neteq/neteq_impl.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc index 0fcd842817..592d2844e1 100644 --- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc +++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc @@ -1978,6 +1978,8 @@ int NetEqImpl::ExtractPackets(size_t required_samples, prev_payload_type = packet->payload_type; } + const bool has_cng_packet = + decoder_database_->IsComfortNoise(packet->payload_type); // Store number of extracted samples. size_t packet_duration = 0; if (packet->frame) { @@ -1986,7 +1988,7 @@ int NetEqImpl::ExtractPackets(size_t required_samples, if (packet->priority.codec_level > 0) { stats_.SecondaryDecodedSamples(rtc::checked_cast(packet_duration)); } - } else if (!decoder_database_->IsComfortNoise(packet->payload_type)) { + } else if (!has_cng_packet) { LOG(LS_WARNING) << "Unknown payload type " << static_cast(packet->payload_type); RTC_NOTREACHED(); @@ -2005,7 +2007,8 @@ int NetEqImpl::ExtractPackets(size_t required_samples, // Check what packet is available next. next_packet = packet_buffer_->PeekNextPacket(); next_packet_available = false; - if (next_packet && prev_payload_type == next_packet->payload_type) { + if (next_packet && prev_payload_type == next_packet->payload_type && + !has_cng_packet) { int16_t seq_no_diff = next_packet->sequence_number - prev_sequence_number; size_t ts_diff = next_packet->timestamp - prev_timestamp; if (seq_no_diff == 1 ||