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 @@ ...@@ -51,8 +51,8 @@
/* Global VAAPI connection state */ /* Global VAAPI connection state */
#ifdef VA_SHARED_CONN #ifdef VA_SHARED_CONN
static vlc_va_conn_t vlc_va_conn = { NULL, 0, 0, 0, 0 }; static vlc_va_conn_t vlc_va_conn = { NULL, 0, 0, 0, 0 };
static bool b_va_inited = false;
#endif #endif
/* */ /* */
static vlc_va_conn_t *vlc_va_get_conn( void ) 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 ) ...@@ -69,8 +69,11 @@ vlc_va_conn_t *vlc_va_Initialize( const char *display_name )
vlc_va_conn_t *conn = vlc_va_get_conn(); vlc_va_conn_t *conn = vlc_va_get_conn();
assert(conn); assert(conn);
#ifdef VA_SHARED_CONN #ifdef VA_SHARED_CONN
if (b_va_inited) if (conn->i_ref_count > 0)
{
conn->i_ref_count++;
return conn; return conn;
}
#endif #endif
/* Create a VA display */ /* Create a VA display */
conn->p_display_x11 = XOpenDisplay(display_name); conn->p_display_x11 = XOpenDisplay(display_name);
...@@ -85,7 +88,6 @@ vlc_va_conn_t *vlc_va_Initialize( const char *display_name ) ...@@ -85,7 +88,6 @@ vlc_va_conn_t *vlc_va_Initialize( const char *display_name )
goto error; goto error;
#ifdef VA_SHARED_CONN #ifdef VA_SHARED_CONN
conn->i_ref_count++; conn->i_ref_count++;
b_va_inited = true;
#endif #endif
return conn; return conn;
...@@ -114,8 +116,6 @@ void vlc_va_Terminate( vlc_va_conn_t *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_version_major = conn->i_version_minor = 0;
conn->i_ref_count = 0; conn->i_ref_count = 0;
conn = NULL; conn = NULL;
/* */
b_va_inited = false;
#endif #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