Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Jack Lau via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Jack Lau <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PR] avformat: use av_unreachable() to replace unreachable error handling (PR #21731)
Date: Wed, 11 Feb 2026 08:26:20 -0000
Message-ID: <177079838081.25.11090169392050968477@009cbcb3d8cd> (raw)

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 <devrajajmera077@gmail.com>
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 <jacklau1222gm@gmail.com>
---
 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 <jacklau1222gm@gmail.com>
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 <jacklau1222gm@gmail.com>
---
 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 -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2026-02-11  8:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=177079838081.25.11090169392050968477@009cbcb3d8cd \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git