aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-11-18 18:48:15 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-11-19 01:49:57 +0800
commite156b00ebf846c5e3ed8b5bdee693a9740c9faba (patch)
treeb3d85d4ed1c01df4b24927cbbd6a3fab4e1ea867
parentbe42e8d30bedc020f96bbe719ac3c6620aa59b7e (diff)
downloadgsoc2013-empathy-e156b00ebf846c5e3ed8b5bdee693a9740c9faba.tar
gsoc2013-empathy-e156b00ebf846c5e3ed8b5bdee693a9740c9faba.tar.gz
gsoc2013-empathy-e156b00ebf846c5e3ed8b5bdee693a9740c9faba.tar.bz2
gsoc2013-empathy-e156b00ebf846c5e3ed8b5bdee693a9740c9faba.tar.lz
gsoc2013-empathy-e156b00ebf846c5e3ed8b5bdee693a9740c9faba.tar.xz
gsoc2013-empathy-e156b00ebf846c5e3ed8b5bdee693a9740c9faba.tar.zst
gsoc2013-empathy-e156b00ebf846c5e3ed8b5bdee693a9740c9faba.zip
AudioSink: Setup the initial properties in the main thread
-rw-r--r--src/empathy-audio-sink.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/src/empathy-audio-sink.c b/src/empathy-audio-sink.c
index 372e9f991..d912e1d2d 100644
--- a/src/empathy-audio-sink.c
+++ b/src/empathy-audio-sink.c
@@ -260,6 +260,31 @@ out:
g_static_mutex_unlock (&self->priv->volume_mutex);
}
+static gboolean
+empathy_audio_sink_volume_idle_setup (gpointer user_data)
+{
+ EmpathyGstAudioSink *self = EMPATHY_GST_AUDIO_SINK (user_data);
+ gdouble volume;
+
+ g_static_mutex_lock (&self->priv->volume_mutex);
+ self->priv->volume_idle_id = 0;
+ g_static_mutex_unlock (&self->priv->volume_mutex);
+
+ /* We can't do a bidirection bind as the ::notify comes from another
+ * thread, for other bits of empathy it's most simpler if it comes from
+ * the main thread */
+ g_object_bind_property (self, "volume", self->priv->sink, "volume",
+ G_BINDING_DEFAULT);
+
+ /* sync and callback for bouncing */
+ g_object_get (self->priv->sink, "volume", &volume, NULL);
+ g_object_set (self, "volume", volume, NULL);
+ g_signal_connect (self->priv->sink, "notify::volume",
+ G_CALLBACK (empathy_audio_sink_volume_updated), self);
+
+ return FALSE;
+}
+
static GstPad *
empathy_audio_sink_request_new_pad (GstElement *element,
GstPadTemplate *templ,
@@ -296,18 +321,11 @@ empathy_audio_sink_request_new_pad (GstElement *element,
if (GST_IS_STREAM_VOLUME (self->priv->sink))
{
- gdouble volume;
- /* We can't do a bidirection bind as the ::notify comes from another
- * thread, for other bits of empathy it's most simpler if it comes from
- * the main thread */
- g_object_bind_property (self, "volume", self->priv->sink, "volume",
- G_BINDING_DEFAULT);
-
- /* sync and callback for bouncing */
- g_object_get (self->priv->sink, "volume", &volume, NULL);
- g_object_set (self, "volume", volume, NULL);
- g_signal_connect (self->priv->sink, "notify::volume",
- G_CALLBACK (empathy_audio_sink_volume_updated), self);
+ g_static_mutex_lock (&self->priv->volume_mutex);
+ if (self->priv->volume_idle_id == 0)
+ self->priv->volume_idle_id = g_idle_add (
+ empathy_audio_sink_volume_idle_setup, self);
+ g_static_mutex_unlock (&self->priv->volume_mutex);
}
else
{