summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 498b0e9600..046fd11e68 100644
--- a/libs/gst/base/gstbasesink.c
+++ b/libs/gst/base/gstbasesink.c
@@ -260,7 +260,8 @@ struct _GstBaseSinkPrivate
260 /* Cached GstClockID */ 260 /* Cached GstClockID */
261 GstClockID cached_clock_id; 261 GstClockID cached_clock_id;
262 262
263 /* for throttling */ 263 /* for throttling and QoS */
264 GstClockTime earliest_in_time;
264 GstClockTime throttle_time; 265 GstClockTime throttle_time;
265}; 266};
266 267
@@ -2490,6 +2491,10 @@ do_step:
2490 /* save sync time for eos when the previous object needed sync */ 2491 /* save sync time for eos when the previous object needed sync */
2491 priv->eos_rtime = (do_sync ? priv->current_rstop : GST_CLOCK_TIME_NONE); 2492 priv->eos_rtime = (do_sync ? priv->current_rstop : GST_CLOCK_TIME_NONE);
2492 2493
2494 if (G_UNLIKELY (priv->earliest_in_time != -1
2495 && rstart < priv->earliest_in_time))
2496 goto qos_dropped;
2497
2493again: 2498again:
2494 /* first do preroll, this makes sure we commit our state 2499 /* first do preroll, this makes sure we commit our state
2495 * to PAUSED and can continue to PLAYING. We cannot perform 2500 * to PAUSED and can continue to PLAYING. We cannot perform
@@ -2576,6 +2581,12 @@ not_syncable:
2576 GST_DEBUG_OBJECT (basesink, "non syncable object %p", obj); 2581 GST_DEBUG_OBJECT (basesink, "non syncable object %p", obj);
2577 return GST_FLOW_OK; 2582 return GST_FLOW_OK;
2578 } 2583 }
2584qos_dropped:
2585 {
2586 GST_DEBUG_OBJECT (basesink, "dropped because of QoS %p", obj);
2587 *late = TRUE;
2588 return GST_FLOW_OK;
2589 }
2579flushing: 2590flushing:
2580 { 2591 {
2581 GST_DEBUG_OBJECT (basesink, "we are flushing"); 2592 GST_DEBUG_OBJECT (basesink, "we are flushing");
@@ -2754,6 +2765,7 @@ gst_base_sink_reset_qos (GstBaseSink * sink)
2754 priv = sink->priv; 2765 priv = sink->priv;
2755 2766
2756 priv->last_in_time = GST_CLOCK_TIME_NONE; 2767 priv->last_in_time = GST_CLOCK_TIME_NONE;
2768 priv->earliest_in_time = GST_CLOCK_TIME_NONE;
2757 priv->last_left = GST_CLOCK_TIME_NONE; 2769 priv->last_left = GST_CLOCK_TIME_NONE;
2758 priv->avg_duration = GST_CLOCK_TIME_NONE; 2770 priv->avg_duration = GST_CLOCK_TIME_NONE;
2759 priv->avg_pt = GST_CLOCK_TIME_NONE; 2771 priv->avg_pt = GST_CLOCK_TIME_NONE;
@@ -2833,6 +2845,9 @@ gst_base_sink_is_too_late (GstBaseSink * basesink, GstMiniObject * obj,
2833done: 2845done:
2834 if (!late || !GST_CLOCK_TIME_IS_VALID (priv->last_in_time)) { 2846 if (!late || !GST_CLOCK_TIME_IS_VALID (priv->last_in_time)) {
2835 priv->last_in_time = start; 2847 priv->last_in_time = start;
2848 /* the next allowed input timestamp */
2849 if (priv->throttle_time > 0)
2850 priv->earliest_in_time = start + priv->throttle_time;
2836 } 2851 }
2837 return late; 2852 return late;
2838 2853