[vlc-devel] [PATCH 04/10] opengl/vdpau: use the VdpDevice from the decoder device

Steve Lhomme robux4 at ycbcr.xyz
Fri Nov 22 14:12:32 CET 2019


Instead of holding a reference. We already hold a reference on the decoder
device.

The decoder device won't change during the lieftime of the converter.
---
 modules/video_output/opengl/converter_vdpau.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/modules/video_output/opengl/converter_vdpau.c b/modules/video_output/opengl/converter_vdpau.c
index a2a2d0eb2ee..1218cdf820a 100644
--- a/modules/video_output/opengl/converter_vdpau.c
+++ b/modules/video_output/opengl/converter_vdpau.c
@@ -120,7 +120,6 @@ Close(vlc_object_t *obj)
     _glVDPAUFiniNV(); assert(tc->vt->GetError() == GL_NO_ERROR);
     converter_sys_t *sys = tc->priv;
     vlc_decoder_device *dec_device = sys->dec_device;
-    vdp_release_x11(GetVDPAUOpaqueDevice(dec_device)->vdp);
     vlc_decoder_device_Release(dec_device);
 }
 
@@ -153,8 +152,9 @@ Open(vlc_object_t *obj)
     tc->fmt.i_chroma = VLC_CODEC_VDPAU_OUTPUT;
 
     VdpDevice device;
-    vdp_t *vdp = GetVDPAUOpaqueDevice(dec_device)->vdp;
-    vdp_hold_x11(vdp, &device);
+    vdpau_decoder_device_t *vdpau_dev = GetVDPAUOpaqueDevice(dec_device);
+    vdp_t *vdp = vdpau_dev->vdp;
+    device = vdpau_dev->device;
 
     void *vdp_gpa;
     if (vdp_get_proc_address(vdp, device,
@@ -162,7 +162,6 @@ Open(vlc_object_t *obj)
         != VDP_STATUS_OK)
     {
         vlc_decoder_device_Release(dec_device);
-        vdp_release_x11(vdp);
         return VLC_EGENERIC;
     }
 
@@ -171,7 +170,6 @@ Open(vlc_object_t *obj)
     if (!_##fct) \
     { \
         vlc_decoder_device_Release(dec_device); \
-        vdp_release_x11(vdp); \
         return VLC_EGENERIC; \
     }
     SAFE_GPA(glVDPAUInitNV);
-- 
2.17.1



More information about the vlc-devel mailing list