From 8f4ef80fc4662a2cffd363ee69fe4f9f90c38145 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Fri, 28 Nov 2014 14:15:30 -0300 Subject: [PATCH] baseparse: update the duration variable before emitting the bus Otherwise the application might still get the old value if it asks between the message and the real update. --- libs/gst/base/gstbaseparse.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c index bf144478c1..fec1af85a5 100644 --- a/libs/gst/base/gstbaseparse.c +++ b/libs/gst/base/gstbaseparse.c @@ -1543,16 +1543,18 @@ gst_base_parse_update_duration (GstBaseParse * baseparse) /* inform if duration changed, but try to avoid spamming */ parse->priv->estimated_drift += dest_value - parse->priv->estimated_duration; + + parse->priv->estimated_duration = dest_value; + GST_LOG_OBJECT (parse, + "updated estimated duration to %" GST_TIME_FORMAT, + GST_TIME_ARGS (dest_value)); + if (parse->priv->estimated_drift > GST_SECOND || parse->priv->estimated_drift < -GST_SECOND) { gst_element_post_message (GST_ELEMENT (parse), gst_message_new_duration_changed (GST_OBJECT (parse))); parse->priv->estimated_drift = 0; } - parse->priv->estimated_duration = dest_value; - GST_LOG_OBJECT (parse, - "updated estimated duration to %" GST_TIME_FORMAT, - GST_TIME_ARGS (dest_value)); } } }