ACM 2 compatibility with ACM 1.

Removing an unregisterd codec from ACM 1 does not result in an error, so should be for ACM 2. Also ACM 1 has post-decode VAD on and AMC 2 needs to have it on by default.

BUG=
Test=trybits

R=tina.legrand@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/5549005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5276 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
turaj@webrtc.org 2013-12-13 00:10:44 +00:00
parent 2018269dc3
commit a92baead39
2 changed files with 9 additions and 8 deletions

View File

@ -122,7 +122,7 @@ AcmReceiver::AcmReceiver()
last_audio_decoder_(-1), // Invalid value.
decode_lock_(RWLockWrapper::CreateRWLock()),
neteq_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
vad_enabled_(false),
vad_enabled_(true),
previous_audio_activity_(AudioFrame::kVadUnknown),
current_sample_rate_hz_(kNeteqInitSampleRateHz),
nack_(),
@ -135,8 +135,9 @@ AcmReceiver::AcmReceiver()
decoders_[n].registered = false;
}
// Make sure we are on the same page as NetEq, although the default behavior
// for NetEq has been VAD disabled.
// Make sure we are on the same page as NetEq. Post-decode VAD is disabled by
// default in NetEq4, however, Audio Conference Mixer relies on VAD decision
// and fails if VAD decision is not provided.
if (vad_enabled_)
neteq_->EnableVad();
else
@ -554,9 +555,9 @@ int AcmReceiver::RemoveAllCodecs() {
int AcmReceiver::RemoveCodec(uint8_t payload_type) {
int codec_index = PayloadType2CodecIndex(payload_type);
if (codec_index < 0) { // Such a payload-type is not registered.
LOG(LS_ERROR) << "payload_type " << payload_type << " is not registered"
" to be removed.";
return -1;
LOG(LS_WARNING) << "payload_type " << payload_type << " is not registered,"
" no action is taken.";
return 0;
}
if (neteq_->RemovePayloadType(payload_type) != NetEq::kOK) {
LOG_FERR1(LS_ERROR, "AcmReceiver::RemoveCodec", payload_type);

View File

@ -211,8 +211,8 @@ TEST_F(AcmReceiverTest, DISABLED_ON_ANDROID(AddCodecRemoveCodec)) {
EXPECT_EQ(0, receiver_->AddCodec(codec_id, codec.pltype,
codec.channels, NULL));
// Remove non-existing codec, must fail.
EXPECT_EQ(-1, receiver_->RemoveCodec(payload_type + 1));
// Remove non-existing codec should not fail. ACM1 legacy.
EXPECT_EQ(0, receiver_->RemoveCodec(payload_type + 1));
// Remove an existing codec.
EXPECT_EQ(0, receiver_->RemoveCodec(payload_type));