OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 | 712 |
713 // Check if the payload-type is valid. | 713 // Check if the payload-type is valid. |
714 if (!RentACodec::IsPayloadTypeValid(codec.pltype)) { | 714 if (!RentACodec::IsPayloadTypeValid(codec.pltype)) { |
715 LOG_F(LS_ERROR) << "Invalid payload type " << codec.pltype << " for " | 715 LOG_F(LS_ERROR) << "Invalid payload type " << codec.pltype << " for " |
716 << codec.plname; | 716 << codec.plname; |
717 return -1; | 717 return -1; |
718 } | 718 } |
719 | 719 |
720 AudioDecoder* isac_decoder = nullptr; | 720 AudioDecoder* isac_decoder = nullptr; |
721 if (STR_CASE_CMP(codec.plname, "isac") == 0) { | 721 if (STR_CASE_CMP(codec.plname, "isac") == 0) { |
722 if (!isac_decoder_) { | 722 std::unique_ptr<AudioDecoder>& saved_isac_decoder = |
723 isac_decoder_ = isac_factory(); | 723 codec.plfreq == 16000 ? isac_decoder_16k_ : isac_decoder_32k_; |
| 724 if (!saved_isac_decoder) { |
| 725 saved_isac_decoder = isac_factory(); |
724 } | 726 } |
725 isac_decoder = isac_decoder_.get(); | 727 isac_decoder = saved_isac_decoder.get(); |
726 } | 728 } |
727 return receiver_.AddCodec(*codec_index, codec.pltype, codec.channels, | 729 return receiver_.AddCodec(*codec_index, codec.pltype, codec.channels, |
728 codec.plfreq, isac_decoder, codec.plname); | 730 codec.plfreq, isac_decoder, codec.plname); |
729 } | 731 } |
730 | 732 |
731 int AudioCodingModuleImpl::RegisterExternalReceiveCodec( | 733 int AudioCodingModuleImpl::RegisterExternalReceiveCodec( |
732 int rtp_payload_type, | 734 int rtp_payload_type, |
733 AudioDecoder* external_decoder, | 735 AudioDecoder* external_decoder, |
734 int sample_rate_hz, | 736 int sample_rate_hz, |
735 int num_channels, | 737 int num_channels, |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 return receiver_.LeastRequiredDelayMs(); | 938 return receiver_.LeastRequiredDelayMs(); |
937 } | 939 } |
938 | 940 |
939 void AudioCodingModuleImpl::GetDecodingCallStatistics( | 941 void AudioCodingModuleImpl::GetDecodingCallStatistics( |
940 AudioDecodingCallStats* call_stats) const { | 942 AudioDecodingCallStats* call_stats) const { |
941 receiver_.GetDecodingCallStatistics(call_stats); | 943 receiver_.GetDecodingCallStatistics(call_stats); |
942 } | 944 } |
943 | 945 |
944 } // namespace acm2 | 946 } // namespace acm2 |
945 } // namespace webrtc | 947 } // namespace webrtc |
OLD | NEW |