mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
pulsesink: s/ressource/resource/
https://bugzilla.gnome.org/show_bug.cgi?id=643087
This commit is contained in:
parent
caa971e605
commit
683c96b37a
1 changed files with 16 additions and 16 deletions
|
@ -124,7 +124,7 @@ static pa_threaded_mainloop *mainloop = NULL;
|
||||||
static guint mainloop_ref_ct = 0;
|
static guint mainloop_ref_ct = 0;
|
||||||
|
|
||||||
/* lock for access to shared resources */
|
/* lock for access to shared resources */
|
||||||
static GMutex *pa_shared_ressource_mutex = NULL;
|
static GMutex *pa_shared_resource_mutex = NULL;
|
||||||
|
|
||||||
/* We keep a custom ringbuffer that is backed up by data allocated by
|
/* We keep a custom ringbuffer that is backed up by data allocated by
|
||||||
* pulseaudio. We must also overide the commit function to write into
|
* pulseaudio. We must also overide the commit function to write into
|
||||||
|
@ -181,8 +181,8 @@ G_DEFINE_TYPE (GstPulseRingBuffer, gst_pulseringbuffer, GST_TYPE_RING_BUFFER);
|
||||||
static void
|
static void
|
||||||
gst_pulsesink_init_contexts (void)
|
gst_pulsesink_init_contexts (void)
|
||||||
{
|
{
|
||||||
g_assert (pa_shared_ressource_mutex == NULL);
|
g_assert (pa_shared_resource_mutex == NULL);
|
||||||
pa_shared_ressource_mutex = g_mutex_new ();
|
pa_shared_resource_mutex = g_mutex_new ();
|
||||||
gst_pulse_shared_contexts = g_hash_table_new_full (g_str_hash, g_str_equal,
|
gst_pulse_shared_contexts = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||||
g_free, NULL);
|
g_free, NULL);
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ gst_pulsering_destroy_stream (GstPulseRingBuffer * pbuf)
|
||||||
static void
|
static void
|
||||||
gst_pulsering_destroy_context (GstPulseRingBuffer * pbuf)
|
gst_pulsering_destroy_context (GstPulseRingBuffer * pbuf)
|
||||||
{
|
{
|
||||||
g_mutex_lock (pa_shared_ressource_mutex);
|
g_mutex_lock (pa_shared_resource_mutex);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (pbuf, "destroying ringbuffer %p", pbuf);
|
GST_DEBUG_OBJECT (pbuf, "destroying ringbuffer %p", pbuf);
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ gst_pulsering_destroy_context (GstPulseRingBuffer * pbuf)
|
||||||
g_free (pbuf->context_name);
|
g_free (pbuf->context_name);
|
||||||
pbuf->context_name = NULL;
|
pbuf->context_name = NULL;
|
||||||
}
|
}
|
||||||
g_mutex_unlock (pa_shared_ressource_mutex);
|
g_mutex_unlock (pa_shared_resource_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -452,7 +452,7 @@ gst_pulseringbuffer_open_device (GstRingBuffer * buf)
|
||||||
pbuf->context_name = g_strdup (psink->client_name);
|
pbuf->context_name = g_strdup (psink->client_name);
|
||||||
|
|
||||||
pa_threaded_mainloop_lock (mainloop);
|
pa_threaded_mainloop_lock (mainloop);
|
||||||
g_mutex_lock (pa_shared_ressource_mutex);
|
g_mutex_lock (pa_shared_resource_mutex);
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -513,7 +513,7 @@ gst_pulseringbuffer_open_device (GstRingBuffer * buf)
|
||||||
|
|
||||||
GST_LOG_OBJECT (psink, "opened the device");
|
GST_LOG_OBJECT (psink, "opened the device");
|
||||||
|
|
||||||
g_mutex_unlock (pa_shared_ressource_mutex);
|
g_mutex_unlock (pa_shared_resource_mutex);
|
||||||
pa_threaded_mainloop_unlock (mainloop);
|
pa_threaded_mainloop_unlock (mainloop);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -521,7 +521,7 @@ gst_pulseringbuffer_open_device (GstRingBuffer * buf)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
unlock_and_fail:
|
unlock_and_fail:
|
||||||
{
|
{
|
||||||
g_mutex_unlock (pa_shared_ressource_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);
|
||||||
|
@ -2722,7 +2722,7 @@ gst_pulsesink_change_state (GstElement * element, GstStateChange transition)
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
g_mutex_lock (pa_shared_ressource_mutex);
|
g_mutex_lock (pa_shared_resource_mutex);
|
||||||
if (!mainloop_ref_ct) {
|
if (!mainloop_ref_ct) {
|
||||||
GST_INFO_OBJECT (element, "new pa main loop thread");
|
GST_INFO_OBJECT (element, "new pa main loop thread");
|
||||||
if (!(mainloop = pa_threaded_mainloop_new ()))
|
if (!(mainloop = pa_threaded_mainloop_new ()))
|
||||||
|
@ -2730,11 +2730,11 @@ gst_pulsesink_change_state (GstElement * element, GstStateChange transition)
|
||||||
mainloop_ref_ct = 1;
|
mainloop_ref_ct = 1;
|
||||||
res = pa_threaded_mainloop_start (mainloop);
|
res = pa_threaded_mainloop_start (mainloop);
|
||||||
g_assert (res == 0);
|
g_assert (res == 0);
|
||||||
g_mutex_unlock (pa_shared_ressource_mutex);
|
g_mutex_unlock (pa_shared_resource_mutex);
|
||||||
} else {
|
} else {
|
||||||
GST_INFO_OBJECT (element, "reusing pa main loop thread");
|
GST_INFO_OBJECT (element, "reusing pa main loop thread");
|
||||||
mainloop_ref_ct++;
|
mainloop_ref_ct++;
|
||||||
g_mutex_unlock (pa_shared_ressource_mutex);
|
g_mutex_unlock (pa_shared_resource_mutex);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
|
@ -2758,7 +2758,7 @@ gst_pulsesink_change_state (GstElement * element, GstStateChange transition)
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||||
if (mainloop) {
|
if (mainloop) {
|
||||||
g_mutex_lock (pa_shared_ressource_mutex);
|
g_mutex_lock (pa_shared_resource_mutex);
|
||||||
mainloop_ref_ct--;
|
mainloop_ref_ct--;
|
||||||
if (!mainloop_ref_ct) {
|
if (!mainloop_ref_ct) {
|
||||||
GST_INFO_OBJECT (element, "terminating pa main loop thread");
|
GST_INFO_OBJECT (element, "terminating pa main loop thread");
|
||||||
|
@ -2766,7 +2766,7 @@ gst_pulsesink_change_state (GstElement * element, GstStateChange transition)
|
||||||
pa_threaded_mainloop_free (mainloop);
|
pa_threaded_mainloop_free (mainloop);
|
||||||
mainloop = NULL;
|
mainloop = NULL;
|
||||||
}
|
}
|
||||||
g_mutex_unlock (pa_shared_ressource_mutex);
|
g_mutex_unlock (pa_shared_resource_mutex);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -2778,7 +2778,7 @@ gst_pulsesink_change_state (GstElement * element, GstStateChange transition)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
mainloop_failed:
|
mainloop_failed:
|
||||||
{
|
{
|
||||||
g_mutex_unlock (pa_shared_ressource_mutex);
|
g_mutex_unlock (pa_shared_resource_mutex);
|
||||||
GST_ELEMENT_ERROR (pulsesink, RESOURCE, FAILED,
|
GST_ELEMENT_ERROR (pulsesink, RESOURCE, FAILED,
|
||||||
("pa_threaded_mainloop_new() failed"), (NULL));
|
("pa_threaded_mainloop_new() failed"), (NULL));
|
||||||
return GST_STATE_CHANGE_FAILURE;
|
return GST_STATE_CHANGE_FAILURE;
|
||||||
|
@ -2788,7 +2788,7 @@ state_failure:
|
||||||
if (transition == GST_STATE_CHANGE_NULL_TO_READY) {
|
if (transition == GST_STATE_CHANGE_NULL_TO_READY) {
|
||||||
/* Clear the PA mainloop if baseaudiosink failed to open the ring_buffer */
|
/* Clear the PA mainloop if baseaudiosink failed to open the ring_buffer */
|
||||||
g_assert (mainloop);
|
g_assert (mainloop);
|
||||||
g_mutex_lock (pa_shared_ressource_mutex);
|
g_mutex_lock (pa_shared_resource_mutex);
|
||||||
mainloop_ref_ct--;
|
mainloop_ref_ct--;
|
||||||
if (!mainloop_ref_ct) {
|
if (!mainloop_ref_ct) {
|
||||||
GST_INFO_OBJECT (element, "terminating pa main loop thread");
|
GST_INFO_OBJECT (element, "terminating pa main loop thread");
|
||||||
|
@ -2796,7 +2796,7 @@ state_failure:
|
||||||
pa_threaded_mainloop_free (mainloop);
|
pa_threaded_mainloop_free (mainloop);
|
||||||
mainloop = NULL;
|
mainloop = NULL;
|
||||||
}
|
}
|
||||||
g_mutex_unlock (pa_shared_ressource_mutex);
|
g_mutex_unlock (pa_shared_resource_mutex);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue