mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
Improve and fix LATENCY query handling
This now follows the design docs everywhere. https://bugzilla.gnome.org/show_bug.cgi?id=744106
This commit is contained in:
parent
ee8d67ef2c
commit
4a5ce862a2
5 changed files with 16 additions and 8 deletions
|
@ -413,6 +413,7 @@ gst_query_set_latency (GstQuery * query, gboolean live,
|
|||
GstStructure *structure;
|
||||
|
||||
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY);
|
||||
g_return_if_fail (GST_CLOCK_TIME_IS_VALID (min_latency));
|
||||
|
||||
structure = GST_QUERY_STRUCTURE (query);
|
||||
gst_structure_id_set (structure,
|
||||
|
|
|
@ -3754,6 +3754,9 @@ void
|
|||
gst_base_parse_set_latency (GstBaseParse * parse, GstClockTime min_latency,
|
||||
GstClockTime max_latency)
|
||||
{
|
||||
g_return_if_fail (min_latency != GST_CLOCK_TIME_NONE);
|
||||
g_return_if_fail (min_latency <= max_latency);
|
||||
|
||||
GST_OBJECT_LOCK (parse);
|
||||
parse->priv->min_latency = min_latency;
|
||||
parse->priv->max_latency = max_latency;
|
||||
|
@ -3923,9 +3926,10 @@ gst_base_parse_src_query_default (GstBaseParse * parse, GstQuery * query)
|
|||
|
||||
GST_OBJECT_LOCK (parse);
|
||||
/* add our latency */
|
||||
if (min_latency != -1)
|
||||
min_latency += parse->priv->min_latency;
|
||||
if (max_latency != -1)
|
||||
min_latency += parse->priv->min_latency;
|
||||
if (max_latency == -1 || parse->priv->max_latency == -1)
|
||||
max_latency = -1;
|
||||
else
|
||||
max_latency += parse->priv->max_latency;
|
||||
GST_OBJECT_UNLOCK (parse);
|
||||
|
||||
|
|
|
@ -1086,8 +1086,7 @@ gst_base_sink_query_latency (GstBaseSink * sink, gboolean * live,
|
|||
}
|
||||
if (l) {
|
||||
/* we need to add the render delay if we are live */
|
||||
if (min != -1)
|
||||
min += render_delay;
|
||||
min += render_delay;
|
||||
if (max != -1)
|
||||
max += render_delay;
|
||||
}
|
||||
|
|
|
@ -726,7 +726,7 @@ gst_base_src_query_latency (GstBaseSrc * src, gboolean * live,
|
|||
if (min_latency)
|
||||
*min_latency = min;
|
||||
if (max_latency)
|
||||
*max_latency = -1;
|
||||
*max_latency = min;
|
||||
|
||||
GST_LOG_OBJECT (src, "latency: live %d, min %" GST_TIME_FORMAT
|
||||
", max %" GST_TIME_FORMAT, src->is_live, GST_TIME_ARGS (min),
|
||||
|
|
|
@ -1435,13 +1435,17 @@ gst_queue_handle_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
|||
* limit, the best thing we can do is to return an infinite delay. In
|
||||
* reality a better estimate would be the byte/buffer rate but that is not
|
||||
* possible right now. */
|
||||
if (queue->max_size.time > 0 && max != -1)
|
||||
/* TODO: Use CONVERT query? */
|
||||
if (queue->max_size.time > 0 && max != -1
|
||||
&& queue->leaky == GST_QUEUE_NO_LEAK)
|
||||
max += queue->max_size.time;
|
||||
else if (queue->max_size.time > 0 && queue->leaky != GST_QUEUE_NO_LEAK)
|
||||
max = MIN (queue->max_size.time, max);
|
||||
else
|
||||
max = -1;
|
||||
|
||||
/* adjust for min-threshold */
|
||||
if (queue->min_threshold.time > 0 && min != -1)
|
||||
if (queue->min_threshold.time > 0)
|
||||
min += queue->min_threshold.time;
|
||||
|
||||
gst_query_set_latency (query, live, min, max);
|
||||
|
|
Loading…
Reference in a new issue