| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Get supported codec parameters with id | 46 // Get supported codec parameters with id |
| 47 int AudioCodingModule::Codec(int list_id, CodecInst* codec) { | 47 int AudioCodingModule::Codec(int list_id, CodecInst* codec) { |
| 48 // Get the codec settings for the codec with the given list ID | 48 // Get the codec settings for the codec with the given list ID |
| 49 return acm2::ACMCodecDB::Codec(list_id, codec); | 49 return acm2::ACMCodecDB::Codec(list_id, codec); |
| 50 } | 50 } |
| 51 | 51 |
| 52 // Get supported codec parameters with name, frequency and number of channels. | 52 // Get supported codec parameters with name, frequency and number of channels. |
| 53 int AudioCodingModule::Codec(const char* payload_name, | 53 int AudioCodingModule::Codec(const char* payload_name, |
| 54 CodecInst* codec, | 54 CodecInst* codec, |
| 55 int sampling_freq_hz, | 55 int sampling_freq_hz, |
| 56 int channels) { | 56 size_t channels) { |
| 57 int codec_id; | 57 int codec_id; |
| 58 | 58 |
| 59 // Get the id of the codec from the database. | 59 // Get the id of the codec from the database. |
| 60 codec_id = acm2::ACMCodecDB::CodecId( | 60 codec_id = acm2::ACMCodecDB::CodecId( |
| 61 payload_name, sampling_freq_hz, channels); | 61 payload_name, sampling_freq_hz, channels); |
| 62 if (codec_id < 0) { | 62 if (codec_id < 0) { |
| 63 // We couldn't find a matching codec, set the parameters to unacceptable | 63 // We couldn't find a matching codec, set the parameters to unacceptable |
| 64 // values and return. | 64 // values and return. |
| 65 codec->plname[0] = '\0'; | 65 codec->plname[0] = '\0'; |
| 66 codec->pltype = -1; | 66 codec->pltype = -1; |
| 67 codec->pacsize = 0; | 67 codec->pacsize = 0; |
| 68 codec->rate = 0; | 68 codec->rate = 0; |
| 69 codec->plfreq = 0; | 69 codec->plfreq = 0; |
| 70 return -1; | 70 return -1; |
| 71 } | 71 } |
| 72 | 72 |
| 73 // Get default codec settings. | 73 // Get default codec settings. |
| 74 acm2::ACMCodecDB::Codec(codec_id, codec); | 74 acm2::ACMCodecDB::Codec(codec_id, codec); |
| 75 | 75 |
| 76 // Keep the number of channels from the function call. For most codecs it | 76 // Keep the number of channels from the function call. For most codecs it |
| 77 // will be the same value as in default codec settings, but not for all. | 77 // will be the same value as in default codec settings, but not for all. |
| 78 codec->channels = channels; | 78 codec->channels = channels; |
| 79 | 79 |
| 80 return 0; | 80 return 0; |
| 81 } | 81 } |
| 82 | 82 |
| 83 // Get supported codec Index with name, frequency and number of channels. | 83 // Get supported codec Index with name, frequency and number of channels. |
| 84 int AudioCodingModule::Codec(const char* payload_name, | 84 int AudioCodingModule::Codec(const char* payload_name, |
| 85 int sampling_freq_hz, | 85 int sampling_freq_hz, |
| 86 int channels) { | 86 size_t channels) { |
| 87 return acm2::ACMCodecDB::CodecId(payload_name, sampling_freq_hz, channels); | 87 return acm2::ACMCodecDB::CodecId(payload_name, sampling_freq_hz, channels); |
| 88 } | 88 } |
| 89 | 89 |
| 90 // Checks the validity of the parameters of the given codec | 90 // Checks the validity of the parameters of the given codec |
| 91 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { | 91 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { |
| 92 int codec_number = acm2::ACMCodecDB::CodecNumber(codec); | 92 int codec_number = acm2::ACMCodecDB::CodecNumber(codec); |
| 93 | 93 |
| 94 if (codec_number < 0) { | 94 if (codec_number < 0) { |
| 95 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, | 95 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, |
| 96 "Invalid codec setting"); | 96 "Invalid codec setting"); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 109 initial_playout_delay_ms(0), | 109 initial_playout_delay_ms(0), |
| 110 playout_channels(1), | 110 playout_channels(1), |
| 111 playout_frequency_hz(32000) { | 111 playout_frequency_hz(32000) { |
| 112 } | 112 } |
| 113 | 113 |
| 114 AudioCoding* AudioCoding::Create(const Config& config) { | 114 AudioCoding* AudioCoding::Create(const Config& config) { |
| 115 return new AudioCodingImpl(config); | 115 return new AudioCodingImpl(config); |
| 116 } | 116 } |
| 117 | 117 |
| 118 } // namespace webrtc | 118 } // namespace webrtc |
| OLD | NEW |