From af8f2a39a0b49397b951192f8615f8ab95c356ef Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 12 Aug 2018 09:49:36 +0200 Subject: [PATCH] ffmpeg: do not compute duration for "mutable size" streams. Fixes #14326 without breaking other things. --- src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp b/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp index d09f40afa6..ccd489e7ce 100644 --- a/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp +++ b/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp @@ -432,7 +432,10 @@ StreamBase::Duration() const int32 flags; fSource->GetFlags(&flags); - if ((flags & B_MEDIA_STREAMING) != 0) + + // "Mutable Size" (ie http streams) means we can't realistically compute + // a duration. So don't let ffmpeg giva (wrong) estimate in this case. + if ((flags & B_MEDIA_MUTABLE_SIZE) != 0) return 0; if ((int64)fStream->duration != AV_NOPTS_VALUE)