Commit 8bee96c4 authored by Edward Hervey's avatar Edward Hervey Committed by Sebastian Dröge
Browse files

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.
parent 5bef865f
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment