added support to disable the chunk cache for debugging
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9487 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
88debd334e
commit
bf0aa2f9bb
@ -93,7 +93,7 @@ ChunkCache::PutNextChunk(void *chunkBuffer, int32 chunkSize, const media_header
|
||||
|
||||
if (err == B_OK) {
|
||||
if (fNextPut->sizeMax < chunkSize) {
|
||||
// printf("ChunkCache::PutNextChunk: %p resizing from %ld to %ld\n", fNextPut, fNextPut->sizeMax, chunkSize);
|
||||
printf("ChunkCache::PutNextChunk: %p resizing from %ld to %ld\n", fNextPut, fNextPut->sizeMax, chunkSize);
|
||||
free(fNextPut->buffer);
|
||||
fNextPut->buffer = malloc((chunkSize + 1024) & ~1023);
|
||||
fNextPut->sizeMax = chunkSize;
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
// should be 0, to disable the chunk cache set it to 1
|
||||
#define DISABLE_CHUNK_CACHE 0
|
||||
|
||||
MediaExtractor::MediaExtractor(BDataIO *source, int32 flags)
|
||||
{
|
||||
@ -62,10 +64,12 @@ MediaExtractor::MediaExtractor(BDataIO *source, int32 flags)
|
||||
}
|
||||
}
|
||||
|
||||
#if DISABLE_CHUNK_CACHE == 0
|
||||
// start extractor thread
|
||||
fExtractorWaitSem = create_sem(1, "media extractor thread sem");
|
||||
fExtractorThread = spawn_thread(extractor_thread, "media extractor thread", 10, this);
|
||||
resume_thread(fExtractorThread);
|
||||
resume_thread(fExtractorThread);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -182,6 +186,12 @@ MediaExtractor::GetNextChunk(int32 stream,
|
||||
void **chunkBuffer, int32 *chunkSize,
|
||||
media_header *mediaHeader)
|
||||
{
|
||||
#if DISABLE_CHUNK_CACHE > 0
|
||||
static BLocker locker;
|
||||
BAutolock lock(locker);
|
||||
return fReader->GetNextChunk(fStreamInfo[stream].cookie, chunkBuffer, chunkSize, mediaHeader);
|
||||
#endif
|
||||
|
||||
status_t err;
|
||||
err = fStreamInfo[stream].chunkCache->GetNextChunk(chunkBuffer, chunkSize, mediaHeader);
|
||||
release_sem(fExtractorWaitSem);
|
||||
|
Loading…
Reference in New Issue
Block a user