mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
libs: robustify decoder objects and surface proxy initialization.
Fix GstVaapiPicture, GstVaapiSlice and GstVaapiSurfaceProxy initialization sequences to have the expected default values set beforehand in case of an error raising up further during creation. i.e. make it possible to cleanly destroy those partially initialized objects. https://bugzilla.gnome.org/show_bug.cgi?id=707108 Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
parent
a6436f27d5
commit
f9d0d6e272
2 changed files with 5 additions and 3 deletions
|
@ -103,6 +103,8 @@ gst_vaapi_picture_create(
|
|||
{
|
||||
gboolean success;
|
||||
|
||||
picture->param_id = VA_INVALID_ID;
|
||||
|
||||
if (args->flags & GST_VAAPI_CREATE_PICTURE_FLAG_CLONE) {
|
||||
GstVaapiPicture * const parent_picture = GST_VAAPI_PICTURE(args->data);
|
||||
|
||||
|
@ -158,7 +160,6 @@ gst_vaapi_picture_create(
|
|||
picture->surface = GST_VAAPI_SURFACE_PROXY_SURFACE(picture->proxy);
|
||||
picture->surface_id = GST_VAAPI_SURFACE_PROXY_SURFACE_ID(picture->proxy);
|
||||
|
||||
picture->param_id = VA_INVALID_ID;
|
||||
success = vaapi_create_buffer(
|
||||
GET_VA_DISPLAY(picture),
|
||||
GET_VA_CONTEXT(picture),
|
||||
|
@ -418,7 +419,9 @@ gst_vaapi_slice_create(
|
|||
VASliceParameterBufferBase *slice_param;
|
||||
gboolean success;
|
||||
|
||||
slice->param_id = VA_INVALID_ID;
|
||||
slice->data_id = VA_INVALID_ID;
|
||||
|
||||
success = vaapi_create_buffer(
|
||||
GET_VA_DISPLAY(slice),
|
||||
GET_VA_CONTEXT(slice),
|
||||
|
@ -431,7 +434,6 @@ gst_vaapi_slice_create(
|
|||
if (!success)
|
||||
return FALSE;
|
||||
|
||||
slice->param_id = VA_INVALID_ID;
|
||||
success = vaapi_create_buffer(
|
||||
GET_VA_DISPLAY(slice),
|
||||
GET_VA_CONTEXT(slice),
|
||||
|
|
|
@ -70,13 +70,13 @@ gst_vaapi_surface_proxy_new_from_pool(GstVaapiSurfacePool *pool)
|
|||
if (!proxy)
|
||||
return NULL;
|
||||
|
||||
proxy->destroy_func = NULL;
|
||||
proxy->pool = gst_vaapi_video_pool_ref(pool);
|
||||
proxy->surface = gst_vaapi_video_pool_get_object(proxy->pool);
|
||||
if (!proxy->surface)
|
||||
goto error;
|
||||
proxy->timestamp = GST_CLOCK_TIME_NONE;
|
||||
proxy->duration = GST_CLOCK_TIME_NONE;
|
||||
proxy->destroy_func = NULL;
|
||||
proxy->has_crop_rect = FALSE;
|
||||
gst_vaapi_object_ref(proxy->surface);
|
||||
return proxy;
|
||||
|
|
Loading…
Reference in a new issue