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.
This commit is contained in:
wm4 2018-03-01 21:48:55 +01:00 committed by Jan Ekström
parent 6f5f92feab
commit 14c2f20bff
1 changed files with 2 additions and 1 deletions

View File

@ -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;