summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-03-01 21:48:55 +0100
committerJan Ekström <jeebjp@gmail.com>2018-03-03 02:38:01 +0200
commit14c2f20bffb09452b427cb58d7c792e05f3ca792 (patch)
treeb96abecc9b3ef2a532c500f3340746fe7c1beb67
parent6f5f92feab6d8848ba68cc8b9b838a7e3ac48d61 (diff)
downloadmpv-14c2f20bffb09452b427cb58d7c792e05f3ca792.tar.bz2
mpv-14c2f20bffb09452b427cb58d7c792e05f3ca792.tar.xz
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.
-rw-r--r--demux/demux_lavf.c3
1 files changed, 2 insertions, 1 deletions
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;