From 20754db26f9e05815fd09202ec9f6208446ed7ac Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Wed, 22 Jul 2015 17:45:12 +0200 Subject: [PATCH] splitmuxsink: initialize mux_start_time properly mux_start_time refers to the running_time of the buffer that goes first in the output file. Normally this time is 0, so this variable is initialized to 0 during the state change to PAUSED. However, when dealing with dynamic pipelines and starting a recording while the pipeline has already run for a while, the running_time of the first buffer is > 0 and this causes a problem with detecting the end of the first file(s) when splitting by duration, because the code will later compare the threshold_time with (last buffer running_time - mux_start_time) and will get it wrong until mux_start_time advances enough to make this difference < threshold_time, creating empty files in the meantime. https://bugzilla.gnome.org/show_bug.cgi?id=753624 --- gst/multifile/gstsplitmuxsink.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gst/multifile/gstsplitmuxsink.c b/gst/multifile/gstsplitmuxsink.c index 97b0186de6..1b037d4dea 100644 --- a/gst/multifile/gstsplitmuxsink.c +++ b/gst/multifile/gstsplitmuxsink.c @@ -1036,6 +1036,10 @@ handle_mq_input (GstPad * pad, GstPadProbeInfo * info, MqStreamCtx * ctx) /* Update total input byte counter for overflow detect */ ctx->in_bytes += buf_info->buf_size; + /* initialize mux_start_time */ + if (ctx->is_reference && splitmux->mux_start_time == 0) + splitmux->mux_start_time = buf_info->run_ts; + GST_DEBUG_OBJECT (pad, "Buf TS %" GST_TIME_FORMAT " total in_bytes %" G_GSIZE_FORMAT, GST_TIME_ARGS (buf_info->run_ts), ctx->in_bytes);