diff options
author | Zebediah Figura <z.figura12@gmail.com> | 2020-02-10 16:35:06 -0600 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2020-02-15 00:14:10 +0000 |
commit | b52c8fc2b2f94762dc56d54555b6f0e1bfffaeb2 (patch) | |
tree | cbc5eb1f59ed969bc54e8b1afe50f5caac4b1907 | |
parent | a1c0ca3ac04cab42ead6cf34849dc1678f7f7ef9 (diff) | |
download | gstreamer-b52c8fc2b2f94762dc56d54555b6f0e1bfffaeb2.tar.gz |
baseparse: Set the private duration before posting a duration-changed message
Otherwise an application cannot rely on a subsequent call to e.g. gst_pad_query_duration() succeeding.
-rw-r--r-- | libs/gst/base/gstbaseparse.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c index ce6895650e..5c9e5c5ee6 100644 --- a/libs/gst/base/gstbaseparse.c +++ b/libs/gst/base/gstbaseparse.c @@ -3795,6 +3795,8 @@ void gst_base_parse_set_duration (GstBaseParse * parse, GstFormat fmt, gint64 duration, gint interval) { + gint64 old_duration; + g_return_if_fail (parse != NULL); if (parse->priv->upstream_has_duration) { @@ -3802,14 +3804,8 @@ gst_base_parse_set_duration (GstBaseParse * parse, goto exit; } - if (duration != parse->priv->duration) { - GstMessage *m; + old_duration = parse->priv->duration; - m = gst_message_new_duration_changed (GST_OBJECT (parse)); - gst_element_post_message (GST_ELEMENT (parse), m); - - /* TODO: what about duration tag? */ - } parse->priv->duration = duration; parse->priv->duration_fmt = fmt; GST_DEBUG_OBJECT (parse, "set duration: %" G_GINT64_FORMAT, duration); @@ -3821,6 +3817,14 @@ gst_base_parse_set_duration (GstBaseParse * parse, } GST_DEBUG_OBJECT (parse, "set update interval: %d", interval); parse->priv->update_interval = interval; + if (duration != old_duration) { + GstMessage *m; + + m = gst_message_new_duration_changed (GST_OBJECT (parse)); + gst_element_post_message (GST_ELEMENT (parse), m); + + /* TODO: what about duration tag? */ + } exit: return; } |