| 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 |
| 11 /* | 11 /* |
| 12 * This file generates databases with information about all supported audio | 12 * This file generates databases with information about all supported audio |
| 13 * codecs. | 13 * codecs. |
| 14 */ | 14 */ |
| 15 | 15 |
| 16 // TODO(tlegrand): Change constant input pointers in all functions to constant | 16 // TODO(tlegrand): Change constant input pointers in all functions to constant |
| 17 // references, where appropriate. | 17 // references, where appropriate. |
| 18 #include "webrtc/modules/audio_coding/acm2/acm_codec_database.h" | 18 #include "webrtc/modules/audio_coding/acm2/acm_codec_database.h" |
| 19 | 19 |
| 20 #include <assert.h> | 20 #include <assert.h> |
| 21 | 21 |
| 22 #include "webrtc/base/checks.h" | 22 #include "webrtc/base/checks.h" |
| 23 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h" | |
| 24 #include "webrtc/system_wrappers/include/trace.h" | 23 #include "webrtc/system_wrappers/include/trace.h" |
| 25 | 24 |
| 25 #if ((defined WEBRTC_CODEC_ISAC) && (defined WEBRTC_CODEC_ISACFX)) |
| 26 #error iSAC and iSACFX codecs cannot be enabled at the same time |
| 27 #endif |
| 28 |
| 26 namespace webrtc { | 29 namespace webrtc { |
| 27 | 30 |
| 28 namespace acm2 { | 31 namespace acm2 { |
| 29 | 32 |
| 30 namespace { | 33 namespace { |
| 31 | 34 |
| 32 // Checks if the bitrate is valid for iSAC. | 35 // Checks if the bitrate is valid for iSAC. |
| 33 bool IsISACRateValid(int rate) { | 36 bool IsISACRateValid(int rate) { |
| 34 return (rate == -1) || ((rate <= 56000) && (rate >= 10000)); | 37 return (rate == -1) || ((rate <= 56000) && (rate >= 10000)); |
| 35 } | 38 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 53 } | 56 } |
| 54 | 57 |
| 55 } // namespace | 58 } // namespace |
| 56 | 59 |
| 57 // Not yet used payload-types. | 60 // Not yet used payload-types. |
| 58 // 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, | 61 // 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, |
| 59 // 67, 66, 65 | 62 // 67, 66, 65 |
| 60 | 63 |
| 61 const CodecInst ACMCodecDB::database_[] = { | 64 const CodecInst ACMCodecDB::database_[] = { |
| 62 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) | 65 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) |
| 63 {103, "ISAC", 16000, kIsacPacSize480, 1, kIsacWbDefaultRate}, | 66 {103, "ISAC", 16000, 480, 1, 32000}, |
| 64 # if (defined(WEBRTC_CODEC_ISAC)) | 67 # if (defined(WEBRTC_CODEC_ISAC)) |
| 65 {104, "ISAC", 32000, kIsacPacSize960, 1, kIsacSwbDefaultRate}, | 68 {104, "ISAC", 32000, 960, 1, 56000}, |
| 66 # endif | 69 # endif |
| 67 #endif | 70 #endif |
| 68 // Mono | 71 // Mono |
| 69 {107, "L16", 8000, 80, 1, 128000}, | 72 {107, "L16", 8000, 80, 1, 128000}, |
| 70 {108, "L16", 16000, 160, 1, 256000}, | 73 {108, "L16", 16000, 160, 1, 256000}, |
| 71 {109, "L16", 32000, 320, 1, 512000}, | 74 {109, "L16", 32000, 320, 1, 512000}, |
| 72 // Stereo | 75 // Stereo |
| 73 {111, "L16", 8000, 80, 2, 128000}, | 76 {111, "L16", 8000, 80, 2, 128000}, |
| 74 {112, "L16", 16000, 160, 2, 256000}, | 77 {112, "L16", 16000, 160, 2, 256000}, |
| 75 {113, "L16", 32000, 320, 2, 512000}, | 78 {113, "L16", 32000, 320, 2, 512000}, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // To prevent compile errors due to trailing commas. | 114 // To prevent compile errors due to trailing commas. |
| 112 {-1, "Null", -1, -1, 0, -1} | 115 {-1, "Null", -1, -1, 0, -1} |
| 113 }; | 116 }; |
| 114 | 117 |
| 115 // Create database with all codec settings at compile time. | 118 // Create database with all codec settings at compile time. |
| 116 // Each entry needs the following parameters in the given order: | 119 // Each entry needs the following parameters in the given order: |
| 117 // Number of allowed packet sizes, a vector with the allowed packet sizes, | 120 // Number of allowed packet sizes, a vector with the allowed packet sizes, |
| 118 // Basic block samples, max number of channels that are supported. | 121 // Basic block samples, max number of channels that are supported. |
| 119 const ACMCodecDB::CodecSettings ACMCodecDB::codec_settings_[] = { | 122 const ACMCodecDB::CodecSettings ACMCodecDB::codec_settings_[] = { |
| 120 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) | 123 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) |
| 121 {2, {kIsacPacSize480, kIsacPacSize960}, 0, 1}, | 124 {2, {480, 960}, 0, 1}, |
| 122 # if (defined(WEBRTC_CODEC_ISAC)) | 125 # if (defined(WEBRTC_CODEC_ISAC)) |
| 123 {1, {kIsacPacSize960}, 0, 1}, | 126 {1, {960}, 0, 1}, |
| 124 # endif | 127 # endif |
| 125 #endif | 128 #endif |
| 126 // Mono | 129 // Mono |
| 127 {4, {80, 160, 240, 320}, 0, 2}, | 130 {4, {80, 160, 240, 320}, 0, 2}, |
| 128 {4, {160, 320, 480, 640}, 0, 2}, | 131 {4, {160, 320, 480, 640}, 0, 2}, |
| 129 {2, {320, 640}, 0, 2}, | 132 {2, {320, 640}, 0, 2}, |
| 130 // Stereo | 133 // Stereo |
| 131 {4, {80, 160, 240, 320}, 0, 2}, | 134 {4, {80, 160, 240, 320}, 0, 2}, |
| 132 {4, {160, 320, 480, 640}, 0, 2}, | 135 {4, {160, 320, 480, 640}, 0, 2}, |
| 133 {2, {320, 640}, 0, 2}, | 136 {2, {320, 640}, 0, 2}, |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 } | 341 } |
| 339 // Gets codec id number from database for the receiver. | 342 // Gets codec id number from database for the receiver. |
| 340 int ACMCodecDB::ReceiverCodecNumber(const CodecInst& codec_inst) { | 343 int ACMCodecDB::ReceiverCodecNumber(const CodecInst& codec_inst) { |
| 341 // Look for a matching codec in the database. | 344 // Look for a matching codec in the database. |
| 342 return CodecId(codec_inst); | 345 return CodecId(codec_inst); |
| 343 } | 346 } |
| 344 | 347 |
| 345 } // namespace acm2 | 348 } // namespace acm2 |
| 346 | 349 |
| 347 } // namespace webrtc | 350 } // namespace webrtc |
| OLD | NEW |