diff mbox

[FFmpeg-devel] libavformat/hls.c: fix hls_read_seek return error when seek to first_timestamp

Message ID 20190917130052.42418-1-1433100204@qq.com
State New
Headers show

Commit Message

1433100204@qq.com Sept. 17, 2019, 1 p.m. UTC
From: leizhai <leizhai@sohu-inc.com>

---
 libavformat/hls.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 0611ddc6bb..4525862ee8 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2237,7 +2237,12 @@  static int hls_read_seek(AVFormatContext *s, int stream_index,
     }
     /* check if the timestamp is valid for the playlist with the
      * specified stream index */
-    if (!seek_pls || !find_timestamp_in_playlist(c, seek_pls, seek_timestamp, &seq_no))
+
+    /*fix seek to first_timestamp return error bug*/
+    int find_ts_ret = find_timestamp_in_playlist(c, seek_pls, seek_timestamp, &seq_no);
+    if (find_ts_ret == 0 && seq_no == seek_pls->start_seq_no)
+        find_ts_ret = 1;
+    if (!seek_pls || !find_ts_ret)
         return AVERROR(EIO);
 
     /* set segment now so we do not need to search again below */