diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.c b/gst-libs/gst/vaapi/gstvaapidecoder.c index 1f346e682e..3f6577fb10 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder.c @@ -697,10 +697,14 @@ gst_vaapi_decoder_get_surface(GstVaapiDecoder *decoder, do { frame = pop_frame(decoder); - if (frame) { - *out_proxy_ptr = gst_vaapi_surface_proxy_ref(frame->user_data); + while (frame) { + if (!GST_VIDEO_CODEC_FRAME_IS_DECODE_ONLY(frame)) { + *out_proxy_ptr = gst_vaapi_surface_proxy_ref(frame->user_data); + gst_video_codec_frame_unref(frame); + return GST_VAAPI_DECODER_STATUS_SUCCESS; + } gst_video_codec_frame_unref(frame); - return GST_VAAPI_DECODER_STATUS_SUCCESS; + frame = pop_frame(decoder); } status = decode_step(decoder); } while (status == GST_VAAPI_DECODER_STATUS_SUCCESS);