Revert of AcmReceiver::DecoderByPayloadType: Ask NetEq for decoder (patchset #1 id:1 of https://codereview.webrtc.org/2341283002/ )
Reason for revert:
Seems to have broken Chromium tests.
Original issue's description:
> AcmReceiver::DecoderByPayloadType: Ask NetEq for decoder
>
> Instead of looking in AcmReceiver::decoders_, which we're trying to
> get rid of.
>
> BUG=webrtc:5801
>
> Committed: https://crrev.com/07772e4738ef8007280f97a0245eef34b9ca9391
> Cr-Commit-Position: refs/heads/master@{#14276}
TBR=ossu@webrtc.org,henrik.lundin@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5801
Review-Url: https://codereview.webrtc.org/2346173002
Cr-Commit-Position: refs/heads/master@{#14277}
diff --git a/webrtc/modules/audio_coding/acm2/acm_receiver.cc b/webrtc/modules/audio_coding/acm2/acm_receiver.cc
index 042e8c9..b89091f 100644
--- a/webrtc/modules/audio_coding/acm2/acm_receiver.cc
+++ b/webrtc/modules/audio_coding/acm2/acm_receiver.cc
@@ -314,15 +314,19 @@
int AcmReceiver::DecoderByPayloadType(uint8_t payload_type,
CodecInst* codec) const {
rtc::CritScope lock(&crit_sect_);
- const rtc::Optional<CodecInst> ci = neteq_->GetDecoder(payload_type);
- if (ci) {
- *codec = *ci;
- return 0;
- } else {
+ auto it = decoders_.find(payload_type);
+ if (it == decoders_.end()) {
LOG(LERROR) << "AcmReceiver::DecoderByPayloadType "
<< static_cast<int>(payload_type);
return -1;
}
+ const Decoder& decoder = it->second;
+ *codec = *RentACodec::CodecInstById(
+ *RentACodec::CodecIdFromIndex(decoder.acm_codec_id));
+ codec->pltype = decoder.payload_type;
+ codec->channels = decoder.channels;
+ codec->plfreq = decoder.sample_rate_hz;
+ return 0;
}
int AcmReceiver::EnableNack(size_t max_nack_list_size) {