This now follows the design docs everywhere.
https://bugzilla.gnome.org/show_bug.cgi?id=744106
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,
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;
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);
}
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;
}
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),
* 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);