Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: webrtc/modules/audio_coding/main/acm2/rent_a_codec.cc

Issue 1450883002: Move CNG/RED payload type extraction to Rent-A-Codec (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@rac5
Patch Set: include <map> Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/rent_a_codec.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/rent_a_codec.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698