From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] avformat/demux: Add allow_codec_changes option to AVFormatContext (v2)
Date: Sat, 21 Jun 2025 23:38:18 +0200
Message-ID: <20250621213818.GX29660@pb2> (raw)
In-Reply-To: <CAJgjuozXiwWmJOqhh8AJnzwp7HFUZrZZsirof4vciU22L0zebg@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 2443 bytes --]
On Sat, Jun 21, 2025 at 03:26:58PM -0600, Pavel Koshevoy wrote:
> On Sat, Jun 21, 2025 at 3:21 PM Michael Niedermayer <michael@niedermayer.cc>
> wrote:
>
> > On Tue, Jun 17, 2025 at 08:36:59AM -0600, Pavel Koshevoy wrote:
> > > Make runtime AVStream.codecpar codec_id updates optional and disabled
> > > by default, so that avformat API clients can enable this feature
> > explicitly
> > > when they add support for runtime codec changes.
> > >
> > > Accordingly, codec_close should not assume that the codec_id cannot
> > change.
> > > This fixes 'ffprobe 1_poc.mp4' segfault introduced with
> > > commit 0021484d05f9b0f032fa319399de6e24eea0c04f.
> > > ---
> > > doc/APIchanges | 3 +++
> > > doc/formats.texi | 6 ++++++
> > > libavformat/avformat.h | 10 ++++++++++
> > > libavformat/demux.c | 8 +++++++-
> > > libavformat/mpegts.c | 4 +++-
> > > libavformat/options_table.h | 1 +
> > > libavformat/version.h | 2 +-
> > > tests/fate/demux.mak | 2 +-
> > > 8 files changed, 32 insertions(+), 4 deletions(-)
> >
> > [...]
> >
> > > diff --git a/libavformat/demux.c b/libavformat/demux.c
> > > index ecd4f40da9..3749ab67a3 100644
> > > --- a/libavformat/demux.c
> > > +++ b/libavformat/demux.c
> > > @@ -1292,9 +1292,15 @@ static int codec_close(FFStream *sti)
> > > {
> > > AVCodecContext *avctx_new = NULL;
> > > AVCodecParameters *par_tmp = NULL;
> > > + const AVCodec *new_codec = NULL;
> > > int ret;
> > >
> > > - avctx_new = avcodec_alloc_context3(sti->avctx->codec);
> > > + new_codec =
> > > + (sti->avctx->codec_id != sti->pub.codecpar->codec_id) ?
> > > + avcodec_find_decoder(sti->pub.codecpar->codec_id) :
> > > + sti->avctx->codec;
> > > +
> > > + avctx_new = avcodec_alloc_context3(new_codec);
> > > if (!avctx_new) {
> > > ret = AVERROR(ENOMEM);
> > > goto fail;
> >
> > this should be a seperate patch
> >
>
> It already exists as a separate patch:
> https://ffmpeg.org/pipermail/ffmpeg-devel/2025-June/344890.html
it should not be in "avformat/demux: Add allow_codec_changes option to AVFormatContext"
the allow_codec_changes patch is ok without this
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No great genius has ever existed without some touch of madness. -- Aristotle
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
next prev parent reply other threads:[~2025-06-21 21:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-17 14:36 Pavel Koshevoy
2025-06-17 18:39 ` Marton Balint
2025-06-17 19:38 ` Pavel Koshevoy
2025-06-17 20:46 ` Michael Niedermayer
2025-06-20 17:06 ` Pavel Koshevoy
2025-06-21 21:21 ` Michael Niedermayer
2025-06-21 21:26 ` Pavel Koshevoy
2025-06-21 21:38 ` Michael Niedermayer [this message]
2025-06-21 23:30 ` Pavel Koshevoy
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=20250621213818.GX29660@pb2 \
--to=michael@niedermayer.cc \
--cc=ffmpeg-devel@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