From 14c2f20bffb09452b427cb58d7c792e05f3ca792 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 1 Mar 2018 21:48:55 +0100 Subject: demux_lavf: don't mess up in streams with unknown size and init segment The return value of stream_get_size() will be -1 if it fails. We shouldn't mess up this value if a mp4 init segment is used. --- demux/demux_lavf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 93117c975c..20cf6429a3 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -257,9 +257,10 @@ static int64_t mp_seek(void *opaque, int64_t pos, int whence) whence == SEEK_CUR ? "cur" : whence == SEEK_SET ? "set" : "size"); if (whence == SEEK_END || whence == AVSEEK_SIZE) { - int64_t end = stream_get_size(stream) + priv->init_fragment.len; + int64_t end = stream_get_size(stream); if (end < 0) return -1; + end += priv->init_fragment.len; if (whence == AVSEEK_SIZE) return end; pos += end; -- cgit v1.2.3