Commit d6c4a284 authored by Jean-Paul Saman's avatar Jean-Paul Saman

codec/avcodec/vaapi: fixup vlc_va_Initialize()/vlc_va_Terminate

parent 81d41ccd
......@@ -51,8 +51,8 @@
/* Global VAAPI connection state */
#ifdef VA_SHARED_CONN
static vlc_va_conn_t vlc_va_conn = { NULL, 0, 0, 0, 0 };
static bool b_va_inited = false;
#endif
/* */
static vlc_va_conn_t *vlc_va_get_conn( void )
{
......@@ -69,8 +69,11 @@ vlc_va_conn_t *vlc_va_Initialize( const char *display_name )
vlc_va_conn_t *conn = vlc_va_get_conn();
assert(conn);
#ifdef VA_SHARED_CONN
if (b_va_inited)
if (conn->i_ref_count > 0)
{
conn->i_ref_count++;
return conn;
}
#endif
/* Create a VA display */
conn->p_display_x11 = XOpenDisplay(display_name);
......@@ -85,7 +88,6 @@ vlc_va_conn_t *vlc_va_Initialize( const char *display_name )
goto error;
#ifdef VA_SHARED_CONN
conn->i_ref_count++;
b_va_inited = true;
#endif
return conn;
......@@ -114,8 +116,6 @@ void vlc_va_Terminate( vlc_va_conn_t *conn )
conn->i_version_major = conn->i_version_minor = 0;
conn->i_ref_count = 0;
conn = NULL;
/* */
b_va_inited = false;
#endif
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment