From 34faa5f214f7db2b4a9dc9b36bcba7c0e789df46 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Tue, 5 Aug 2008 21:09:12 +0000 Subject: [PATCH] * In case we do not have any frames to convert we'll need to break, otherwise we end up in an endless loop. This only happened when the remaining raw data provided did not contain enough content. In this particular case there were only 2 bytes remaining though the decoder needed 4 bytes to handle at least 1 frame. Seems like the audio file only provided data for one channel in the end, which did not lead to a B_LAST_BUFFER_ERROR yet as it has been read properly. * This fixes bug 1708 and most probably 1275 as well (someone check and close please) Didn't we just have a discussion about Media handling killing the system :P git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26827 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/media/plugins/raw_decoder/RawDecoderPlugin.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/add-ons/media/plugins/raw_decoder/RawDecoderPlugin.cpp b/src/add-ons/media/plugins/raw_decoder/RawDecoderPlugin.cpp index fda0ad4553..4d62138c22 100644 --- a/src/add-ons/media/plugins/raw_decoder/RawDecoderPlugin.cpp +++ b/src/add-ons/media/plugins/raw_decoder/RawDecoderPlugin.cpp @@ -489,6 +489,9 @@ RawDecoder::Decode(void *buffer, int64 *frameCount, continue; } int32 frames = min_c(fOutputBufferFrameCount - *frameCount, fChunkSize / fInputFrameSize); + if (frames == 0) + break; + int32 samples = frames * fInputFormat.u.raw_audio.channel_count; fConvert(output_buffer, fChunkBuffer, samples); fChunkBuffer = (const char *)fChunkBuffer + frames * fInputFrameSize;