diff mbox series

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

Message ID 20210804024136.72626-1-lq@chinaffmpeg.org
State New
Headers show
Series [FFmpeg-devel] avformat/hls: return ret when read_packet get exceptions | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Steven Liu Aug. 4, 2021, 2:41 a.m. UTC
From: Steven Liu <liuqi05@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@gmail.com>
Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
---
 libavformat/hls.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Nicolas George Aug. 4, 2021, 6:18 a.m. UTC | #1
Steven Liu (12021-08-04):
> Subject: Re: [FFmpeg-devel] [PATCH] avformat/hls: return ret when read_packet
>  get exceptions

Nit: FFmpeg does not have exceptions, it has error codes.

Regards,
Steven Liu Aug. 4, 2021, 6:25 a.m. UTC | #2
> 2021年8月4日 下午2:18,Nicolas George <george@nsup.org> 写道:
> 
> Steven Liu (12021-08-04):
>> Subject: Re: [FFmpeg-devel] [PATCH] avformat/hls: return ret when read_packet
>> get exceptions
> 
> Nit: FFmpeg does not have exceptions, it has error codes.
Ok, "avformat/hls: return ret when read_packet return error codes."

> 
> Regards,
> 
> -- 
>  Nicolas George
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

Thanks

Steven Liu
Nicolas George Aug. 4, 2021, 6:30 a.m. UTC | #3
Steven Liu (12021-08-04):
> Ok, "avformat/hls: return ret when read_packet return error codes."

"forward error code" is the idiomatic wording, according to git log.

Regards,
Steven Liu Aug. 4, 2021, 6:32 a.m. UTC | #4
> 2021年8月4日 下午2:30,Nicolas George <george@nsup.org> 写道:
> 
> Steven Liu (12021-08-04):
>> Ok, "avformat/hls: return ret when read_packet return error codes."
> 
> "forward error code" is the idiomatic wording, according to git log.
What about “Return sensible error values and forward error codes.” ?
> 
> Regards,
> 
> -- 
>  Nicolas George
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

Thanks

Steven Liu
diff mbox series

Patch

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,