MediaExtractor: access chunk cache only when we have it
Change-Id: I533bb2e25b0756acaaa227cdd06c4067d4120066 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3622 Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
f9b26e4c30
commit
7f9c675629
@@ -125,6 +125,7 @@ MediaExtractor::_Init(BDataIO* source, int32 flags)
|
|||||||
"stream %" B_PRId32 " failed\n", i);
|
"stream %" B_PRId32 " failed\n", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !DISABLE_CHUNK_CACHE
|
||||||
// Allocate our ChunkCache
|
// Allocate our ChunkCache
|
||||||
size_t chunkCacheMaxBytes = _CalculateChunkBuffer(i);
|
size_t chunkCacheMaxBytes = _CalculateChunkBuffer(i);
|
||||||
fStreamInfo[i].chunkCache
|
fStreamInfo[i].chunkCache
|
||||||
@@ -133,6 +134,7 @@ MediaExtractor::_Init(BDataIO* source, int32 flags)
|
|||||||
fInitStatus = B_NO_MEMORY;
|
fInitStatus = B_NO_MEMORY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !DISABLE_CHUNK_CACHE
|
#if !DISABLE_CHUNK_CACHE
|
||||||
@@ -264,14 +266,18 @@ MediaExtractor::Seek(int32 stream, uint32 seekTo, int64* _frame,
|
|||||||
if (info.status != B_OK)
|
if (info.status != B_OK)
|
||||||
return info.status;
|
return info.status;
|
||||||
|
|
||||||
|
#if !DISABLE_CHUNK_CACHE
|
||||||
BAutolock _(info.chunkCache);
|
BAutolock _(info.chunkCache);
|
||||||
|
#endif
|
||||||
|
|
||||||
status_t status = fReader->Seek(info.cookie, seekTo, _frame, _time);
|
status_t status = fReader->Seek(info.cookie, seekTo, _frame, _time);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
#if !DISABLE_CHUNK_CACHE
|
||||||
// clear buffered chunks after seek
|
// clear buffered chunks after seek
|
||||||
info.chunkCache->MakeEmpty();
|
info.chunkCache->MakeEmpty();
|
||||||
|
#endif
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user