videodecoder: Don't push late frames

While it's a bit tricky to discard frames *before* decoding (because
we might not be sure which data is needed or not by the decoder), we
can discard them after decoding if they are too late anyway.

Any following basetransform based element or similar would drop the frame too.
This commit is contained in:
Edward Hervey 2016-06-07 09:48:35 +02:00 committed by Sebastian Dröge
parent 5bef865f9f
commit 8bee96c4a2

View file

@ -3198,7 +3198,25 @@ gst_video_decoder_clip_and_push_buf (GstVideoDecoder * decoder, GstBuffer * buf)
goto done;
}
/* Is buffer too late (QoS) ? */
if (GST_CLOCK_TIME_IS_VALID (priv->earliest_time)
&& GST_CLOCK_TIME_IS_VALID (cstart)) {
GstClockTime deadline =
gst_segment_to_running_time (segment, GST_FORMAT_TIME, cstart);
if (GST_CLOCK_TIME_IS_VALID (deadline) && deadline < priv->earliest_time) {
GST_DEBUG_OBJECT (decoder,
"Dropping frame due to QoS. start:%" GST_TIME_FORMAT " deadline:%"
GST_TIME_FORMAT " earliest_time:%" GST_TIME_FORMAT,
GST_TIME_ARGS (start), GST_TIME_ARGS (deadline),
GST_TIME_ARGS (priv->earliest_time));
gst_buffer_unref (buf);
priv->discont = TRUE;
goto done;
}
}
/* Set DISCONT flag here ! */
if (priv->discont) {
GST_DEBUG_OBJECT (decoder, "Setting discont on output buffer");
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);