-
- if (self->priv->latency_live && self->priv->latency_max != 0 &&
- GST_CLOCK_TIME_IS_VALID (latency) && latency > self->priv->latency_max) {
- GST_ELEMENT_WARNING (self, CORE, NEGOTIATION,
- ("%s", "Latency too big"),
- ("The requested latency value is too big for the latency in the "
- "current pipeline. Limiting to %" G_GINT64_FORMAT,
- self->priv->latency_max));
- latency = self->priv->latency_max;
+ if (self->priv->latency_live) {
+ min = self->priv->latency_min;
+ max = self->priv->latency_max;
+ /* add our own */
+ min += latency;
+ min += self->priv->sub_latency_min;
+ if (GST_CLOCK_TIME_IS_VALID (self->priv->sub_latency_max)
+ && GST_CLOCK_TIME_IS_VALID (max))
+ max += self->priv->sub_latency_max;
+ else if (GST_CLOCK_TIME_IS_VALID (self->priv->sub_latency_max))
+ max = self->priv->sub_latency_max;
+
+ if (GST_CLOCK_TIME_IS_VALID (max) && min > max) {
+ GST_ELEMENT_WARNING (self, CORE, NEGOTIATION,
+ ("%s", "Latency too big"),
+ ("The requested latency value is too big for the latency in the "
+ "current pipeline. Limiting to %" G_GINT64_FORMAT, max));
+ /* FIXME: This could in theory become negative, but in
+ * that case all is lost anyway */
+ latency -= min - max;
+ /* FIXME: shouldn't we g_object_notify() the change here? */
+ }