summaryrefslogtreecommitdiff
authorWim Taymans <wim.taymans@collabora.co.uk>2011-02-10 13:50:04 (GMT)
committer Wim Taymans <wim.taymans@collabora.co.uk>2011-02-10 14:21:46 (GMT)
commitd19f40c7169db209fd71b06d3d2f9c209aacfe5e (patch) (side-by-side diff)
tree38370d8916f0ec78f725f87d1d259097820205d1
parentdad43fa0042bbdbb0e91e17a7735e9527c898fe5 (diff)
downloadgstreamer-d19f40c7169db209fd71b06d3d2f9c209aacfe5e.zip
gstreamer-d19f40c7169db209fd71b06d3d2f9c209aacfe5e.tar.gz
basesink: keep track of earliest QoS timestamp
Keep track of the earliest allowed timestamp according to the latest QoS report and drop buffers before that time. Activate this filter when throttling is enabled. We could later also activate this in the other QoS cases. See #638891
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libs/gst/base/gstbasesink.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c
index 498b0e9..046fd11 100644
--- a/libs/gst/base/gstbasesink.c
+++ b/libs/gst/base/gstbasesink.c
@@ -260,7 +260,8 @@ struct _GstBaseSinkPrivate
/* Cached GstClockID */
GstClockID cached_clock_id;
- /* for throttling */
+ /* for throttling and QoS */
+ GstClockTime earliest_in_time;
GstClockTime throttle_time;
};
@@ -2490,6 +2491,10 @@ do_step:
/* save sync time for eos when the previous object needed sync */
priv->eos_rtime = (do_sync ? priv->current_rstop : GST_CLOCK_TIME_NONE);
+ if (G_UNLIKELY (priv->earliest_in_time != -1
+ && rstart < priv->earliest_in_time))
+ goto qos_dropped;
+
again:
/* first do preroll, this makes sure we commit our state
* to PAUSED and can continue to PLAYING. We cannot perform
@@ -2576,6 +2581,12 @@ not_syncable:
GST_DEBUG_OBJECT (basesink, "non syncable object %p", obj);
return GST_FLOW_OK;
}
+qos_dropped:
+ {
+ GST_DEBUG_OBJECT (basesink, "dropped because of QoS %p", obj);
+ *late = TRUE;
+ return GST_FLOW_OK;
+ }
flushing:
{
GST_DEBUG_OBJECT (basesink, "we are flushing");
@@ -2754,6 +2765,7 @@ gst_base_sink_reset_qos (GstBaseSink * sink)
priv = sink->priv;
priv->last_in_time = GST_CLOCK_TIME_NONE;
+ priv->earliest_in_time = GST_CLOCK_TIME_NONE;
priv->last_left = GST_CLOCK_TIME_NONE;
priv->avg_duration = GST_CLOCK_TIME_NONE;
priv->avg_pt = GST_CLOCK_TIME_NONE;
@@ -2833,6 +2845,9 @@ gst_base_sink_is_too_late (GstBaseSink * basesink, GstMiniObject * obj,
done:
if (!late || !GST_CLOCK_TIME_IS_VALID (priv->last_in_time)) {
priv->last_in_time = start;
+ /* the next allowed input timestamp */
+ if (priv->throttle_time > 0)
+ priv->earliest_in_time = start + priv->throttle_time;
}
return late;