From b1698ab8279dd01fff87336d8573173fd8125d36 Mon Sep 17 00:00:00 2001 From: "tina.legrand@webrtc.org" Date: Wed, 3 Jul 2013 09:25:34 +0000 Subject: [PATCH] Error in update of read index in ACM Fixing a bug where we increase read index with too few samples when the input is stereo. BUG=https://code.google.com/p/webrtc/issues/detail?id=714 R=andrew@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1753004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4290 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../audio_coding/main/source/acm_generic_codec.cc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/webrtc/modules/audio_coding/main/source/acm_generic_codec.cc b/webrtc/modules/audio_coding/main/source/acm_generic_codec.cc index 7d84658b48..8b6c9c55a8 100644 --- a/webrtc/modules/audio_coding/main/source/acm_generic_codec.cc +++ b/webrtc/modules/audio_coding/main/source/acm_generic_codec.cc @@ -303,8 +303,7 @@ int16_t ACMGenericCodec::Encode(uint8_t* bitstream, // Reset the variables which will be incremented in the loop. *bitstream_len_byte = 0; - bool done = false; - while (!done) { + do { status = InternalEncode(&bitstream[*bitstream_len_byte], &tmp_bitstream_len_byte); *bitstream_len_byte += tmp_bitstream_len_byte; @@ -323,12 +322,7 @@ int16_t ACMGenericCodec::Encode(uint8_t* bitstream, // break from the loop break; } - - // TODO(andrew): This should be multiplied by the number of - // channels, right? - // http://code.google.com/p/webrtc/issues/detail?id=714 - done = in_audio_ix_read_ >= frame_len_smpl_; - } + } while (in_audio_ix_read_ < frame_len_smpl_ * num_channels_); } if (status >= 0) { *encoding_type = (vad_label_[0] == 1) ? kActiveNormalEncoded :