From d6a7a5f385ee7e60631ccf6045948175485c3d6b Mon Sep 17 00:00:00 2001 From: "turaj@webrtc.org" Date: Wed, 25 Sep 2013 01:09:23 +0000 Subject: [PATCH] Small fixes to run ACM2 tests. BUG= R=minyue@google.com Review URL: https://webrtc-codereview.appspot.com/2238004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4836 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/modules/audio_coding/main/acm2/acm_codec_database.cc | 2 +- webrtc/modules/audio_coding/main/acm2/acm_receiver.cc | 4 ++++ .../audio_coding/main/acm2/audio_coding_module_impl.cc | 3 +-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/webrtc/modules/audio_coding/main/acm2/acm_codec_database.cc b/webrtc/modules/audio_coding/main/acm2/acm_codec_database.cc index f99c85b494..225098aade 100644 --- a/webrtc/modules/audio_coding/main/acm2/acm_codec_database.cc +++ b/webrtc/modules/audio_coding/main/acm2/acm_codec_database.cc @@ -270,7 +270,7 @@ const ACMCodecDB::CodecSettings ACMCodecDB::codec_settings_[] = { // Opus supports frames shorter than 10ms, // but it doesn't help us to use them. // Mono and stereo. - {1, {960}, 0, 2, false}, + {4, {480, 960, 1920, 2880}, 0, 2, false}, #endif #ifdef WEBRTC_CODEC_SPEEX {3, {160, 320, 480}, 0, 1, false}, diff --git a/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc b/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc index 949a70558d..d5acfac367 100644 --- a/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc +++ b/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc @@ -545,6 +545,8 @@ int AcmReceiver::RemoveAllCodecs() { } } } + // No codec is registered, invalidate last audio decoder. + last_audio_decoder_ = -1; return ret_val; } @@ -561,6 +563,8 @@ int AcmReceiver::RemoveCodec(uint8_t payload_type) { } CriticalSectionScoped lock(neteq_crit_sect_); decoders_[codec_index].registered = false; + if (last_audio_decoder_ == codec_index) + last_audio_decoder_ = -1; // Codec is removed, invalidate last decoder. return 0; } diff --git a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc index 3a7d271810..3c704c2274 100644 --- a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc +++ b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc @@ -1536,8 +1536,7 @@ int AudioCodingModuleImpl::InitializeReceiverSafe() { // removing and registering a decoder we can achieve the effect of resetting. // Reset the decoder state. int AudioCodingModuleImpl::ResetDecoder() { - CriticalSectionScoped lock(acm_crit_sect_); - return -1; + return 0; } // Get current receive frequency.