From: Vishwanath Dixit <vdi...@akamai.com> For live HLS/DASH output usecases, currently ffmpeg application exits for any network error during muxing. However, some of the errors like EPIPE, ECONNREFUSED and ECONNRESET are non-fatal. They might cause temporary disruption. However, muxer can recover and continue further processing. --- libavformat/internal.h | 11 +++++++++++ libavformat/utils.c | 10 ++++++++++ 2 files changed, 21 insertions(+)
diff --git a/libavformat/internal.h b/libavformat/internal.h index a020b1b..e56f867 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -731,6 +731,17 @@ int ff_unlock_avformat(void); */ void ff_format_set_url(AVFormatContext *s, char *url); +/** + * Handle error. + * Ignores network errors EPIPE, ECONNREFUSED and ECONNRESET + * + * @param s AVFormatContext + * @param err error code + * @param ignore_nw_err flag to ignore network errors + * @return 0 if error is ignored, else err + */ +int av_handle_error(AVFormatContext *s, int err, int ignore_nw_err); + #if FF_API_NEXT /** * Register devices in deprecated format linked list. diff --git a/libavformat/utils.c b/libavformat/utils.c index f13c820..a942ad0 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -5658,3 +5658,13 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif } + +int av_handle_error(AVFormatContext *s, int err, int ignore_nw_err) { + if (err && ff_is_http_proto(s->url) && ignore_nw_err && + (err == AVERROR(EPIPE) || err == AVERROR(ECONNREFUSED) || + err == AVERROR(ECONNRESET))) { + av_log(s, AV_LOG_WARNING, "Ignored network error %d\n", err); + return 0; + } + return err; +} -- 1.9.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel