From a260eb80fb2fd0709a1713385bcd2ca427b58ee8 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sat, 25 Nov 2017 00:53:42 +1100 Subject: [PATCH] qtmux: Always update reserved-duration-remaining If a reserved-max-duration is set, we should always track and update the reserved-duration-remaining estimate, even if we're not sending periodic moov updates downstream for full robust muxing. --- gst/isomp4/gstqtmux.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/gst/isomp4/gstqtmux.c b/gst/isomp4/gstqtmux.c index 31c8de032c..f9364f3ad2 100644 --- a/gst/isomp4/gstqtmux.c +++ b/gst/isomp4/gstqtmux.c @@ -3780,6 +3780,18 @@ gst_qt_mux_robust_recording_update (GstQTMux * qtmux, GstClockTime position) guint64 mdat_offset = qtmux->mdat_pos + 16 + qtmux->mdat_size; GST_OBJECT_LOCK (qtmux); + + /* Update the offset of how much we've muxed, so the + * report of remaining space keeps counting down */ + if (position > qtmux->last_moov_update && + position - qtmux->last_moov_update > qtmux->muxed_since_last_update) { + GST_LOG_OBJECT (qtmux, + "Muxed time %" G_GUINT64_FORMAT " since last moov update", + qtmux->muxed_since_last_update); + qtmux->muxed_since_last_update = position - qtmux->last_moov_update; + } + + /* Next, check if we're supposed to send periodic moov updates downstream */ if (qtmux->reserved_moov_update_period == GST_CLOCK_TIME_NONE) { GST_OBJECT_UNLOCK (qtmux); return GST_FLOW_OK; @@ -3790,15 +3802,6 @@ gst_qt_mux_robust_recording_update (GstQTMux * qtmux, GstClockTime position) (position <= qtmux->last_moov_update || (position - qtmux->last_moov_update) < qtmux->reserved_moov_update_period)) { - /* Update the offset of how much we've muxed, so the - * report of remaining space keeps counting down */ - if (position > qtmux->last_moov_update && - position - qtmux->last_moov_update > qtmux->muxed_since_last_update) { - GST_LOG_OBJECT (qtmux, - "Muxed time %" G_GUINT64_FORMAT " since last moov update", - qtmux->muxed_since_last_update); - qtmux->muxed_since_last_update = position - qtmux->last_moov_update; - } GST_OBJECT_UNLOCK (qtmux); return GST_FLOW_OK; /* No update needed yet */ }