quiet readpage only speaks on errors. also invokes debugger if sync is lost

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6573 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
shatty 2004-02-13 08:14:04 +00:00
parent 4a66542685
commit 95c8060a66

View File

@ -141,7 +141,7 @@ OggSeekable::GetSize(off_t * size)
status_t
OggSeekable::ReadPage(ogg_page * page, int read_size)
{
TRACE("OggSeekable::ReadPage (%llu)\n", fPosition);
// TRACE("OggSeekable::ReadPage (%llu)\n", fPosition);
BAutolock autolock(fPositionLock);
// align to page boundary
int offset;
@ -150,15 +150,18 @@ OggSeekable::ReadPage(ogg_page * page, int read_size)
char * buffer = ogg_sync_buffer(&fSync, read_size);
ssize_t bytes = fPositionIO->ReadAt(fPosition, buffer, read_size);
if (bytes == 0) {
TRACE("OggSeekable::ReadPage (%llu)\n", fPosition);
TRACE("OggSeekable::ReadPage: ReadAt: no data\n");
return B_LAST_BUFFER_ERROR;
}
if (bytes < 0) {
TRACE("OggSeekable::ReadPage (%llu)\n", fPosition);
TRACE("OggSeekable::ReadPage: ReadAt: error\n");
return bytes;
}
fPosition += bytes;
if (ogg_sync_wrote(&fSync, bytes) != 0) {
TRACE("OggSeekable::ReadPage (%llu)\n", fPosition);
TRACE("OggSeekable::ReadPage: ogg_sync_wrote failed?: error\n");
return B_ERROR;
}
@ -172,24 +175,30 @@ OggSeekable::ReadPage(ogg_page * page, int read_size)
char * buffer = ogg_sync_buffer(&fSync, read_size);
ssize_t bytes = fPositionIO->ReadAt(fPosition, buffer, read_size);
if (bytes == 0) {
TRACE("OggSeekable::ReadPage (%llu)\n", fPosition);
TRACE("OggSeekable::ReadPage: ReadAt 2: no data\n");
return B_LAST_BUFFER_ERROR;
}
if (bytes < 0) {
TRACE("OggSeekable::ReadPage (%llu)\n", fPosition);
TRACE("OggSeekable::ReadPage: ReadAt 2: error\n");
return bytes;
}
fPosition += bytes;
if (ogg_sync_wrote(&fSync, bytes) != 0) {
TRACE("OggSeekable::ReadPage (%llu)\n", fPosition);
TRACE("OggSeekable::ReadPage: ogg_sync_wrote 2 failed?: error\n");
return B_ERROR;
}
}
if (result == -1) {
TRACE("OggSeekable::ReadPage: ogg_sync_pageout: not synced??\n");
TRACE("OggSeekable::ReadPage (%llu)\n", fPosition);
TRACE("OggSeekable::ReadPage: ogg_sync_pageout: not synced!\n");
debugger("lost sync");
return B_ERROR;
}
if (ogg_page_version(page) != 0) {
TRACE("OggSeekable::ReadPage (%llu)\n", fPosition);
TRACE("OggSeekable::ReadPage: ogg_page_version: error in page encoding??\n");
#ifdef STRICT_OGG
return B_ERROR;