bad hack to fix sync after seek

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5736 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper 2003-12-23 00:26:45 +00:00
parent a665f2f9e1
commit 0b3cd7531c
2 changed files with 13 additions and 10 deletions

View File

@ -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;
}

View File

@ -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)))