Index: webrtc/modules/audio_coding/acm2/audio_coding_module_impl.cc |
diff --git a/webrtc/modules/audio_coding/acm2/audio_coding_module_impl.cc b/webrtc/modules/audio_coding/acm2/audio_coding_module_impl.cc |
index f00b2432f2430a47bfb67be58c276539107f9a53..1a1ae37a8a38da869caa30fc78539ccb49c11028 100644 |
--- a/webrtc/modules/audio_coding/acm2/audio_coding_module_impl.cc |
+++ b/webrtc/modules/audio_coding/acm2/audio_coding_module_impl.cc |
@@ -719,10 +719,12 @@ int AudioCodingModuleImpl::RegisterReceiveCodecUnlocked( |
AudioDecoder* isac_decoder = nullptr; |
if (STR_CASE_CMP(codec.plname, "isac") == 0) { |
- if (!isac_decoder_) { |
- isac_decoder_ = isac_factory(); |
+ std::unique_ptr<AudioDecoder>& saved_isac_decoder = |
+ codec.plfreq == 16000 ? isac_decoder_16k_ : isac_decoder_32k_; |
+ if (!saved_isac_decoder) { |
+ saved_isac_decoder = isac_factory(); |
} |
- isac_decoder = isac_decoder_.get(); |
+ isac_decoder = saved_isac_decoder.get(); |
} |
return receiver_.AddCodec(*codec_index, codec.pltype, codec.channels, |
codec.plfreq, isac_decoder, codec.plname); |