avformat/mov: Set start_pad correctly in mov_fix_index()
authorDale Curtis <dalecurtis@chromium.org>
Mon, 16 Oct 2017 21:17:35 +0000 (14:17 -0700)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 21 Oct 2017 01:12:43 +0000 (03:12 +0200)
Sets the correct start padding value when an edit list is present.

A new fate test is added, fate-mov-440hz-10ms, to ensure this is
handled correctly.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Sasi Inguva <isasi-at-google.com@ffmpeg.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mov.c
tests/fate/mov.mak
tests/ref/fate/mov-440hz-10ms [new file with mode: 0644]

index b22a116..573f134 100644 (file)
@@ -3249,7 +3249,6 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
                         // Increment skip_samples for the first non-zero audio edit list
                         if (first_non_zero_audio_edit > 0 && st->codecpar->codec_id != AV_CODEC_ID_VORBIS) {
                             st->skip_samples += frame_duration;
-                            msc->start_pad = st->skip_samples;
                         }
                     }
                 }
@@ -3323,6 +3322,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
 
     // Update av stream length
     st->duration = edit_list_dts_entry_end - start_dts;
+    msc->start_pad = st->skip_samples;
 
     // Free the old index and the old CTTS structures
     av_free(e_old);
index cfdada7..5013e7d 100644 (file)
@@ -7,6 +7,7 @@ FATE_MOV = fate-mov-3elist \
            fate-mov-2elist-elist1-ends-bframe \
            fate-mov-3elist-encrypted \
            fate-mov-gpmf-remux \
+           fate-mov-440hz-10ms \
 
 FATE_MOV_FFPROBE = fate-mov-aac-2048-priming \
                    fate-mov-zombie \
@@ -39,6 +40,9 @@ fate-mov-1elist-ends-last-bframe: CMD = framemd5 -i $(TARGET_SAMPLES)/mov/mov-1e
 # Makes sure that we handle timestamps of packets in case of multiple edit lists with one of them ending on a B-frame correctly.
 fate-mov-2elist-elist1-ends-bframe: CMD = framemd5 -i $(TARGET_SAMPLES)/mov/mov-2elist-elist1-ends-bframe.mov
 
+# Makes sure that we handle edit lists and start padding correctly.
+fate-mov-440hz-10ms: CMD = framemd5 -i $(TARGET_SAMPLES)/mov/440hz-10ms.m4a
+
 fate-mov-aac-2048-priming: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_packets -print_format compact $(TARGET_SAMPLES)/mov/aac-2048-priming.mov
 
 fate-mov-zombie: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_streams -show_packets -show_frames -bitexact -print_format compact $(TARGET_SAMPLES)/mov/white_zombie_scrunch-part.mov
diff --git a/tests/ref/fate/mov-440hz-10ms b/tests/ref/fate/mov-440hz-10ms
new file mode 100644 (file)
index 0000000..498879e
--- /dev/null
@@ -0,0 +1,11 @@
+#format: frame checksums
+#version: 2
+#hash: MD5
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: pcm_s16le
+#sample_rate 0: 44100
+#channel_layout 0: 4
+#channel_layout_name 0: mono
+#stream#, dts,        pts, duration,     size, hash
+0,          0,          0,      960,     1920, 44e7e48ff08835ce30e93c7971dae7df