MediaExtractor: go back to 3MB min cache size
Should allow us to at least play the same files we could play before. Fixes #16738, though not its cause Change-Id: I2d23011696b730a891c802e8c2bfc23afe0041cf Reviewed-on: https://review.haiku-os.org/c/haiku/+/3628 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
parent
bc1e082b56
commit
67eeb4db48
@ -444,6 +444,11 @@ MediaExtractor::_ExtractorEntry(void* extractor)
|
||||
size_t
|
||||
MediaExtractor::_CalculateChunkBuffer(int32 stream)
|
||||
{
|
||||
// WARNING: magic
|
||||
// Your A/V may skip frames, chunks or not play at all if the cache size
|
||||
// is insufficient. Unfortunately there's currently no safe way to
|
||||
// calculate it.
|
||||
|
||||
size_t cacheSize = 3 * 1024 * 1024;
|
||||
|
||||
const media_format* format = EncodedFormat(stream);
|
||||
@ -452,12 +457,8 @@ MediaExtractor::_CalculateChunkBuffer(int32 stream)
|
||||
int32 rowSize = BPrivate::get_bytes_per_row(format->ColorSpace(),
|
||||
format->Width());
|
||||
if (rowSize > 0) {
|
||||
cacheSize = rowSize * format->Height() * 2;
|
||||
cacheSize = max_c(cacheSize, rowSize * format->Height() * 2);
|
||||
}
|
||||
} else if (format->IsAudio()) {
|
||||
// For audio, have space for 2000 "frames" (that's 2000/44100 = 45ms
|
||||
// at 44100Hz for example)
|
||||
cacheSize = format->AudioFrameSize() * 2000;
|
||||
}
|
||||
return ROUND_UP_TO_PAGE(cacheSize);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user