From 108b3fa233660bdd0e88ac2d4642a75efa8f1eb7 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Mon, 21 May 2012 13:44:06 +0200 Subject: audiosrc: Don't use stream volumes properties if the src doesn't support them --- src/empathy-audio-src.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/empathy-audio-src.c') diff --git a/src/empathy-audio-src.c b/src/empathy-audio-src.c index 5a82979aa..ca086148f 100644 --- a/src/empathy-audio-src.c +++ b/src/empathy-audio-src.c @@ -75,6 +75,7 @@ struct _EmpathyGstAudioSrcPrivate gdouble volume; gboolean mute; + gboolean have_stream_volume; GMutex *lock; guint level_idle_id; @@ -97,7 +98,8 @@ empathy_audio_set_hw_mute (EmpathyGstAudioSrc *self, gboolean mute) if (mute == self->priv->mute) return; - g_object_set (self->priv->src, "mute", mute, NULL); + if (self->priv->have_stream_volume) + g_object_set (self->priv->src, "mute", mute, NULL); /* Belt and braces: If for some reason the underlying src doesn't mute * correctly or doesn't update us when it unmutes correctly enforce it using @@ -124,7 +126,8 @@ empathy_audio_src_set_hw_volume (EmpathyGstAudioSrc *self, if (volume == self->priv->volume) return; - g_object_set (self->priv->src, "volume", volume, NULL); + if (self->priv->have_stream_volume) + g_object_set (self->priv->src, "volume", volume, NULL); self->priv->volume = volume; } @@ -293,6 +296,8 @@ empathy_audio_src_init (EmpathyGstAudioSrc *obj) { gdouble volume; gboolean mute; + + priv->have_stream_volume = TRUE; /* 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 */ @@ -313,6 +318,11 @@ empathy_audio_src_init (EmpathyGstAudioSrc *obj) g_signal_connect (priv->src, "notify::mute", G_CALLBACK (empathy_audio_src_volume_changed), obj); } + else + { + g_message ("No stream volume available :(, mute will work though"); + priv->have_stream_volume = FALSE; + } gst_bin_add (GST_BIN (obj), priv->src); -- cgit v1.2.3