From ac4eb046e39f72c67252a443509450751ff4fab5 Mon Sep 17 00:00:00 2001 From: "tina.legrand@webrtc.org" Date: Tue, 10 Jan 2012 13:59:55 +0000 Subject: [PATCH] Added registration of RED and CNG to NetEq slave. Bug found when working on issue 221. Missing registration of CNG was the cause of the bad audio (master and slave out of sync) reported in the issue. NOTE! File has not been refactored to follow Google style. BUG=http://code.google.com/p/webrtc/issues/detail?id=221 Review URL: http://webrtc-codereview.appspot.com/342006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1372 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../main/source/audio_coding_module_impl.cc | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/modules/audio_coding/main/source/audio_coding_module_impl.cc b/src/modules/audio_coding/main/source/audio_coding_module_impl.cc index 0ad9958e5..ecffffda4 100644 --- a/src/modules/audio_coding/main/source/audio_coding_module_impl.cc +++ b/src/modules/audio_coding/main/source/audio_coding_module_impl.cc @@ -1536,6 +1536,27 @@ AudioCodingModuleImpl::RegisterReceiveCodec( "Cannot Add Slave jitter buffer to NetEQ."); return -1; } + + // Register RED and CN in slave. + bool reg_in_neteq = false; + for (int i = (ACMCodecDB::kNumCodecs - 1); i > -1; i--) { + if((STR_CASE_CMP(ACMCodecDB::database_[i].plname, "RED") == 0)) { + reg_in_neteq = true; + } else if ((STR_CASE_CMP(ACMCodecDB::database_[i].plname, "CN") == 0)) { + reg_in_neteq = true; + } + + if (reg_in_neteq) { + if(RegisterRecCodecMSSafe(ACMCodecDB::database_[i], i, i, + ACMNetEQ::slaveJB) < 0) { + WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id, + "Cannot register slave codec."); + return -1; + } + _registeredPlTypes[i] = ACMCodecDB::database_[i].pltype; + reg_in_neteq = false; + } + } } if(RegisterRecCodecMSSafe(receiveCodec, codecId, mirrorId,