basesink: Don't set last_render_time if we're checking for a late buffer before ...
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 19 Apr 2013 08:24:06 +0000 (10:24 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 19 Apr 2013 08:57:01 +0000 (10:57 +0200)
This makes sure that at least one buffer per second is rendered if buffers
are dropped before ::prepare. Without this change, at least one buffer per
second wouldn't be too late before ::prepare anymore but would be dropped
before ::render because of last_render_time being set before ::prepare
already.

libs/gst/base/gstbasesink.c

index 244edf0..eb3ca1b 100644 (file)
@@ -405,7 +405,7 @@ static GstCaps *gst_base_sink_fixate (GstBaseSink * bsink, GstCaps * caps);
 /* check if an object was too late */
 static gboolean gst_base_sink_is_too_late (GstBaseSink * basesink,
     GstMiniObject * obj, GstClockTime rstart, GstClockTime rstop,
-    GstClockReturn status, GstClockTimeDiff jitter);
+    GstClockReturn status, GstClockTimeDiff jitter, gboolean render);
 
 static void
 gst_base_sink_class_init (GstBaseSinkClass * klass)
@@ -2489,7 +2489,7 @@ again:
 
   /* check if the object should be dropped */
   *late = gst_base_sink_is_too_late (basesink, obj, rstart, rstop,
-      status, jitter);
+      status, jitter, TRUE);
 
 done:
   return GST_FLOW_OK;
@@ -2715,7 +2715,7 @@ gst_base_sink_reset_qos (GstBaseSink * sink)
 static gboolean
 gst_base_sink_is_too_late (GstBaseSink * basesink, GstMiniObject * obj,
     GstClockTime rstart, GstClockTime rstop,
-    GstClockReturn status, GstClockTimeDiff jitter)
+    GstClockReturn status, GstClockTimeDiff jitter, gboolean render)
 {
   gboolean late;
   guint64 max_lateness;
@@ -2774,7 +2774,7 @@ gst_base_sink_is_too_late (GstBaseSink * basesink, GstMiniObject * obj,
   }
 
 done:
-  if (!late || !GST_CLOCK_TIME_IS_VALID (priv->last_render_time)) {
+  if (render && (!late || !GST_CLOCK_TIME_IS_VALID (priv->last_render_time))) {
     priv->last_render_time = rstart;
     /* the next allowed input timestamp */
     if (priv->throttle_time > 0)
@@ -3281,7 +3281,7 @@ gst_base_sink_chain_unlocked (GstBaseSink * basesink, GstPad * pad,
     if (!stepped && syncable && do_sync)
       late =
           gst_base_sink_is_too_late (basesink, obj, rstart, rstop,
-          GST_CLOCK_EARLY, 0);
+          GST_CLOCK_EARLY, 0, FALSE);
     if (late)
       goto dropped;