decoder: dispose GstVideoCodecFrame earlier.

Once the picture was output, it is no longer necessary to keep an extra
reference to the underlying GstVideoCodecFrame. So, we can release it
earlier, and maybe subsequently release the associate surface proxy
earlier.
This commit is contained in:
Gwenole Beauchesne 2013-07-15 17:43:34 +02:00
parent 415e65a980
commit b358651fb3

View file

@ -37,6 +37,15 @@
#define GET_VA_DISPLAY(obj) GET_DECODER(obj)->va_display #define GET_VA_DISPLAY(obj) GET_DECODER(obj)->va_display
#define GET_VA_CONTEXT(obj) GET_DECODER(obj)->va_context #define GET_VA_CONTEXT(obj) GET_DECODER(obj)->va_context
static inline void
gst_video_codec_frame_clear(GstVideoCodecFrame **frame_ptr)
{
if (!*frame_ptr)
return;
gst_video_codec_frame_unref(*frame_ptr);
*frame_ptr = NULL;
}
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* --- Pictures --- */ /* --- Pictures --- */
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
@ -82,10 +91,7 @@ gst_vaapi_picture_destroy(GstVaapiPicture *picture)
vaapi_destroy_buffer(GET_VA_DISPLAY(picture), &picture->param_id); vaapi_destroy_buffer(GET_VA_DISPLAY(picture), &picture->param_id);
picture->param = NULL; picture->param = NULL;
if (picture->frame) { gst_video_codec_frame_clear(&picture->frame);
gst_video_codec_frame_unref(picture->frame);
picture->frame = NULL;
}
gst_vaapi_picture_replace(&picture->parent_picture, NULL); gst_vaapi_picture_replace(&picture->parent_picture, NULL);
} }
@ -338,6 +344,7 @@ do_output(GstVaapiPicture *picture)
GST_VAAPI_SURFACE_PROXY_FLAG_SET(proxy, flags); GST_VAAPI_SURFACE_PROXY_FLAG_SET(proxy, flags);
gst_vaapi_decoder_push_frame(GET_DECODER(picture), out_frame); gst_vaapi_decoder_push_frame(GET_DECODER(picture), out_frame);
gst_video_codec_frame_clear(&picture->frame);
GST_VAAPI_PICTURE_FLAG_SET(picture, GST_VAAPI_PICTURE_FLAG_OUTPUT); GST_VAAPI_PICTURE_FLAG_SET(picture, GST_VAAPI_PICTURE_FLAG_OUTPUT);
return TRUE; return TRUE;