/* set the start_time to 0, this will cause us to select a new base_time and
* make the running_time start from 0 again. */
static void
-reset_start_time (GstPipeline * pipeline)
+reset_start_time (GstPipeline * pipeline, GstClockTime start_time)
{
GST_OBJECT_LOCK (pipeline);
if (GST_ELEMENT_START_TIME (pipeline) != GST_CLOCK_TIME_NONE) {
GST_DEBUG_OBJECT (pipeline, "reset start_time to 0");
- GST_ELEMENT_START_TIME (pipeline) = 0;
+ GST_ELEMENT_START_TIME (pipeline) = start_time;
pipeline->priv->last_start_time = -1;
} else {
GST_DEBUG_OBJECT (pipeline, "application asked to not reset stream_time");
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
{
- reset_start_time (pipeline);
+ /* READY to PAUSED starts running_time from 0 */
+ reset_start_time (pipeline, 0);
break;
}
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
GstPipeline *pipeline = GST_PIPELINE_CAST (bin);
switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_ASYNC_DONE:
+ case GST_MESSAGE_RESET_TIME:
{
- gboolean reset_time;
+ GstClockTime running_time;
- gst_message_parse_async_done (message, &reset_time);
+ gst_message_parse_reset_time (message, &running_time);
/* reset our running time if we need to distribute a new base_time to the
* children. */
- if (reset_time)
- reset_start_time (pipeline);
-
+ reset_start_time (pipeline, running_time);
break;
}
case GST_MESSAGE_CLOCK_LOST:
/* for throttling and QoS */
GstClockTime earliest_in_time;
GstClockTime throttle_time;
-
- gboolean reset_time;
};
#define DO_RUNNING_AVG(avg,val,size) (((val) + ((size)-1) * (avg)) / (size))
gboolean post_paused = FALSE;
gboolean post_async_done = FALSE;
gboolean post_playing = FALSE;
- gboolean reset_time;
/* we are certainly not playing async anymore now */
basesink->playing_async = FALSE;
next = GST_STATE_NEXT (basesink);
pending = GST_STATE_PENDING (basesink);
post_pending = pending;
- reset_time = basesink->priv->reset_time;
- basesink->priv->reset_time = FALSE;
switch (pending) {
case GST_STATE_PLAYING:
if (post_async_done) {
GST_DEBUG_OBJECT (basesink, "posting async-done message");
gst_element_post_message (GST_ELEMENT_CAST (basesink),
- gst_message_new_async_done (GST_OBJECT_CAST (basesink), reset_time));
+ gst_message_new_async_done (GST_OBJECT_CAST (basesink), FALSE));
}
if (post_playing) {
GST_DEBUG_OBJECT (basesink, "posting PLAYING state change message");
/* FIXME: Casting to GstClockEntry only works because the types
* are the same */
if (G_LIKELY (sink->priv->cached_clock_id != NULL
- && GST_CLOCK_ENTRY_CLOCK ((GstClockEntry *) sink->
- priv->cached_clock_id) == clock)) {
+ && GST_CLOCK_ENTRY_CLOCK ((GstClockEntry *) sink->priv->
+ cached_clock_id) == clock)) {
if (!gst_clock_single_shot_id_reinit (clock, sink->priv->cached_clock_id,
time)) {
gst_clock_id_unref (sink->priv->cached_clock_id);
gst_segment_init (&basesink->segment, GST_FORMAT_UNDEFINED);
}
}
- basesink->priv->reset_time = reset_time;
GST_OBJECT_UNLOCK (basesink);
+
+ if (reset_time) {
+ GST_DEBUG_OBJECT (basesink, "posting reset-time message");
+ gst_element_post_message (GST_ELEMENT_CAST (basesink),
+ gst_message_new_reset_time (GST_OBJECT_CAST (basesink), 0));
+ }
}
static GstFlowReturn
priv->step_unlock = FALSE;
basesink->need_preroll = TRUE;
basesink->playing_async = TRUE;
- basesink->priv->reset_time = FALSE;
priv->current_sstart = GST_CLOCK_TIME_NONE;
priv->current_sstop = GST_CLOCK_TIME_NONE;
priv->eos_rtime = GST_CLOCK_TIME_NONE;