avformat/matroskaenc: Don't reserve space for duration when unseekable
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 2 May 2020 15:46:09 +0000 (17:46 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 18 May 2020 23:03:05 +0000 (01:03 +0200)
We won't be able to seek back to write the actual duration anyway.

FATE-tests using the md5pipe command had to be updated due to this change.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/matroskaenc.c
tests/fate/matroska.mak
tests/fate/wavpack.mak
tests/ref/fate/binsub-mksenc

index ccbd73c..10b64e2 100644 (file)
@@ -1869,7 +1869,7 @@ static int mkv_write_header(AVFormatContext *s)
             int64_t scaledDuration = av_rescale(metadata_duration, 1000, AV_TIME_BASE);
             put_ebml_float(pb, MATROSKA_ID_DURATION, scaledDuration);
             av_log(s, AV_LOG_DEBUG, "Write early duration from metadata = %" PRIu64 "\n", scaledDuration);
-        } else {
+        } else if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) {
             put_ebml_void(pb, 11);              // assumes double-precision float to be written
         }
     }
index 1d29211..b69f979 100644 (file)
@@ -12,7 +12,7 @@ fate-matroska-prores-header-insertion-bz2: CMD = framecrc -i $(TARGET_SAMPLES)/m
 FATE_MATROSKA-$(call DEMMUX, MATROSKA, MATROSKA) += fate-matroska-remux
 fate-matroska-remux: CMD = md5pipe -i $(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-2pass-akiyo.webm -color_trc 4 -c:v copy -fflags +bitexact -strict -2 -f matroska
 fate-matroska-remux: CMP = oneline
-fate-matroska-remux: REF = 8369f24de64aaa52cf57a699dcdc7d58
+fate-matroska-remux: REF = acaf96f1832264d7f2845b16dd4ab082
 
 FATE_MATROSKA-$(call ALLYES, MATROSKA_DEMUXER VORBIS_PARSER) += fate-matroska-xiph-lacing
 fate-matroska-xiph-lacing: CMD = framecrc -i $(TARGET_SAMPLES)/mkv/xiph_lacing.mka -c:a copy
index c62b3ce..f98eaf9 100644 (file)
@@ -91,12 +91,12 @@ fate-wavpack-matroskamode: CMD = md5 -i $(TARGET_SAMPLES)/wavpack/special/matros
 FATE_WAVPACK-$(call DEMMUX, WV, MATROSKA) += fate-wavpack-matroska_mux-mono
 fate-wavpack-matroska_mux-mono: CMD = md5pipe -i $(TARGET_SAMPLES)/wavpack/num_channels/mono_16bit_int.wv -c copy -fflags +bitexact -f matroska
 fate-wavpack-matroska_mux-mono: CMP = oneline
-fate-wavpack-matroska_mux-mono: REF = a378996c1bb5a54998fc804fb1ad97b1
+fate-wavpack-matroska_mux-mono: REF = 5388d452e84958d204de9974bb4e3947
 
 FATE_WAVPACK-$(call DEMMUX, WV, MATROSKA) += fate-wavpack-matroska_mux-61
 fate-wavpack-matroska_mux-61: CMD = md5pipe -i $(TARGET_SAMPLES)/wavpack/num_channels/eva_2.22_6.1_16bit-partial.wv -c copy -fflags +bitexact -f matroska
 fate-wavpack-matroska_mux-61: CMP = oneline
-fate-wavpack-matroska_mux-61: REF = 3d708dfce5ac85df114ea91b30143708
+fate-wavpack-matroska_mux-61: REF = c28c51910fc8f3806b1ada1efc82ccae
 
 FATE_SAMPLES_AVCONV += $(FATE_WAVPACK-yes)
 fate-wavpack: $(FATE_WAVPACK-yes)
index b4c08e5..48a7a56 100644 (file)
@@ -1 +1 @@
-3dd15fa67a1df541aa89565ceb7047cf
+8f355f39124753f89ead698e66f98098