From 0b3cd7531cbadd3b78cc37f57db2a3bb335ca457 Mon Sep 17 00:00:00 2001 From: beveloper Date: Tue, 23 Dec 2003 00:26:45 +0000 Subject: [PATCH] bad hack to fix sync after seek git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5736 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../plugins/mp3_decoder/mp3DecoderPlugin.cpp | 21 +++++++++++-------- .../plugins/wav_reader/WavReaderPlugin.cpp | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp b/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp index 8cab9c162f..5bbbad7e90 100644 --- a/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp +++ b/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp @@ -208,15 +208,18 @@ mp3Decoder::DecodeNextChunk() // resync after a seek if (fNeedSync) { - while (chunkSize > 100) { - if (IsValidStream((uint8 *)chunkBuffer, chunkSize)) - break; - chunkBuffer = (uint8 *)chunkBuffer + 1; - chunkSize--; - } - if (chunkSize <= 100) { - TRACE("mp3Decoder::Decode: Sync failed\n"); - return B_ERROR; + if (chunkSize > 5200) { // mp3 reader always delivers synced frames smaller than 5200 bytes + // wav reader and others don't do that + while (chunkSize > 100) { + if (IsValidStream((uint8 *)chunkBuffer, chunkSize)) + break; + chunkBuffer = (uint8 *)chunkBuffer + 1; + chunkSize--; + } + if (chunkSize <= 100) { + TRACE("mp3Decoder::Decode: Sync failed\n"); + return B_ERROR; + } } fNeedSync = false; } diff --git a/src/add-ons/media/plugins/wav_reader/WavReaderPlugin.cpp b/src/add-ons/media/plugins/wav_reader/WavReaderPlugin.cpp index 63b5710787..e5e5206774 100644 --- a/src/add-ons/media/plugins/wav_reader/WavReaderPlugin.cpp +++ b/src/add-ons/media/plugins/wav_reader/WavReaderPlugin.cpp @@ -13,7 +13,7 @@ #define TRACE(a...) #endif -#define BUFFER_SIZE 16384 +#define BUFFER_SIZE 16384 // must be > 5200 for mp3 decoder to work #define FOURCC(a,b,c,d) ((((uint32)(d)) << 24) | (((uint32)(c)) << 16) | (((uint32)(b)) << 8) | ((uint32)(a))) #define UINT16(a) ((uint16)B_LENDIAN_TO_HOST_INT16((a)))