mirror of https://github.com/mpv-player/mpv
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:
parent
6f5f92feab
commit
14c2f20bff
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue