PR #21731 opened by Jack Lau (JackLau) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21731 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21731.patch
These muxers already set hard dependencies in configure so they cannot be enabled unless the dependencies are enabled So these error handling is unreachable >From 8092a864c855ed4c7199d85f478f438781a21e1e Mon Sep 17 00:00:00 2001 From: Devraj Ajmera <[email protected]> Date: Thu, 5 Feb 2026 21:52:51 +0800 Subject: [PATCH 1/2] avformat/whip: use av_unreachable() to replace the unreachable error handling whip_muxer_select enforce the rtp muxer dependency in configure, so this error should be unreachable. Signed-off-by: Jack Lau <[email protected]> --- libavformat/whip.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavformat/whip.c b/libavformat/whip.c index 8aed0c31e5..83df6b5e41 100644 --- a/libavformat/whip.c +++ b/libavformat/whip.c @@ -1542,11 +1542,8 @@ static int create_rtp_muxer(AVFormatContext *s) whip->udp->flags |= AVIO_FLAG_NONBLOCK; const AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); - if (!rtp_format) { - av_log(whip, AV_LOG_ERROR, "Failed to guess rtp muxer\n"); - ret = AVERROR(ENOSYS); - goto end; - } + if (!rtp_format) + av_unreachable("rtp muxer should be enabled"); /* The UDP buffer size, may greater than MTU. */ buffer_size = MAX_UDP_BUFFER_SIZE; -- 2.52.0 >From 24ef8fcc1167433abd98138ec206f9652843086c Mon Sep 17 00:00:00 2001 From: Jack Lau <[email protected]> Date: Thu, 5 Feb 2026 22:01:55 +0800 Subject: [PATCH 2/2] avformat: use av_unreachable() to replace unreachable error handling These muxers already set hard dependencies in configure so they cannot be enabled unless the dependencies are enabled So these error handling is unreachable Signed-off-by: Jack Lau <[email protected]> --- libavformat/hdsenc.c | 2 +- libavformat/hlsenc.c | 4 ++-- libavformat/rtpenc_mpegts.c | 2 +- libavformat/smoothstreamingenc.c | 2 +- libavformat/webm_chunk.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c index 01efa1f8da..7fdfb5f9d4 100644 --- a/libavformat/hdsenc.c +++ b/libavformat/hdsenc.c @@ -321,7 +321,7 @@ static int hds_write_header(AVFormatContext *s) oformat = av_guess_format("flv", NULL, NULL); if (!oformat) { - return AVERROR_MUXER_NOT_FOUND; + av_unreachable("flv muxer should be enabled"); } c->streams = av_calloc(s->nb_streams, sizeof(*c->streams)); diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index ee64a5a275..2b086ce90a 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -2977,7 +2977,7 @@ static int hls_init(AVFormatContext *s) vs->oformat = av_guess_format("mpegts", NULL, NULL); } if (!vs->oformat) - return AVERROR_MUXER_NOT_FOUND; + av_unreachable("mp4 and mpegts muxer should be enabled"); if (hls->segment_filename) { ret = format_name(hls->segment_filename, &vs->basename, i, vs->varname); @@ -3056,7 +3056,7 @@ static int hls_init(AVFormatContext *s) if (vs->has_subtitle) { vs->vtt_oformat = av_guess_format("webvtt", NULL, NULL); if (!vs->vtt_oformat) - return AVERROR_MUXER_NOT_FOUND; + av_unreachable("webvtt muxer should be enabled"); p = strrchr(vs->m3u8_name, '.'); if (p) diff --git a/libavformat/rtpenc_mpegts.c b/libavformat/rtpenc_mpegts.c index f9ff7e99cd..cbd124e2ba 100644 --- a/libavformat/rtpenc_mpegts.c +++ b/libavformat/rtpenc_mpegts.c @@ -66,7 +66,7 @@ static int rtp_mpegts_write_header(AVFormatContext *s) AVDictionary *rtp_muxer_options = NULL; if (!mpegts_format || !rtp_format) - return AVERROR(ENOSYS); + av_unreachable("mpegts and rtp muxers should be enabled"); mpegts_ctx = avformat_alloc_context(); if (!mpegts_ctx) return AVERROR(ENOMEM); diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c index adf3008003..7f45fe70a6 100644 --- a/libavformat/smoothstreamingenc.c +++ b/libavformat/smoothstreamingenc.c @@ -292,7 +292,7 @@ static int ism_write_header(AVFormatContext *s) oformat = av_guess_format("ismv", NULL, NULL); if (!oformat) { - return AVERROR_MUXER_NOT_FOUND; + av_unreachable("ismv muxer should be enabled"); } c->streams = av_calloc(s->nb_streams, sizeof(*c->streams)); diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c index 57329f1788..96cb0fa4cf 100644 --- a/libavformat/webm_chunk.c +++ b/libavformat/webm_chunk.c @@ -70,7 +70,7 @@ static int webm_chunk_init(AVFormatContext *s) oformat = av_guess_format("webm", s->url, "video/webm"); if (!oformat) - return AVERROR_MUXER_NOT_FOUND; + av_unreachable("webm muxer should be enabled"); ret = avformat_alloc_output_context2(&wc->avf, oformat, NULL, NULL); if (ret < 0) -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
