This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch release/8.1
in repository ffmpeg.

commit f45b8e759d30281518aeb363dce68a3280db2b88
Author:     Baptiste Coudurier <[email protected]>
AuthorDate: Sun Nov 22 22:34:38 2026 -0800
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Mon Nov 30 06:20:49 2026 +0100

    avformat/movenc: drop CENC entries of every track in a shared moof
    
    Only the first track was flushed, so later tracks repeated stale IVs in 
senc.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Signed-off-by: Baptiste Coudurier <[email protected]>
    (cherry picked from commit 4ead07cd8c1e059533eb8346b2a5afb676c3cb83)
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavformat/movenc.c                     |  5 ++---
 tests/fate/mov.mak                       |  6 ++++++
 tests/ref/fate/mov-aac-cenc-frag-2tracks | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 10bf34dfa3..5b66ba4479 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6508,6 +6508,8 @@ static int mov_finish_fragment(MOVMuxContext *mov, 
MOVTrack *track,
                track->cluster, track->entry * sizeof(*track->cluster));
         track->entry_written += track->entry;
     }
+    if (track->cenc.aes_ctr)
+        ff_mov_cenc_flush(&track->cenc);
     track->entry = 0;
     track->entries_flushed = 0;
     track->end_reliable = 0;
@@ -6694,9 +6696,6 @@ 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/tests/fate/mov.mak b/tests/fate/mov.mak
index 1572d53499..41ecad8fa5 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -199,6 +199,12 @@ fate-mov-av1-cenc: CMD = transcode ivf 
$(TARGET_SAMPLES)/av1/non_uniform_tiling.
     "-c:v copy -encryption_scheme cenc-aes-ctr -encryption_key 
00112233445566778899aabbccddeeff -encryption_kid 
00112233445566778899aabbccddeeff" \
     "-c:v copy" "" "" "-decryption_key 00112233445566778899aabbccddeeff"
 
+# Two encrypted tracks sharing each moof.
+FATE_MOV_FFMPEG_SAMPLES-$(call REMUX, MP4 MOV, AAC_DECODER) += 
fate-mov-aac-cenc-frag-2tracks
+fate-mov-aac-cenc-frag-2tracks: CMD = transcode mp4 
$(TARGET_SAMPLES)/aac/al04_44.mp4 mp4 \
+  "-map 0:a -map 0:a -t 0.2 -c:a copy -movflags +empty_moov -frag_duration 
50000 -encryption_scheme cenc-aes-ctr -encryption_key 
00112233445566778899aabbccddeeff -encryption_kid 
00112233445566778899aabbccddeeff" \
+  "-map 0:a -c copy" "" "" "-decryption_key 00112233445566778899aabbccddeeff"
+
 # avif demuxing - still image with 1 item.
 FATE_MOV_FFMPEG_SAMPLES-$(call FRAMECRC, MOV, AV1, AV1_PARSER) \
                            += fate-mov-avif-demux-still-image-1-item
diff --git a/tests/ref/fate/mov-aac-cenc-frag-2tracks 
b/tests/ref/fate/mov-aac-cenc-frag-2tracks
new file mode 100644
index 0000000000..6c7c42d242
--- /dev/null
+++ b/tests/ref/fate/mov-aac-cenc-frag-2tracks
@@ -0,0 +1,32 @@
+3b0776d908610020362871293547dcc7 *tests/data/fate/mov-aac-cenc-frag-2tracks.mp4
+6099 tests/data/fate/mov-aac-cenc-frag-2tracks.mp4
+#extradata 0:        9, 0x0320011c
+#extradata 1:        9, 0x0320011c
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: aac
+#sample_rate 0: 44100
+#channel_layout_name 0: mono
+#tb 1: 1/44100
+#media_type 1: audio
+#codec_id 1: aac
+#sample_rate 1: 44100
+#channel_layout_name 1: mono
+0,          0,          0,     1024,      194, 0xd4bd423e
+1,          0,          0,     1024,      194, 0xd4bd423e
+0,       1024,       1024,     1024,      169, 0xb6834b02
+1,       1024,       1024,     1024,      169, 0xb6834b02
+0,       2048,       2048,     1024,      197, 0xc5f75be9
+1,       2048,       2048,     1024,      197, 0xc5f75be9
+0,       3072,       3072,     1024,      200, 0x65be5ab8
+1,       3072,       3072,     1024,      200, 0x65be5ab8
+0,       4096,       4096,     1024,      193, 0x130c5a84
+1,       4096,       4096,     1024,      193, 0x130c5a84
+0,       5120,       5120,     1024,      183, 0x7d505262
+1,       5120,       5120,     1024,      183, 0x7d505262
+0,       6144,       6144,     1024,      203, 0xf8665d27
+1,       6144,       6144,     1024,      203, 0xf8665d27
+0,       7168,       7168,     1024,      191, 0x4f765d5d
+1,       7168,       7168,     1024,      191, 0x4f765d5d
+0,       8192,       8192,     1024,      196, 0x4ac86327
+1,       8192,       8192,     1024,      196, 0x4ac86327

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to