| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 #ifdef ENABLE_48000_HZ | 77 #ifdef ENABLE_48000_HZ |
| 78 {100, "CN", 48000, 1440, 1, 0}, | 78 {100, "CN", 48000, 1440, 1, 0}, |
| 79 #endif | 79 #endif |
| 80 #ifdef WEBRTC_CODEC_AVT | 80 #ifdef WEBRTC_CODEC_AVT |
| 81 {106, "telephone-event", 8000, 240, 1, 0}, | 81 {106, "telephone-event", 8000, 240, 1, 0}, |
| 82 #endif | 82 #endif |
| 83 #ifdef WEBRTC_CODEC_RED | 83 #ifdef WEBRTC_CODEC_RED |
| 84 {127, "red", 8000, 0, 1, 0}, | 84 {127, "red", 8000, 0, 1, 0}, |
| 85 #endif | 85 #endif |
| 86 // To prevent compile errors due to trailing commas. | 86 // To prevent compile errors due to trailing commas. |
| 87 {-1, "Null", -1, -1, -1, -1} | 87 {-1, "Null", -1, -1, 0, -1} |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 // Create database with all codec settings at compile time. | 90 // Create database with all codec settings at compile time. |
| 91 // Each entry needs the following parameters in the given order: | 91 // Each entry needs the following parameters in the given order: |
| 92 // Number of allowed packet sizes, a vector with the allowed packet sizes, | 92 // Number of allowed packet sizes, a vector with the allowed packet sizes, |
| 93 // Basic block samples, max number of channels that are supported. | 93 // Basic block samples, max number of channels that are supported. |
| 94 const ACMCodecDB::CodecSettings ACMCodecDB::codec_settings_[] = { | 94 const ACMCodecDB::CodecSettings ACMCodecDB::codec_settings_[] = { |
| 95 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) | 95 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) |
| 96 {2, {kIsacPacSize480, kIsacPacSize960}, 0, 1, true}, | 96 {2, {kIsacPacSize480, kIsacPacSize960}, 0, 1, true}, |
| 97 # if (defined(WEBRTC_CODEC_ISAC)) | 97 # if (defined(WEBRTC_CODEC_ISAC)) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 #ifdef ENABLE_48000_HZ | 138 #ifdef ENABLE_48000_HZ |
| 139 {1, {1440}, 1440, 1, false}, | 139 {1, {1440}, 1440, 1, false}, |
| 140 #endif | 140 #endif |
| 141 #ifdef WEBRTC_CODEC_AVT | 141 #ifdef WEBRTC_CODEC_AVT |
| 142 {1, {240}, 240, 1, false}, | 142 {1, {240}, 240, 1, false}, |
| 143 #endif | 143 #endif |
| 144 #ifdef WEBRTC_CODEC_RED | 144 #ifdef WEBRTC_CODEC_RED |
| 145 {1, {0}, 0, 1, false}, | 145 {1, {0}, 0, 1, false}, |
| 146 #endif | 146 #endif |
| 147 // To prevent compile errors due to trailing commas. | 147 // To prevent compile errors due to trailing commas. |
| 148 {-1, {-1}, -1, -1, false} | 148 {-1, {-1}, -1, 0, false} |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 // Create a database of all NetEQ decoders at compile time. | 151 // Create a database of all NetEQ decoders at compile time. |
| 152 const NetEqDecoder ACMCodecDB::neteq_decoders_[] = { | 152 const NetEqDecoder ACMCodecDB::neteq_decoders_[] = { |
| 153 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) | 153 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) |
| 154 kDecoderISAC, | 154 kDecoderISAC, |
| 155 # if (defined(WEBRTC_CODEC_ISAC)) | 155 # if (defined(WEBRTC_CODEC_ISAC)) |
| 156 kDecoderISACswb, | 156 kDecoderISACswb, |
| 157 kDecoderISACfb, | 157 kDecoderISACfb, |
| 158 # endif | 158 # endif |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 // Looks for a matching payload name, frequency, and channels in the | 305 // Looks for a matching payload name, frequency, and channels in the |
| 306 // codec list. Need to check all three since some codecs have several codec | 306 // codec list. Need to check all three since some codecs have several codec |
| 307 // entries with different frequencies and/or channels. | 307 // entries with different frequencies and/or channels. |
| 308 // Does not check other codec settings, such as payload type and packet size. | 308 // Does not check other codec settings, such as payload type and packet size. |
| 309 // Returns the id of the codec, or -1 if no match is found. | 309 // Returns the id of the codec, or -1 if no match is found. |
| 310 int ACMCodecDB::CodecId(const CodecInst& codec_inst) { | 310 int ACMCodecDB::CodecId(const CodecInst& codec_inst) { |
| 311 return (CodecId(codec_inst.plname, codec_inst.plfreq, | 311 return (CodecId(codec_inst.plname, codec_inst.plfreq, |
| 312 codec_inst.channels)); | 312 codec_inst.channels)); |
| 313 } | 313 } |
| 314 | 314 |
| 315 int ACMCodecDB::CodecId(const char* payload_name, int frequency, int channels) { | 315 int ACMCodecDB::CodecId(const char* payload_name, |
| 316 int frequency, |
| 317 size_t channels) { |
| 316 for (int id = 0; id < kNumCodecs; id++) { | 318 for (int id = 0; id < kNumCodecs; id++) { |
| 317 bool name_match = false; | 319 bool name_match = false; |
| 318 bool frequency_match = false; | 320 bool frequency_match = false; |
| 319 bool channels_match = false; | 321 bool channels_match = false; |
| 320 | 322 |
| 321 // Payload name, sampling frequency and number of channels need to match. | 323 // Payload name, sampling frequency and number of channels need to match. |
| 322 // NOTE! If |frequency| is -1, the frequency is not applicable, and is | 324 // NOTE! If |frequency| is -1, the frequency is not applicable, and is |
| 323 // always treated as true, like for RED. | 325 // always treated as true, like for RED. |
| 324 name_match = (STR_CASE_CMP(database_[id].plname, payload_name) == 0); | 326 name_match = (STR_CASE_CMP(database_[id].plname, payload_name) == 0); |
| 325 frequency_match = (frequency == database_[id].plfreq) || (frequency == -1); | 327 frequency_match = (frequency == database_[id].plfreq) || (frequency == -1); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 } | 475 } |
| 474 | 476 |
| 475 bool ACMCodecDB::OwnsDecoder(int codec_id) { | 477 bool ACMCodecDB::OwnsDecoder(int codec_id) { |
| 476 assert(codec_id >= 0 && codec_id < ACMCodecDB::kNumCodecs); | 478 assert(codec_id >= 0 && codec_id < ACMCodecDB::kNumCodecs); |
| 477 return ACMCodecDB::codec_settings_[codec_id].owns_decoder; | 479 return ACMCodecDB::codec_settings_[codec_id].owns_decoder; |
| 478 } | 480 } |
| 479 | 481 |
| 480 } // namespace acm2 | 482 } // namespace acm2 |
| 481 | 483 |
| 482 } // namespace webrtc | 484 } // namespace webrtc |
| OLD | NEW |