NetEq: only update current_rtp_payload_type_ when validated
The current_rtp_payload_type_ should only be updated when the packet is
actually inserted into the packet buffer, since then the payload type
has been validated. This CL removes an unvalidated setting of this value
that happened after SSRC change or upon first packet.
BUG=webrtc:5447
Review-Url: https://codereview.webrtc.org/2270793003
Cr-Commit-Position: refs/heads/master@{#13910}
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index e65466f..78e3112 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -598,7 +598,6 @@
// Update codecs.
timestamp_ = main_header.timestamp;
- current_rtp_payload_type_ = main_header.payloadType;
// Reset timestamp scaling.
timestamp_scaler_->Reset();
@@ -744,13 +743,10 @@
new_codec_ = true;
}
- if (current_rtp_payload_type_ != 0xFF) {
- const DecoderDatabase::DecoderInfo* dec_info =
- decoder_database_->GetDecoderInfo(current_rtp_payload_type_);
- if (!dec_info) {
- assert(false); // Already checked that the payload type is known.
- }
- }
+ RTC_DCHECK(current_rtp_payload_type_ == 0xFF ||
+ decoder_database_->GetDecoderInfo(current_rtp_payload_type_))
+ << "Payload type " << static_cast<int>(current_rtp_payload_type_)
+ << " is unknown where it shouldn't be";
if (update_sample_rate_and_channels && !packet_buffer_->Empty()) {
// We do not use |current_rtp_payload_type_| to |set payload_type|, but