mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-13 09:45:27 +00:00
pulsesink: Better fix for deadlock on failed connect
This reverts the previous fix that would cause a double-unlock when the stream connect failed. https://bugzilla.gnome.org/show_bug.cgi?id=644510
This commit is contained in:
parent
387f533a07
commit
84decd731f
1 changed files with 6 additions and 2 deletions
|
@ -442,6 +442,7 @@ gst_pulseringbuffer_open_device (GstRingBuffer * buf)
|
||||||
GstPulseRingBuffer *pbuf;
|
GstPulseRingBuffer *pbuf;
|
||||||
GstPulseContext *pctx;
|
GstPulseContext *pctx;
|
||||||
pa_mainloop_api *api;
|
pa_mainloop_api *api;
|
||||||
|
gboolean need_unlock_shared;
|
||||||
|
|
||||||
psink = GST_PULSESINK_CAST (GST_OBJECT_PARENT (buf));
|
psink = GST_PULSESINK_CAST (GST_OBJECT_PARENT (buf));
|
||||||
pbuf = GST_PULSERING_BUFFER_CAST (buf);
|
pbuf = GST_PULSERING_BUFFER_CAST (buf);
|
||||||
|
@ -458,6 +459,7 @@ gst_pulseringbuffer_open_device (GstRingBuffer * buf)
|
||||||
pa_threaded_mainloop_lock (mainloop);
|
pa_threaded_mainloop_lock (mainloop);
|
||||||
|
|
||||||
g_mutex_lock (pa_shared_resource_mutex);
|
g_mutex_lock (pa_shared_resource_mutex);
|
||||||
|
need_unlock_shared = TRUE;
|
||||||
|
|
||||||
pctx = g_hash_table_lookup (gst_pulse_shared_contexts, pbuf->context_name);
|
pctx = g_hash_table_lookup (gst_pulse_shared_contexts, pbuf->context_name);
|
||||||
if (pctx == NULL) {
|
if (pctx == NULL) {
|
||||||
|
@ -481,7 +483,7 @@ gst_pulseringbuffer_open_device (GstRingBuffer * buf)
|
||||||
gst_pulsering_context_subscribe_cb, pctx);
|
gst_pulsering_context_subscribe_cb, pctx);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* try to connect to the server and wait for completioni, we don't want to
|
/* try to connect to the server and wait for completion, we don't want to
|
||||||
* autospawn a deamon */
|
* autospawn a deamon */
|
||||||
GST_LOG_OBJECT (psink, "connect to server %s",
|
GST_LOG_OBJECT (psink, "connect to server %s",
|
||||||
GST_STR_NULL (psink->server));
|
GST_STR_NULL (psink->server));
|
||||||
|
@ -496,6 +498,7 @@ gst_pulseringbuffer_open_device (GstRingBuffer * buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
g_mutex_unlock (pa_shared_resource_mutex);
|
g_mutex_unlock (pa_shared_resource_mutex);
|
||||||
|
need_unlock_shared = FALSE;
|
||||||
|
|
||||||
/* context created or shared okay */
|
/* context created or shared okay */
|
||||||
pbuf->context = pa_context_ref (pctx->context);
|
pbuf->context = pa_context_ref (pctx->context);
|
||||||
|
@ -527,6 +530,7 @@ gst_pulseringbuffer_open_device (GstRingBuffer * buf)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
unlock_and_fail:
|
unlock_and_fail:
|
||||||
{
|
{
|
||||||
|
if (need_unlock_shared)
|
||||||
g_mutex_unlock (pa_shared_resource_mutex);
|
g_mutex_unlock (pa_shared_resource_mutex);
|
||||||
gst_pulsering_destroy_context (pbuf);
|
gst_pulsering_destroy_context (pbuf);
|
||||||
pa_threaded_mainloop_unlock (mainloop);
|
pa_threaded_mainloop_unlock (mainloop);
|
||||||
|
|
Loading…
Reference in a new issue