From ba47158dc987b98156a246d7d1b22c246d2082f9 Mon Sep 17 00:00:00 2001 From: shatty Date: Fri, 30 Jan 2004 09:00:11 +0000 Subject: [PATCH] stereo outputs twice as much data. now it works! git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6430 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/media/plugins/speex/speexCodecPlugin.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/add-ons/media/plugins/speex/speexCodecPlugin.cpp b/src/add-ons/media/plugins/speex/speexCodecPlugin.cpp index 7009e4f883..f20a4b4244 100644 --- a/src/add-ons/media/plugins/speex/speexCodecPlugin.cpp +++ b/src/add-ons/media/plugins/speex/speexCodecPlugin.cpp @@ -256,7 +256,6 @@ SpeexDecoder::Decode(void *buffer, int64 *frameCount, mediaHeader->start_time = fStartTime; //TRACE("SpeexDecoder: Decoding start time %.6f\n", fStartTime / 1000000.0); -// debugger("SpeexDecoder::Decode"); while (out_bytes_needed >= fSpeexOutputLength) { // get a new packet void *chunkBuffer; @@ -292,11 +291,11 @@ SpeexDecoder::Decode(void *buffer, int64 *frameCount, if (fHeader->nb_channels == 2) { speex_decode_stereo(out_buffer, fHeader->frame_size, fStereoState); } - for (int i = 0 ; i < fHeader->frame_size ; i++) { + for (int i = 0 ; i < fHeader->frame_size * fHeader->nb_channels ; i++) { out_buffer[i] /= 32000.0; } - out_buffer += fHeader->frame_size; - out_bytes_needed -= fHeader->frame_size*sizeof(float); + out_buffer += fHeader->frame_size * fHeader->nb_channels; + out_bytes_needed -= fSpeexOutputLength; } }