st/omx: add workaround for bug in Bellagio
authorChristian König <christian.koenig@amd.com>
Tue, 28 Jan 2014 13:21:14 +0000 (06:21 -0700)
committerChristian König <christian.koenig@amd.com>
Thu, 6 Feb 2014 15:19:39 +0000 (16:19 +0100)
Not blocking for the message thread can lead to accessing freed up memory.

Signed-off-by: Christian König <christian.koenig@amd.com>
src/gallium/state_trackers/omx/entrypoint.c
src/gallium/state_trackers/omx/entrypoint.h
src/gallium/state_trackers/omx/vid_dec.c

index bc8664b96a3c3886978ed0d92a6369fb6440cf7c..fb46849bf66490976f30477c8a06f263f6ecfa17 100644 (file)
@@ -98,3 +98,16 @@ void omx_put_screen(void)
    }
    pipe_mutex_unlock(omx_lock);
 }
+
+OMX_ERRORTYPE omx_workaround_Destructor(OMX_COMPONENTTYPE *comp)
+{
+   omx_base_component_PrivateType* priv = (omx_base_component_PrivateType*)comp->pComponentPrivate;
+
+   priv->state = OMX_StateInvalid;
+   tsem_up(priv->messageSem);
+
+   /* wait for thread to exit */;
+   pthread_join(priv->messageHandlerThread, NULL);
+
+   return omx_base_component_Destructor(comp);
+}
index 41454beb0487900cc2183e0efea8435301aca637..af7c33763c202ae8cb5c82d09ad9b15f2a48e111 100644 (file)
@@ -43,4 +43,6 @@ extern int omx_component_library_Setup(stLoaderComponentType **stComponents);
 struct vl_screen *omx_get_screen(void);
 void omx_put_screen(void);
 
+OMX_ERRORTYPE omx_workaround_Destructor(OMX_COMPONENTTYPE *comp);
+
 #endif
index 7be1dad1b9ed14e4c130789bc48e5b3c38a4b62b..a747c51bb56e5dcf70c9ddc1c87ce832d9e5fa7a 100644 (file)
@@ -247,8 +247,7 @@ static OMX_ERRORTYPE vid_dec_Destructor(OMX_COMPONENTTYPE *comp)
    if (priv->screen)
       omx_put_screen();
 
-   omx_base_filter_Destructor(comp);
-   return OMX_ErrorNone;
+   return omx_workaround_Destructor(comp);
 }
 
 static OMX_ERRORTYPE vid_dec_SetParameter(OMX_HANDLETYPE handle, OMX_INDEXTYPE idx, OMX_PTR param)