[FFmpeg-devel] [PATCH] avformat/hls: return ret when read_packet get exceptions

Steven Liu lq at chinaffmpeg.org
Wed Aug 4 05:41:36 EEST 2021


From: Steven Liu <liuqi05 at kuaishou.com>

Should not modify to AVERROR_EOF value when get error number.
for example: return HTTP ERROR return value when cannot get fragments
from http protocol, for user get the point of problem.

Reported-by: bevis <javashu2012 at gmail.com>
Signed-off-by: Steven Liu <liuqi05 at kuaishou.com>
---
 libavformat/hls.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 3c1b80f60c..21a939cef2 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1461,7 +1461,7 @@ restart:
 reload:
         reload_count++;
         if (reload_count > c->max_reload)
-            return AVERROR_EOF;
+            return ret;
         if (!v->finished &&
             av_gettime_relative() - v->last_load_time >= reload_interval) {
             if ((ret = parse_playlist(c, v->url, v, NULL)) < 0) {
@@ -2283,7 +2283,7 @@ static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
 
         return 0;
     }
-    return AVERROR_EOF;
+    return ret;
 }
 
 static int hls_read_seek(AVFormatContext *s, int stream_index,
-- 
2.25.0



More information about the ffmpeg-devel mailing list