basesink: Fix QoS/lateness checking if subclass implements prepare/prepare_list vfuncs

In basesink functions gst_base_sink_chain_unlocked(), below code is used to
checking if buffer is late before doing prepare call to save some effort:
    if (syncable && do_sync)
      late =
          gst_base_sink_is_too_late (basesink, obj, rstart, rstop,
          GST_CLOCK_EARLY, 0, FALSE);

    if (G_UNLIKELY (late))
      goto dropped;

But this code has problem, it should calculate jitter based on current media
clock, rather than just passing 0. I found it will drop all the frames when
rewind in slow speed, such as -2X.

https://bugzilla.gnome.org/show_bug.cgi?id=749258
This commit is contained in:
Jian 2015-05-14 15:49:43 +08:00 committed by Sebastian Dröge
parent aafce9bea1
commit 4f79c5e8da

View file

@ -3369,10 +3369,28 @@ gst_base_sink_chain_unlocked (GstBaseSink * basesink, GstPad * pad,
if (G_UNLIKELY (stepped))
goto dropped;
if (syncable && do_sync)
if (syncable && do_sync) {
GstClock *clock;
GST_OBJECT_LOCK (basesink);
clock = GST_ELEMENT_CLOCK (basesink);
if (clock && GST_STATE (basesink) == GST_STATE_PLAYING) {
GstClockTime base_time;
GstClockTime stime;
GstClockTime now;
base_time = GST_ELEMENT_CAST (basesink)->base_time;
stime = base_time + gst_base_sink_adjust_time (basesink, rstart);
now = gst_clock_get_time (clock);
GST_OBJECT_UNLOCK (basesink);
late =
gst_base_sink_is_too_late (basesink, obj, rstart, rstop,
GST_CLOCK_EARLY, 0, FALSE);
GST_CLOCK_EARLY, GST_CLOCK_DIFF (stime, now), FALSE);
} else {
GST_OBJECT_UNLOCK (basesink);
}
}
if (G_UNLIKELY (late))
goto dropped;