From: James Almer via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: James Almer <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avformat/movenc: clear subsample information on fragment flush (PR #20538)
Date: Wed, 17 Sep 2025 00:47:13 -0000
Message-ID: <175807003420.25.9498237660700720522@463a07221176> (raw)
PR #20538 opened by James Almer (jamrial)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20538
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20538.patch
Don't keep around information from a previous traf atom.
Fixes issue #20492.
>From 9c18a8d1802726c7d59c5d067890b7f2f8c728f4 Mon Sep 17 00:00:00 2001
From: James Almer <jamrial@gmail.com>
Date: Tue, 16 Sep 2025 21:45:00 -0300
Subject: [PATCH] avformat/movenc: clear subsample information on fragment
flush
Don't keep around information from a previous traf atom.
Fixes issue #20492.
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavformat/movenc.c | 3 +++
libavformat/movenccenc.c | 6 ++++++
libavformat/movenccenc.h | 6 ++++++
3 files changed, 15 insertions(+)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index bfe76a2034..067d38b14b 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6592,6 +6592,9 @@ static int mov_flush_fragment(AVFormatContext *s, int force)
mov_write_moof_tag(s->pb, mov, moof_tracks, mdat_size);
mov->fragments++;
+ if (track->cenc.aes_ctr)
+ ff_mov_cenc_flush(&track->cenc);
+
avio_wb32(s->pb, mdat_size + 8);
ffio_wfourcc(s->pb, "mdat");
mdat_start = avio_tell(s->pb);
diff --git a/libavformat/movenccenc.c b/libavformat/movenccenc.c
index 32094ebd7b..e5ae11a9c9 100644
--- a/libavformat/movenccenc.c
+++ b/libavformat/movenccenc.c
@@ -629,6 +629,12 @@ int ff_mov_cenc_init(MOVMuxCencContext* ctx, uint8_t* encryption_key,
return 0;
}
+void ff_mov_cenc_flush(MOVMuxCencContext* ctx)
+{
+ ctx->auxiliary_info_entries = 0;
+ ctx->auxiliary_info_size = 0;
+}
+
void ff_mov_cenc_free(MOVMuxCencContext* ctx)
{
av_aes_ctr_free(ctx->aes_ctr);
diff --git a/libavformat/movenccenc.h b/libavformat/movenccenc.h
index 77a0716c81..f03e2fe6aa 100644
--- a/libavformat/movenccenc.h
+++ b/libavformat/movenccenc.h
@@ -91,6 +91,12 @@ int ff_mov_cenc_avc_write_nal_units(AVFormatContext *s, MOVMuxCencContext* ctx,
int ff_mov_cenc_av1_write_obus(AVFormatContext *s, MOVMuxCencContext* ctx,
AVIOContext *pb, const AVPacket *pkt);
+
+/**
+ * Clear subsample data. To be called for fragmented output.
+ */
+void ff_mov_cenc_flush(MOVMuxCencContext* ctx);
+
/**
* Write the cenc atoms that should reside inside stbl
*/
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
reply other threads:[~2025-09-17 0:47 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=175807003420.25.9498237660700720522@463a07221176 \
--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