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 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" | 11 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" |
12 | 12 |
13 #include "webrtc/base/checks.h" | 13 #include "webrtc/base/checks.h" |
14 #include "webrtc/base/safe_conversions.h" | 14 #include "webrtc/base/safe_conversions.h" |
15 #include "webrtc/modules/audio_coding/acm2/acm_receiver.h" | 15 #include "webrtc/modules/audio_coding/acm2/acm_receiver.h" |
16 #include "webrtc/modules/audio_coding/acm2/acm_resampler.h" | 16 #include "webrtc/modules/audio_coding/acm2/acm_resampler.h" |
17 #include "webrtc/modules/audio_coding/acm2/codec_manager.h" | 17 #include "webrtc/modules/audio_coding/acm2/codec_manager.h" |
18 #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" | 18 #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" |
| 19 #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h" |
19 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" | 20 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" |
20 #include "webrtc/system_wrappers/include/metrics.h" | 21 #include "webrtc/system_wrappers/include/metrics.h" |
21 #include "webrtc/system_wrappers/include/trace.h" | 22 #include "webrtc/system_wrappers/include/trace.h" |
22 | 23 |
23 namespace webrtc { | 24 namespace webrtc { |
24 | 25 |
25 namespace { | 26 namespace { |
26 | 27 |
27 struct EncoderFactory { | 28 struct EncoderFactory { |
28 AudioEncoder* external_speech_encoder = nullptr; | 29 AudioEncoder* external_speech_encoder = nullptr; |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 receiver_.RemoveAllCodecs(); | 943 receiver_.RemoveAllCodecs(); |
943 receiver_.ResetInitialDelay(); | 944 receiver_.ResetInitialDelay(); |
944 receiver_.SetMinimumDelay(0); | 945 receiver_.SetMinimumDelay(0); |
945 receiver_.SetMaximumDelay(0); | 946 receiver_.SetMaximumDelay(0); |
946 receiver_.FlushBuffers(); | 947 receiver_.FlushBuffers(); |
947 | 948 |
948 // Register RED and CN. | 949 // Register RED and CN. |
949 auto db = acm2::RentACodec::Database(); | 950 auto db = acm2::RentACodec::Database(); |
950 for (size_t i = 0; i < db.size(); i++) { | 951 for (size_t i = 0; i < db.size(); i++) { |
951 if (IsCodecRED(db[i]) || IsCodecCN(db[i])) { | 952 if (IsCodecRED(db[i]) || IsCodecCN(db[i])) { |
952 if (receiver_.AddCodec(static_cast<int>(i), | 953 if (!receiver_.AddCodec(db[i].pltype, CodecInstToSdp(db[i]))) { |
953 static_cast<uint8_t>(db[i].pltype), 1, | |
954 db[i].plfreq, nullptr, db[i].plname) < 0) { | |
955 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_, | 954 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_, |
956 "Cannot register master codec."); | 955 "Cannot register master codec."); |
957 return -1; | 956 return -1; |
958 } | 957 } |
959 } | 958 } |
960 } | 959 } |
961 receiver_initialized_ = true; | 960 receiver_initialized_ = true; |
962 return 0; | 961 return 0; |
963 } | 962 } |
964 | 963 |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 // Checks the validity of the parameters of the given codec | 1288 // Checks the validity of the parameters of the given codec |
1290 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { | 1289 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { |
1291 bool valid = acm2::RentACodec::IsCodecValid(codec); | 1290 bool valid = acm2::RentACodec::IsCodecValid(codec); |
1292 if (!valid) | 1291 if (!valid) |
1293 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, | 1292 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, |
1294 "Invalid codec setting"); | 1293 "Invalid codec setting"); |
1295 return valid; | 1294 return valid; |
1296 } | 1295 } |
1297 | 1296 |
1298 } // namespace webrtc | 1297 } // namespace webrtc |
OLD | NEW |