diff --git a/subprojects/gstreamer/libs/gst/base/gstaggregator.c b/subprojects/gstreamer/libs/gst/base/gstaggregator.c index 1f413a3202..3a152e49bf 100644 --- a/subprojects/gstreamer/libs/gst/base/gstaggregator.c +++ b/subprojects/gstreamer/libs/gst/base/gstaggregator.c @@ -879,6 +879,25 @@ gst_aggregator_wait_and_check (GstAggregator * self, gboolean * timeout) return FALSE; } + if (self->priv->force_live && self->priv->first_buffer + && self->priv->start_time_selection == + GST_AGGREGATOR_START_TIME_SELECTION_FIRST) { + GstClockTime start_time; + GstAggregatorPad *srcpad = GST_AGGREGATOR_PAD (self->srcpad); + start_time = gst_element_get_current_running_time (GST_ELEMENT (self)); + + if (GST_CLOCK_TIME_IS_VALID (start_time)) { + if (srcpad->segment.position == -1) + srcpad->segment.position = start_time; + else + srcpad->segment.position = MIN (start_time, srcpad->segment.position); + + GST_DEBUG_OBJECT (self, "Selecting start time %" GST_TIME_FORMAT, + GST_TIME_ARGS (start_time)); + self->priv->first_buffer = FALSE; + } + } + start = gst_aggregator_get_next_time (self); /* If we're not live, or if we use the running time