mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
vaapidecode: fix hard reset for seek cases.
Fix hard reset for seek cases by flushing the GstVaapiDecoder queue and completely purge any decoded output frame that may come out from it. At this stage, the GstVaapiDecoder shall be in a complete clean state to start decoding over new buffers. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
parent
367944ba32
commit
6e85f08e33
1 changed files with 15 additions and 0 deletions
|
@ -639,6 +639,21 @@ gst_vaapidecode_reset_full(GstVaapiDecode *decode, GstCaps *caps, gboolean hard)
|
|||
|
||||
/* Reset timers if hard reset was requested (e.g. seek) */
|
||||
if (hard) {
|
||||
GstVideoDecoder * const vdec = GST_VIDEO_DECODER(decode);
|
||||
GstVideoCodecFrame *out_frame = NULL;
|
||||
|
||||
gst_vaapi_decoder_flush(decode->decoder);
|
||||
GST_VIDEO_DECODER_STREAM_UNLOCK(vdec);
|
||||
gst_pad_stop_task(decode->srcpad);
|
||||
GST_VIDEO_DECODER_STREAM_LOCK(vdec);
|
||||
decode->decoder_loop_status = GST_FLOW_OK;
|
||||
|
||||
/* Purge all decoded frames as we don't need them (e.g. seek) */
|
||||
while (gst_vaapi_decoder_get_frame_with_timeout(decode->decoder,
|
||||
&out_frame, 0) == GST_VAAPI_DECODER_STATUS_SUCCESS) {
|
||||
gst_video_codec_frame_unref(out_frame);
|
||||
out_frame = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Only reset decoder if codec type changed */
|
||||
|
|
Loading…
Reference in a new issue