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 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 int AudioCodingModuleImpl::InitializeReceiver() { | 941 int AudioCodingModuleImpl::InitializeReceiver() { |
942 rtc::CritScope lock(&acm_crit_sect_); | 942 rtc::CritScope lock(&acm_crit_sect_); |
943 return InitializeReceiverSafe(); | 943 return InitializeReceiverSafe(); |
944 } | 944 } |
945 | 945 |
946 // Initialize receiver, resets codec database etc. | 946 // Initialize receiver, resets codec database etc. |
947 int AudioCodingModuleImpl::InitializeReceiverSafe() { | 947 int AudioCodingModuleImpl::InitializeReceiverSafe() { |
948 // If the receiver is already initialized then we want to destroy any | 948 // If the receiver is already initialized then we want to destroy any |
949 // existing decoders. After a call to this function, we should have a clean | 949 // existing decoders. After a call to this function, we should have a clean |
950 // start-up. | 950 // start-up. |
951 if (receiver_initialized_) | 951 if (receiver_initialized_) { |
952 receiver_.RemoveAllCodecs(); | 952 if (receiver_.RemoveAllCodecs() < 0) |
| 953 return -1; |
| 954 } |
953 receiver_.ResetInitialDelay(); | 955 receiver_.ResetInitialDelay(); |
954 receiver_.SetMinimumDelay(0); | 956 receiver_.SetMinimumDelay(0); |
955 receiver_.SetMaximumDelay(0); | 957 receiver_.SetMaximumDelay(0); |
956 receiver_.FlushBuffers(); | 958 receiver_.FlushBuffers(); |
957 | 959 |
958 // Register RED and CN. | 960 // Register RED and CN. |
959 auto db = acm2::RentACodec::Database(); | 961 auto db = acm2::RentACodec::Database(); |
960 for (size_t i = 0; i < db.size(); i++) { | 962 for (size_t i = 0; i < db.size(); i++) { |
961 if (IsCodecRED(db[i]) || IsCodecCN(db[i])) { | 963 if (IsCodecRED(db[i]) || IsCodecCN(db[i])) { |
962 if (receiver_.AddCodec(static_cast<int>(i), | 964 if (receiver_.AddCodec(static_cast<int>(i), |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 // Checks the validity of the parameters of the given codec | 1357 // Checks the validity of the parameters of the given codec |
1356 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { | 1358 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { |
1357 bool valid = acm2::RentACodec::IsCodecValid(codec); | 1359 bool valid = acm2::RentACodec::IsCodecValid(codec); |
1358 if (!valid) | 1360 if (!valid) |
1359 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, | 1361 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, |
1360 "Invalid codec setting"); | 1362 "Invalid codec setting"); |
1361 return valid; | 1363 return valid; |
1362 } | 1364 } |
1363 | 1365 |
1364 } // namespace webrtc | 1366 } // namespace webrtc |
OLD | NEW |