Fix an error which causes an acccess violation.

For 16-bit files, this was looping twice as long as necessary and reading outside the buffer.
http://code.google.com/p/webrtc/issues/detail?id=33
Review URL: http://webrtc-codereview.appspot.com/93007

git-svn-id: http://webrtc.googlecode.com/svn/trunk@279 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
ajm@google.com 2011-08-01 16:12:43 +00:00
parent 81b9e2d2cc
commit 7d962ccd32

View File

@ -903,7 +903,7 @@ WebRtc_Word32 ModuleFileUtility::ReadWavDataAsMono(
// Output data is should be mono.
if(codec_info_.channels == 2)
{
for (WebRtc_UWord32 i = 0; i < bytesRequested; i++)
for (WebRtc_UWord32 i = 0; i < bytesRequested / _bytesPerSample; i++)
{
// Sample value is the average of left and right buffer rounded to
// closest integer value. Note samples can be either 1 or 2 byte.