mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +00:00
baseparse: minor code simplification
Use gst_pad_peer_query_duration() and remove a few unnecessary levels of indentation. Rest of code might looks a bit questionable, but leave it as is for now.
This commit is contained in:
parent
1176fbf6dc
commit
bc1fb2d8b0
1 changed files with 18 additions and 29 deletions
|
@ -1543,27 +1543,19 @@ no_duration_bytes:
|
|||
}
|
||||
|
||||
static void
|
||||
gst_base_parse_update_duration (GstBaseParse * baseparse)
|
||||
gst_base_parse_update_duration (GstBaseParse * parse)
|
||||
{
|
||||
GstPad *peer;
|
||||
GstBaseParse *parse;
|
||||
|
||||
parse = GST_BASE_PARSE (baseparse);
|
||||
|
||||
peer = gst_pad_get_peer (parse->sinkpad);
|
||||
if (peer) {
|
||||
gboolean qres = FALSE;
|
||||
gint64 ptot, dest_value;
|
||||
|
||||
qres = gst_pad_query_duration (peer, GST_FORMAT_BYTES, &ptot);
|
||||
gst_object_unref (GST_OBJECT (peer));
|
||||
if (qres) {
|
||||
if (gst_base_parse_convert (parse, GST_FORMAT_BYTES, ptot,
|
||||
GST_FORMAT_TIME, &dest_value)) {
|
||||
if (!gst_pad_peer_query_duration (parse->sinkpad, GST_FORMAT_BYTES, &ptot))
|
||||
return;
|
||||
|
||||
if (!gst_base_parse_convert (parse, GST_FORMAT_BYTES, ptot,
|
||||
GST_FORMAT_TIME, &dest_value))
|
||||
return;
|
||||
|
||||
/* inform if duration changed, but try to avoid spamming */
|
||||
parse->priv->estimated_drift +=
|
||||
dest_value - parse->priv->estimated_duration;
|
||||
parse->priv->estimated_drift += dest_value - parse->priv->estimated_duration;
|
||||
|
||||
parse->priv->estimated_duration = dest_value;
|
||||
GST_LOG_OBJECT (parse,
|
||||
|
@ -1577,9 +1569,6 @@ gst_base_parse_update_duration (GstBaseParse * baseparse)
|
|||
parse->priv->estimated_drift = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_base_parse_post_bitrates (GstBaseParse * parse, gboolean post_min,
|
||||
|
|
Loading…
Reference in a new issue