ffmpeg: do not compute a duration for streaming streams.
Streaming means the stream is endless, so don't compute a duration. ffmpeg computes an estimation using what it thinks is the file size, but is instead some internal buffer size from BAdapterIO. Fixes second part of #14326.
This commit is contained in:
@@ -1740,8 +1740,9 @@ AVCodecDecoder::_InitFilterGraph(enum AVPixelFormat pixfmt, int32 width,
|
|||||||
fFilterGraph = avfilter_graph_alloc();
|
fFilterGraph = avfilter_graph_alloc();
|
||||||
|
|
||||||
BString arguments;
|
BString arguments;
|
||||||
arguments.SetToFormat("buffer=video_size=%dx%d:pix_fmt=%d:time_base=1/1:"
|
arguments.SetToFormat("buffer=video_size=%" B_PRId32 "x%" B_PRId32
|
||||||
"pixel_aspect=0/1[in];[in]yadif[out];[out]buffersink", width, height,
|
":pix_fmt=%d:time_base=1/1:pixel_aspect=0/1[in];[in]yadif[out];"
|
||||||
|
"[out]buffersink", width, height,
|
||||||
pixfmt);
|
pixfmt);
|
||||||
AVFilterInOut* inputs = NULL;
|
AVFilterInOut* inputs = NULL;
|
||||||
AVFilterInOut* outputs = NULL;
|
AVFilterInOut* outputs = NULL;
|
||||||
|
|||||||
@@ -429,6 +429,12 @@ StreamBase::Duration() const
|
|||||||
// for a couple of streams and are in line with the documentation, but
|
// for a couple of streams and are in line with the documentation, but
|
||||||
// unfortunately, libavformat itself seems to set the time_base and
|
// unfortunately, libavformat itself seems to set the time_base and
|
||||||
// duration wrongly sometimes. :-(
|
// duration wrongly sometimes. :-(
|
||||||
|
|
||||||
|
int32 flags;
|
||||||
|
fSource->GetFlags(&flags);
|
||||||
|
if ((flags & B_MEDIA_STREAMING) != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if ((int64)fStream->duration != AV_NOPTS_VALUE)
|
if ((int64)fStream->duration != AV_NOPTS_VALUE)
|
||||||
return _ConvertFromStreamTimeBase(fStream->duration);
|
return _ConvertFromStreamTimeBase(fStream->duration);
|
||||||
else if ((int64)fContext->duration != AV_NOPTS_VALUE)
|
else if ((int64)fContext->duration != AV_NOPTS_VALUE)
|
||||||
|
|||||||
Reference in New Issue
Block a user