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}
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index 0fcd842..592d284 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -1978,6 +1978,8 @@
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 @@
if (packet->priority.codec_level > 0) {
stats_.SecondaryDecodedSamples(rtc::checked_cast<int>(packet_duration));
}
- } else if (!decoder_database_->IsComfortNoise(packet->payload_type)) {
+ } else if (!has_cng_packet) {
LOG(LS_WARNING) << "Unknown payload type "
<< static_cast<int>(packet->payload_type);
RTC_NOTREACHED();
@@ -2005,7 +2007,8 @@
// 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 ||