[FFmpeg-devel] [PATCH 09/13] avformat/matroskaenc: Don't reserve space for duration when unseekable

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Sat May 2 20:16:56 EEST 2020


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 at gmail.com>
---
This is the one and only place where is_live still differs from
!(pb->seekable & AVIO_SEEKABLE_NORMAL): No duration is ever written when
is_live is set.

 libavformat/matroskaenc.c    | 2 +-
 tests/fate/matroska.mak      | 2 +-
 tests/fate/wavpack.mak       | 4 ++--
 tests/ref/fate/binsub-mksenc | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index ccbd73cbe4..10b64e2965 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -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
         }
     }
diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
index 1d2921194f..b69f9792a8 100644
--- a/tests/fate/matroska.mak
+++ b/tests/fate/matroska.mak
@@ -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
diff --git a/tests/fate/wavpack.mak b/tests/fate/wavpack.mak
index c62b3ceefd..f98eaf9a0b 100644
--- a/tests/fate/wavpack.mak
+++ b/tests/fate/wavpack.mak
@@ -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)
diff --git a/tests/ref/fate/binsub-mksenc b/tests/ref/fate/binsub-mksenc
index b4c08e57dd..48a7a56260 100644
--- a/tests/ref/fate/binsub-mksenc
+++ b/tests/ref/fate/binsub-mksenc
@@ -1 +1 @@
-3dd15fa67a1df541aa89565ceb7047cf
+8f355f39124753f89ead698e66f98098
-- 
2.20.1



More information about the ffmpeg-devel mailing list