From: Sebastian Dröge Date: Fri, 18 Jan 2013 15:47:04 +0000 (+0100) Subject: omx: Minimize the time when the messages lock is held X-Git-Tag: 1.0.0~127 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5c4799ccf1f534f54f5d393ed7e7e949eba09c3c;p=platform%2Fupstream%2Fgst-omx.git omx: Minimize the time when the messages lock is held Fixes a deadlock if any OMX functions are called when the messages are handled. Thanks to Nicolas Dufresne for noticing. --- diff --git a/omx/gstomx.c b/omx/gstomx.c index 519fbed62e9..b772606ae46 100644 --- a/omx/gstomx.c +++ b/omx/gstomx.c @@ -196,8 +196,9 @@ gst_omx_component_handle_messages (GstOMXComponent * comp) GstOMXMessage *msg; g_mutex_lock (&comp->messages_lock); - while ((msg = g_queue_pop_head (&comp->messages))) { + g_mutex_unlock (&comp->messages_lock); + switch (msg->type) { case GST_OMX_MESSAGE_STATE_SET:{ GST_DEBUG_OBJECT (comp->parent, "State change to %d finished", @@ -349,6 +350,8 @@ gst_omx_component_handle_messages (GstOMXComponent * comp) } g_slice_free (GstOMXMessage, msg); + + g_mutex_lock (&comp->messages_lock); } g_mutex_unlock (&comp->messages_lock);