basesink: Use the average durations based on timestamps for the QoS proportion when doing trickmodes

The durations of the buffers are (usually) assuming that no frames are being
dropped and are just the durations coming from the stream. However if we do
trickmodes, frames are being dropped regularly especially if only key units
are supposed to be played.

Fixes completely bogus QoS proportion values in the above case.
This commit is contained in:
Sebastian Dröge 2016-09-08 15:19:38 +03:00
parent 7315a07bc8
commit c1bd6677c6

View file

@ -2668,8 +2668,13 @@ gst_base_sink_perform_qos (GstBaseSink * sink, gboolean dropped)
left = start + jitter;
}
/* calculate duration of the buffer */
if (GST_CLOCK_TIME_IS_VALID (stop) && stop != start)
/* calculate duration of the buffer, only use buffer durations if not in
* trick mode or key-unit mode. Otherwise the buffer durations will be
* meaningless as frames are being dropped in-between without updating the
* durations. */
if (GST_CLOCK_TIME_IS_VALID (stop)
&& !(sink->segment.flags & (GST_SEGMENT_FLAG_TRICKMODE |
GST_SEGMENT_FLAG_TRICKMODE_KEY_UNITS)) && stop != start)
duration = stop - start;
else
duration = priv->avg_in_diff;