hrev54900 adds 1 changeset to branch 'master'
old head: bc1e082b561daee25c0b67b255ae77d2b0a83e3f
new head: 67eeb4db482d7419ee55702ba706265f3705106c
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=67eeb4db482d+%5Ebc1e082b561d
----------------------------------------------------------------------------
67eeb4db482d: 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@xxxxxxxxx>
[ Máximo Castañeda <antiswen@xxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev54900
Commit: 67eeb4db482d7419ee55702ba706265f3705106c
URL: https://git.haiku-os.org/haiku/commit/?id=67eeb4db482d
Author: Máximo Castañeda <antiswen@xxxxxxxx>
Date: Wed Jan 13 14:36:07 2021 UTC
Committer: Adrien Destugues <pulkomandy@xxxxxxxxx>
Commit-Date: Tue Jan 19 20:29:39 2021 UTC
Ticket: https://dev.haiku-os.org/ticket/16738
----------------------------------------------------------------------------
1 file changed, 6 insertions(+), 5 deletions(-)
src/kits/media/MediaExtractor.cpp | 11 ++++++-----
----------------------------------------------------------------------------
diff --git a/src/kits/media/MediaExtractor.cpp
b/src/kits/media/MediaExtractor.cpp
index 3019b4dada..b17491c07b 100644
--- a/src/kits/media/MediaExtractor.cpp
+++ b/src/kits/media/MediaExtractor.cpp
@@ -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);
}