Audio Coding Module: Fixing a bug that prevented the encoder from being re-initialized when changing codec from mono to stereo.

Solving issue 130 reported by Niklas.

Reviewer: Turaj
Review URL: http://webrtc-codereview.appspot.com/268007

git-svn-id: http://webrtc.googlecode.com/svn/trunk@921 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
tina.legrand@webrtc.org 2011-11-10 08:17:08 +00:00
parent c4f129f97c
commit 855a77c972
2 changed files with 12 additions and 1 deletions

View File

@ -902,10 +902,16 @@ with the previously registered codec");
_isFirstRED = true;
}
// If packet size or number of channels has changed, we need to
// re-initialize the encoder.
if(_sendCodecInst.pacsize != sendCodec.pacsize)
{
forceInit = true;
}
if(_sendCodecInst.channels != sendCodec.channels)
{
forceInit = true;
}
if(forceInit)
{
@ -927,6 +933,7 @@ with the previously registered codec");
_sendCodecInst.plfreq = sendCodec.plfreq;
_sendCodecInst.pacsize = sendCodec.pacsize;
_sendCodecInst.channels = sendCodec.channels;
}
// If the change of sampling frequency has been successful then

View File

@ -456,10 +456,14 @@ WebRtc_Word16 TestStereo::RegisterSendCodec(char side,
CHECK_ERROR(AudioCodingModule::Codec(codecName, myCodecParam, samplingFreqHz));
myCodecParam.rate = rate;
myCodecParam.pacsize = packSize;
// Start with register codec as mono, to test that changing to stereo works.
myCodecParam.channels = 1;
CHECK_ERROR(myACM->RegisterSendCodec(myCodecParam));
// Register codec as stereo.
myCodecParam.channels = 2;
CHECK_ERROR(myACM->RegisterSendCodec(myCodecParam));
// initialization was succesful
// Initialization was successful.
return 0;
}