mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
vdpau: fix destruction of GstVdpDevice when it failed to open
only close display in finalize and check if vdp_decoder_destroy is available before we use it
This commit is contained in:
parent
8996b80d62
commit
b6f22c519d
2 changed files with 4 additions and 6 deletions
|
@ -136,19 +136,16 @@ create_display_error:
|
|||
return FALSE;
|
||||
|
||||
create_device_error:
|
||||
XCloseDisplay (device->display);
|
||||
g_set_error (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_OPEN_READ,
|
||||
"Could not create VDPAU device for display: %s", device->display_name);
|
||||
return FALSE;
|
||||
|
||||
get_error_string_error:
|
||||
XCloseDisplay (device->display);
|
||||
g_set_error (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_OPEN_READ,
|
||||
"Could not get vdp_get_error_string function pointer from VDPAU");
|
||||
return FALSE;
|
||||
|
||||
function_error:
|
||||
XCloseDisplay (device->display);
|
||||
g_set_error (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_OPEN_READ,
|
||||
"Could not get function pointer from VDPAU, error returned was: %s",
|
||||
device->vdp_get_error_string (status));
|
||||
|
@ -176,6 +173,7 @@ gst_vdp_device_init (GstVdpDevice * device)
|
|||
device->display_name = NULL;
|
||||
device->display = NULL;
|
||||
device->device = VDP_INVALID_HANDLE;
|
||||
device->vdp_decoder_destroy = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -183,14 +181,16 @@ gst_vdp_device_finalize (GObject * object)
|
|||
{
|
||||
GstVdpDevice *device = (GstVdpDevice *) object;
|
||||
|
||||
if (device->device != VDP_INVALID_HANDLE) {
|
||||
if (device->device != VDP_INVALID_HANDLE && device->vdp_decoder_destroy) {
|
||||
device->vdp_device_destroy (device->device);
|
||||
device->device = VDP_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
if (device->display) {
|
||||
XCloseDisplay (device->display);
|
||||
device->display = NULL;
|
||||
}
|
||||
|
||||
g_free (device->display_name);
|
||||
device->display_name = NULL;
|
||||
|
||||
|
|
|
@ -47,8 +47,6 @@ struct _GstVdpDeviceClass
|
|||
struct _GstVdpDevice
|
||||
{
|
||||
GObject object;
|
||||
|
||||
gboolean constructed;
|
||||
|
||||
gchar *display_name;
|
||||
Display *display;
|
||||
|
|
Loading…
Reference in a new issue