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
more.
https://bugzilla.gnome.org/show_bug.cgi?id=767232
priv->input_offset += gst_buffer_get_size (buf);
if (priv->packetized) {
priv->input_offset += gst_buffer_get_size (buf);
if (priv->packetized) {
+ gboolean was_keyframe = FALSE;
if (!GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT)) {
if (!GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT)) {
GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT (priv->current_frame);
}
GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT (priv->current_frame);
}
ret = gst_video_decoder_decode_frame (decoder, priv->current_frame);
}
priv->current_frame = NULL;
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);
} else {
gst_adapter_push (priv->input_adapter, buf);