1
0
Fork 0

hls: fix seeking to timestamps earlier then the playlist start

Instead of failing, seek to the start of the playlist.
This commit is contained in:
Hendrik Leppkes 2021-02-26 10:52:12 +01:00
parent 6d8e42d489
commit 3afd92c5e3
Signed by: hendrik
GPG Key ID: 846079A4B0A7C1B5
1 changed files with 4 additions and 0 deletions

View File

@ -2454,6 +2454,10 @@ static int hls_read_seek(AVFormatContext *s, int stream_index,
duration = s->duration == AV_NOPTS_VALUE ?
0 : s->duration;
/* bound seeking to the beginning of the stream */
if (seek_timestamp < first_timestamp)
seek_timestamp = first_timestamp;
if (0 < duration && duration < seek_timestamp - first_timestamp)
return AVERROR(EIO);