Commit 183e94b2 authored by Edward Hervey's avatar Edward Hervey Committed by Edward Hervey
Browse files

videodecoder: Drain out keyframes in TRICK_MODE_KEY_UNITS

When asked to just decode keyframe, if we got a keyframe drain out
the decoder straight away.
This avoids having to wait for the next frame and reduces delay even
parent eb1ebf22
......@@ -2191,7 +2191,9 @@ gst_video_decoder_chain_forward (GstVideoDecoder * decoder,
priv->input_offset += gst_buffer_get_size (buf);
if (priv->packetized) {
gboolean was_keyframe = FALSE;
was_keyframe = TRUE;
......@@ -2204,6 +2206,11 @@ gst_video_decoder_chain_forward (GstVideoDecoder * decoder,
ret = gst_video_decoder_decode_frame (decoder, priv->current_frame);
priv->current_frame = NULL;
/* If in trick mode and it was a keyframe, drain decoder to avoid extra
* latency */
if (was_keyframe
&& (decoder->output_segment.flags & GST_SEEK_FLAG_TRICKMODE_KEY_UNITS))
gst_video_decoder_drain_out (decoder, FALSE);
} else {
gst_adapter_push (priv->input_adapter, buf);
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