mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 04:22:27 +00:00
pulse: Don't lock the mainloop in NULL
This commit is contained in:
parent
956c1d83f1
commit
a8103facc5
2 changed files with 58 additions and 1 deletions
|
@ -1692,6 +1692,9 @@ gst_pulsesink_set_volume (GstPulseSink * psink, gdouble volume)
|
||||||
GstPulseRingBuffer *pbuf;
|
GstPulseRingBuffer *pbuf;
|
||||||
uint32_t idx;
|
uint32_t idx;
|
||||||
|
|
||||||
|
if (!psink->mainloop)
|
||||||
|
goto no_mainloop;
|
||||||
|
|
||||||
pa_threaded_mainloop_lock (psink->mainloop);
|
pa_threaded_mainloop_lock (psink->mainloop);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (psink, "setting volume to %f", volume);
|
GST_DEBUG_OBJECT (psink, "setting volume to %f", volume);
|
||||||
|
@ -1720,6 +1723,14 @@ unlock:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
no_mainloop:
|
||||||
|
{
|
||||||
|
psink->volume = volume;
|
||||||
|
psink->volume_set = TRUE;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (psink, "we have no mainloop");
|
||||||
|
return;
|
||||||
|
}
|
||||||
no_buffer:
|
no_buffer:
|
||||||
{
|
{
|
||||||
psink->volume = volume;
|
psink->volume = volume;
|
||||||
|
@ -1749,6 +1760,9 @@ gst_pulsesink_set_mute (GstPulseSink * psink, gboolean mute)
|
||||||
GstPulseRingBuffer *pbuf;
|
GstPulseRingBuffer *pbuf;
|
||||||
uint32_t idx;
|
uint32_t idx;
|
||||||
|
|
||||||
|
if (!psink->mainloop)
|
||||||
|
goto no_mainloop;
|
||||||
|
|
||||||
pa_threaded_mainloop_lock (psink->mainloop);
|
pa_threaded_mainloop_lock (psink->mainloop);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (psink, "setting mute state to %d", mute);
|
GST_DEBUG_OBJECT (psink, "setting mute state to %d", mute);
|
||||||
|
@ -1775,6 +1789,14 @@ unlock:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
no_mainloop:
|
||||||
|
{
|
||||||
|
psink->mute = mute;
|
||||||
|
psink->mute_set = TRUE;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (psink, "we have no mainloop");
|
||||||
|
return;
|
||||||
|
}
|
||||||
no_buffer:
|
no_buffer:
|
||||||
{
|
{
|
||||||
psink->mute = mute;
|
psink->mute = mute;
|
||||||
|
@ -1833,6 +1855,9 @@ gst_pulsesink_get_volume (GstPulseSink * psink)
|
||||||
gdouble v = DEFAULT_VOLUME;
|
gdouble v = DEFAULT_VOLUME;
|
||||||
uint32_t idx;
|
uint32_t idx;
|
||||||
|
|
||||||
|
if (!psink->mainloop)
|
||||||
|
goto no_mainloop;
|
||||||
|
|
||||||
pa_threaded_mainloop_lock (psink->mainloop);
|
pa_threaded_mainloop_lock (psink->mainloop);
|
||||||
|
|
||||||
pbuf = GST_PULSERING_BUFFER_CAST (GST_BASE_AUDIO_SINK (psink)->ringbuffer);
|
pbuf = GST_PULSERING_BUFFER_CAST (GST_BASE_AUDIO_SINK (psink)->ringbuffer);
|
||||||
|
@ -1852,9 +1877,9 @@ gst_pulsesink_get_volume (GstPulseSink * psink)
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock:
|
||||||
v = psink->volume;
|
v = psink->volume;
|
||||||
|
|
||||||
unlock:
|
|
||||||
if (o)
|
if (o)
|
||||||
pa_operation_unref (o);
|
pa_operation_unref (o);
|
||||||
|
|
||||||
|
@ -1868,6 +1893,12 @@ unlock:
|
||||||
return v;
|
return v;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
no_mainloop:
|
||||||
|
{
|
||||||
|
v = psink->volume;
|
||||||
|
GST_DEBUG_OBJECT (psink, "we have no mainloop");
|
||||||
|
return v;
|
||||||
|
}
|
||||||
no_buffer:
|
no_buffer:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (psink, "we have no ringbuffer");
|
GST_DEBUG_OBJECT (psink, "we have no ringbuffer");
|
||||||
|
@ -1895,6 +1926,9 @@ gst_pulsesink_get_mute (GstPulseSink * psink)
|
||||||
uint32_t idx;
|
uint32_t idx;
|
||||||
gboolean mute = FALSE;
|
gboolean mute = FALSE;
|
||||||
|
|
||||||
|
if (!psink->mainloop)
|
||||||
|
goto no_mainloop;
|
||||||
|
|
||||||
pa_threaded_mainloop_lock (psink->mainloop);
|
pa_threaded_mainloop_lock (psink->mainloop);
|
||||||
mute = psink->mute;
|
mute = psink->mute;
|
||||||
|
|
||||||
|
@ -1924,6 +1958,12 @@ unlock:
|
||||||
return mute;
|
return mute;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
no_mainloop:
|
||||||
|
{
|
||||||
|
mute = psink->mute;
|
||||||
|
GST_DEBUG_OBJECT (psink, "we have no mainloop");
|
||||||
|
return mute;
|
||||||
|
}
|
||||||
no_buffer:
|
no_buffer:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (psink, "we have no ringbuffer");
|
GST_DEBUG_OBJECT (psink, "we have no ringbuffer");
|
||||||
|
@ -1976,6 +2016,9 @@ gst_pulsesink_device_description (GstPulseSink * psink)
|
||||||
pa_operation *o = NULL;
|
pa_operation *o = NULL;
|
||||||
gchar *t;
|
gchar *t;
|
||||||
|
|
||||||
|
if (!psink->mainloop)
|
||||||
|
goto no_mainloop;
|
||||||
|
|
||||||
pa_threaded_mainloop_lock (psink->mainloop);
|
pa_threaded_mainloop_lock (psink->mainloop);
|
||||||
pbuf = GST_PULSERING_BUFFER_CAST (GST_BASE_AUDIO_SINK (psink)->ringbuffer);
|
pbuf = GST_PULSERING_BUFFER_CAST (GST_BASE_AUDIO_SINK (psink)->ringbuffer);
|
||||||
if (pbuf == NULL || pbuf->stream == NULL)
|
if (pbuf == NULL || pbuf->stream == NULL)
|
||||||
|
@ -2002,6 +2045,11 @@ unlock:
|
||||||
return t;
|
return t;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
no_mainloop:
|
||||||
|
{
|
||||||
|
GST_DEBUG_OBJECT (psink, "we have no mainloop");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
no_buffer:
|
no_buffer:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (psink, "we have no ringbuffer");
|
GST_DEBUG_OBJECT (psink, "we have no ringbuffer");
|
||||||
|
|
|
@ -396,6 +396,9 @@ gst_pulsesrc_device_description (GstPulseSrc * pulsesrc)
|
||||||
pa_operation *o = NULL;
|
pa_operation *o = NULL;
|
||||||
gchar *t;
|
gchar *t;
|
||||||
|
|
||||||
|
if (!pulsesrc->mainloop)
|
||||||
|
goto no_mainloop;
|
||||||
|
|
||||||
pa_threaded_mainloop_lock (pulsesrc->mainloop);
|
pa_threaded_mainloop_lock (pulsesrc->mainloop);
|
||||||
|
|
||||||
if (!pulsesrc->stream)
|
if (!pulsesrc->stream)
|
||||||
|
@ -429,6 +432,12 @@ unlock:
|
||||||
pa_threaded_mainloop_unlock (pulsesrc->mainloop);
|
pa_threaded_mainloop_unlock (pulsesrc->mainloop);
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
|
|
||||||
|
no_mainloop:
|
||||||
|
{
|
||||||
|
GST_DEBUG_OBJECT (pulsesrc, "have no mainloop");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue