mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-21 05:26:23 +00:00
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.
This commit is contained in:
parent
733246f1b4
commit
d28e0b4147
1 changed files with 11 additions and 7 deletions
|
@ -3840,6 +3840,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) {
|
||||
|
@ -3847,14 +3849,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);
|
||||
|
@ -3866,6 +3862,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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue