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

Git pushed a commit to branch master
in repository ffmpeg.

commit f9e60c91844eab34d4548a43cecc716dcf806168
Author:     Baptiste Coudurier <[email protected]>
AuthorDate: Sun Nov 22 22:36:51 2026 -0800
Commit:     Baptiste Coudurier <[email protected]>
CommitDate: Tue Nov 24 02:32:39 2026 +0000

    avformat/movenc: do not count buffered audio in a delayed empty moov
    
    stts counted the CBR audio samples buffered by delay_moov.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Signed-off-by: Baptiste Coudurier <[email protected]>
---
 libavformat/movenc.c              |  4 +++-
 tests/fate/mov.mak                |  6 ++++++
 tests/ref/fate/mov-pcm-delay-moov | 12 ++++++++++++
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index b4d190c678..ff24578da4 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4660,12 +4660,13 @@ static int mov_write_trak_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContext
     int64_t pos = avio_tell(pb);
     int entry_backup = track->entry;
     int chunk_backup = track->chunkCount;
+    long sample_count_backup = track->sample_count;
     int ret;
 
     /* If we want to have an empty moov, but some samples already have been
      * buffered (delay_moov), pretend that no samples have been written yet. */
     if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV)
-        track->chunkCount = track->entry = 0;
+        track->chunkCount = track->entry = track->sample_count = 0;
 
     avio_wb32(pb, 0); /* size */
     ffio_wfourcc(pb, "trak");
@@ -4707,6 +4708,7 @@ static int mov_write_trak_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContext
     mov_write_track_udta_tag(pb, mov, st);
     track->entry = entry_backup;
     track->chunkCount = chunk_backup;
+    track->sample_count = sample_count_backup;
     return update_size(pb, pos);
 }
 
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 3e554d9098..6e29524d2d 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -287,6 +287,12 @@ fate-mov-aac-cenc-frag-2tracks: CMD = transcode mp4 
$(TARGET_SAMPLES)/aac/al04_4
   "-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"
 
+# The empty moov written by delay_moov must not count the buffered audio.
+FATE_MOV_FFMPEG_FFPROBE-$(call ALLYES, PCM_S16LE_DECODER PCM_S16LE_ENCODER 
WAV_DEMUXER MOV_MUXER MOV_DEMUXER FRAMECRC_MUXER FILE_PROTOCOL PIPE_PROTOCOL) 
+= fate-mov-pcm-delay-moov
+fate-mov-pcm-delay-moov: tests/data/asynth-44100-2.wav
+fate-mov-pcm-delay-moov: CMD = transcode wav 
$(TARGET_PATH)/tests/data/asynth-44100-2.wav mov \
+  "-t 0.05 -c:a pcm_s16le -movflags +delay_moov -frag_duration 25000" "-c:a 
copy" "-show_entries stream=duration_ts,nb_frames"
+
 # avif muxing - still image with 1 item.
 FATE_MOV_FFMPEG_SAMPLES-$(call REMUX, AVIF OBU, AV1_DECODER AV1_PARSER) \
                            += fate-mov-avif-mux-still-image-1-item
diff --git a/tests/ref/fate/mov-pcm-delay-moov 
b/tests/ref/fate/mov-pcm-delay-moov
new file mode 100644
index 0000000000..ea82cf3b0f
--- /dev/null
+++ b/tests/ref/fate/mov-pcm-delay-moov
@@ -0,0 +1,12 @@
+8560b9a8020f9da1b4d4f0a45ab84f3b *tests/data/fate/mov-pcm-delay-moov.mov
+9664 tests/data/fate/mov-pcm-delay-moov.mov
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: pcm_s16le
+#sample_rate 0: 44100
+#channel_layout_name 0: stereo
+0,          0,          0,     2205,     8820, 0xc3813291
+[STREAM]
+duration_ts=2205
+nb_frames=N/A
+[/STREAM]

-- 
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