NetEQ-related bug in ACM

Fixing a bug when creating new NetEQ slave instances in ACM.
The old code called WebRtcNetEQ_GetCurrentDelay() for the
master instance to get a delay value for WebRtcNetEQ_SetExtraDelay().
This is wrong, since WebRtcNetEQ_GetCurrentDelay() reports on the
current total buffer length, while WebRtcNetEQ_SetExtraDelay() is
the extra delay that is desired to in order to sync with video.

The fix includes keeping the extra delay value in a member variable
in the ACMNetEQ class.

Review URL: http://webrtc-codereview.appspot.com/295001

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1001 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrik.lundin@webrtc.org 2011-11-23 13:04:05 +00:00
parent 543c3eaa46
commit 4257790d2d
2 changed files with 5 additions and 10 deletions

View File

@ -44,6 +44,7 @@ _numSlaves(0),
_receivedStereo(false),
_masterSlaveInfo(NULL),
_previousAudioActivity(AudioFrame::kVadUnknown),
_extraDelay(0),
_callbackCritSect(CriticalSectionWrapper::CreateCriticalSection())
{
for(int n = 0; n < MAX_NUM_SLAVE_NETEQ + 1; n++)
@ -333,6 +334,7 @@ ACMNetEQ::SetExtraDelay(
return -1;
}
}
_extraDelay = delayInMS;
return 0;
}
@ -1186,16 +1188,8 @@ ACMNetEQ::AddSlave(
_numSlaves = 1;
_isInitialized[slaveIdx] = true;
// Set Slave delay as Master delay
WebRtc_UWord16 currentDelayMs;
if(WebRtcNetEQ_GetCurrentDelay(_inst[0], &currentDelayMs) < 0)
{
LogError("GetCurrentDelay", 0);
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
"AddSlave: AddSlave Failed, Could not Get Current Delay from Master.");
return -1;
}
if(WebRtcNetEQ_SetExtraDelay(_inst[slaveIdx], currentDelayMs) < 0)
// Set Slave delay as all other instances.
if(WebRtcNetEQ_SetExtraDelay(_inst[slaveIdx], _extraDelay) < 0)
{
LogError("SetExtraDelay", slaveIdx);
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,

View File

@ -401,6 +401,7 @@ private:
bool _receivedStereo;
void* _masterSlaveInfo;
AudioFrame::VADActivity _previousAudioActivity;
WebRtc_Word32 _extraDelay;
CriticalSectionWrapper* _callbackCritSect;
};