Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: webrtc/modules/audio_coding/acm2/audio_coding_module.cc

Issue 2348233002: AcmReceiver: Ask NetEq to delete all decoders at once instead of one by one (Closed)
Patch Set: unit tests Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 if (receiver_.RemoveAllCodecs() < 0) 952 receiver_.RemoveAllCodecs();
953 return -1;
954 }
955 receiver_.ResetInitialDelay(); 953 receiver_.ResetInitialDelay();
956 receiver_.SetMinimumDelay(0); 954 receiver_.SetMinimumDelay(0);
957 receiver_.SetMaximumDelay(0); 955 receiver_.SetMaximumDelay(0);
958 receiver_.FlushBuffers(); 956 receiver_.FlushBuffers();
959 957
960 // Register RED and CN. 958 // Register RED and CN.
961 auto db = acm2::RentACodec::Database(); 959 auto db = acm2::RentACodec::Database();
962 for (size_t i = 0; i < db.size(); i++) { 960 for (size_t i = 0; i < db.size(); i++) {
963 if (IsCodecRED(db[i]) || IsCodecCN(db[i])) { 961 if (IsCodecRED(db[i]) || IsCodecCN(db[i])) {
964 if (receiver_.AddCodec(static_cast<int>(i), 962 if (receiver_.AddCodec(static_cast<int>(i),
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 // Checks the validity of the parameters of the given codec 1355 // Checks the validity of the parameters of the given codec
1358 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { 1356 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) {
1359 bool valid = acm2::RentACodec::IsCodecValid(codec); 1357 bool valid = acm2::RentACodec::IsCodecValid(codec);
1360 if (!valid) 1358 if (!valid)
1361 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, 1359 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1,
1362 "Invalid codec setting"); 1360 "Invalid codec setting");
1363 return valid; 1361 return valid;
1364 } 1362 }
1365 1363
1366 } // namespace webrtc 1364 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/acm2/acm_receiver.cc ('k') | webrtc/modules/audio_coding/neteq/decoder_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698