OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 rtc::Optional<int> i = CodecIndexFromId(codec_id); | 100 rtc::Optional<int> i = CodecIndexFromId(codec_id); |
101 if (!i) | 101 if (!i) |
102 return rtc::Optional<NetEqDecoder>(); | 102 return rtc::Optional<NetEqDecoder>(); |
103 const NetEqDecoder ned = ACMCodecDB::neteq_decoders_[*i]; | 103 const NetEqDecoder ned = ACMCodecDB::neteq_decoders_[*i]; |
104 return rtc::Optional<NetEqDecoder>( | 104 return rtc::Optional<NetEqDecoder>( |
105 (ned == NetEqDecoder::kDecoderOpus && num_channels == 2) | 105 (ned == NetEqDecoder::kDecoderOpus && num_channels == 2) |
106 ? NetEqDecoder::kDecoderOpus_2ch | 106 ? NetEqDecoder::kDecoderOpus_2ch |
107 : ned); | 107 : ned); |
108 } | 108 } |
109 | 109 |
| 110 RentACodec::RegistrationResult RentACodec::RegisterCngPayloadType( |
| 111 std::map<int, int>* pt_map, |
| 112 const CodecInst& codec_inst) { |
| 113 if (STR_CASE_CMP(codec_inst.plname, "CN") != 0) |
| 114 return RegistrationResult::kSkip; |
| 115 switch (codec_inst.plfreq) { |
| 116 case 8000: |
| 117 case 16000: |
| 118 case 32000: |
| 119 case 48000: |
| 120 (*pt_map)[codec_inst.plfreq] = codec_inst.pltype; |
| 121 return RegistrationResult::kOk; |
| 122 default: |
| 123 return RegistrationResult::kBadFreq; |
| 124 } |
| 125 } |
| 126 |
| 127 RentACodec::RegistrationResult RentACodec::RegisterRedPayloadType( |
| 128 std::map<int, int>* pt_map, |
| 129 const CodecInst& codec_inst) { |
| 130 if (STR_CASE_CMP(codec_inst.plname, "RED") != 0) |
| 131 return RegistrationResult::kSkip; |
| 132 switch (codec_inst.plfreq) { |
| 133 case 8000: |
| 134 (*pt_map)[codec_inst.plfreq] = codec_inst.pltype; |
| 135 return RegistrationResult::kOk; |
| 136 default: |
| 137 return RegistrationResult::kBadFreq; |
| 138 } |
| 139 } |
| 140 |
110 namespace { | 141 namespace { |
111 | 142 |
112 // Returns a new speech encoder, or null on error. | 143 // Returns a new speech encoder, or null on error. |
113 // TODO(kwiberg): Don't handle errors here (bug 5033) | 144 // TODO(kwiberg): Don't handle errors here (bug 5033) |
114 rtc::scoped_ptr<AudioEncoder> CreateEncoder( | 145 rtc::scoped_ptr<AudioEncoder> CreateEncoder( |
115 const CodecInst& speech_inst, | 146 const CodecInst& speech_inst, |
116 LockedIsacBandwidthInfo* bwinfo) { | 147 LockedIsacBandwidthInfo* bwinfo) { |
117 #if defined(WEBRTC_CODEC_ISACFX) | 148 #if defined(WEBRTC_CODEC_ISACFX) |
118 if (STR_CASE_CMP(speech_inst.plname, "isac") == 0) | 149 if (STR_CASE_CMP(speech_inst.plname, "isac") == 0) |
119 return rtc_make_scoped_ptr(new AudioEncoderIsacFix(speech_inst, bwinfo)); | 150 return rtc_make_scoped_ptr(new AudioEncoderIsacFix(speech_inst, bwinfo)); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 } | 267 } |
237 | 268 |
238 AudioDecoder* RentACodec::RentIsacDecoder() { | 269 AudioDecoder* RentACodec::RentIsacDecoder() { |
239 if (!isac_decoder_) | 270 if (!isac_decoder_) |
240 isac_decoder_ = CreateIsacDecoder(&isac_bandwidth_info_); | 271 isac_decoder_ = CreateIsacDecoder(&isac_bandwidth_info_); |
241 return isac_decoder_.get(); | 272 return isac_decoder_.get(); |
242 } | 273 } |
243 | 274 |
244 } // namespace acm2 | 275 } // namespace acm2 |
245 } // namespace webrtc | 276 } // namespace webrtc |
OLD | NEW |