Fix error when receiving an already sent timestamp from VoE.

BUG=issue715
TEST=automatic rapid switching between 32 kHz stereo and 16 kHz mono codecs in voe_cmd_test does not repro.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2547 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org 2012-08-02 03:26:14 +00:00
parent 792e974949
commit 686a731c18

View File

@ -145,9 +145,10 @@ ACMGenericCodec::Add10MsDataSafe(
if(_lastTimestamp == timestamp) if(_lastTimestamp == timestamp)
{ {
// Same timestamp as the last time, overwrite. // Same timestamp as the last time, overwrite.
if((_inAudioIxWrite >= lengthSmpl) && (_inTimestampIxWrite > 0)) if((_inAudioIxWrite >= lengthSmpl * audioChannel) &&
(_inTimestampIxWrite > 0))
{ {
_inAudioIxWrite -= lengthSmpl; _inAudioIxWrite -= lengthSmpl * audioChannel;
_inTimestampIxWrite--; _inTimestampIxWrite--;
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, _uniqueID, WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, _uniqueID,
"Adding 10ms with previous timestamp, \ "Adding 10ms with previous timestamp, \
@ -369,6 +370,9 @@ ACMGenericCodec::EncodeSafe(
break; break;
} }
// TODO(andrew): This should be multiplied by the number of
// channels, right?
// http://code.google.com/p/webrtc/issues/detail?id=714
done = _inAudioIxRead >= _frameLenSmpl; done = _inAudioIxRead >= _frameLenSmpl;
} }
} }