After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 596164 - Totem forces pulseaudiosink
Totem forces pulseaudiosink
Status: RESOLVED FIXED
Product: totem
Classification: Core
Component: general
2.28.x
Other Linux
: Normal normal
: ---
Assigned To: General Totem maintainer(s)
General Totem maintainer(s)
: 599948 603127 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-09-24 08:58 UTC by Krzysztof Kotlenga
Modified: 2009-11-27 13:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Try to use the GConf audiosink rather than PA (770 bytes, patch)
2009-10-05 09:45 UTC, Emilio Pozuelo Monfort
none Details | Review
Try to use the GConf audiosink rather than PA, take 2 (1.25 KB, patch)
2009-10-05 21:29 UTC, Emilio Pozuelo Monfort
needs-work Details | Review
0001-Don-t-special-case-pulseaudio-and-clean-up-the-volum.patch (6.87 KB, patch)
2009-10-30 08:52 UTC, Sebastian Dröge (slomo)
none Details | Review
0002-Don-t-special-case-pulseaudio-and-clean-up-the-volum.patch (8.70 KB, patch)
2009-10-30 10:49 UTC, Sebastian Dröge (slomo)
committed Details | Review
0001-Don-t-special-case-pulseaudio-and-clean-up-the-volum.patch (6.88 KB, patch)
2009-10-30 10:53 UTC, Sebastian Dröge (slomo)
committed Details | Review
0002-Remove-volume-restoring.patch (1.56 KB, patch)
2009-10-30 10:54 UTC, Sebastian Dröge (slomo)
none Details | Review
0002-Remove-volume-restoring-feature.patch (2.06 KB, patch)
2009-10-30 11:10 UTC, Sebastian Dröge (slomo)
committed Details | Review

Description Krzysztof Kotlenga 2009-09-24 08:58:27 UTC
Since commit a365d50c19b900911d7fe1bfdb24d22f8ab5bc98 it's impossible to use gconf configured audio sink (gstreamer-properties) - pulse audio sink is always chosen if available. It's confusing and in some cases - undesirable.
Comment 1 Joakim Soderlund 2009-10-03 22:20:16 UTC
I am affected by this bug. Totem can't play audio on my system because I don't use PulseAudio. All other applications which uses gstreamer works fine.

I'm using the Ubuntu 9.10 with OSSv4.
Comment 2 Emilio Pozuelo Monfort 2009-10-05 09:45:59 UTC
Created attachment 144775 [details] [review]
Try to use the GConf audiosink rather than PA

I wonder why Totem now tries to use PA directly, instead of just using the preferred audiosink defined in GConf. That doesn't make much sense to me.

The attached patch stops trying to use pulseaudio over the preferred audiosink (I didn't fix the indentation to make it clearer where the changes are).
Comment 3 Bastien Nocera 2009-10-05 09:56:43 UTC
Except that will break the code a bit lower down when we check for the "volume" property on the audio-sink.

You'd need to use gst_bin_get_by_name() to find whether the bin includes an element with a volume property.
Comment 4 Emilio Pozuelo Monfort 2009-10-05 10:30:31 UTC
(In reply to comment #3)
> Except that will break the code a bit lower down when we check for the "volume"
> property on the audio-sink.

How come? Do you mean this code?

+    /* If we're using a sink that has a volume property, then that's what
+     * we need to modify, not playbin's one */
+    if (g_object_class_find_property (G_OBJECT_GET_CLASS (audio_sink), "volume")) {
+      bvw->priv->pulse_audio_sink = g_object_ref (audio_sink);
+      g_signal_connect (G_OBJECT (bvw->priv->pulse_audio_sink), "notify::volume",
+			G_CALLBACK (notify_volume_cb), bvw);
+    }

AFAICS that will still work. The if block will only be entered if audio_sink has a volume property, which could be the case e.g. if pulse was loaded. If it isn't, it won't be entered, but I can't see how that's a problem, and that could be the case without my patch anyway (e.g. if the current gst_element_factory_make ("pulsesink", "audio-sink") call returns NULL and it looks at gconf).
Comment 5 Bastien Nocera 2009-10-05 10:40:10 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Except that will break the code a bit lower down when we check for the "volume"
> > property on the audio-sink.
> 
> How come? Do you mean this code?
> 
> +    /* If we're using a sink that has a volume property, then that's what
> +     * we need to modify, not playbin's one */
> +    if (g_object_class_find_property (G_OBJECT_GET_CLASS (audio_sink),
> "volume")) {
> +      bvw->priv->pulse_audio_sink = g_object_ref (audio_sink);
> +      g_signal_connect (G_OBJECT (bvw->priv->pulse_audio_sink),
> "notify::volume",
> +            G_CALLBACK (notify_volume_cb), bvw);
> +    }
> 
> AFAICS that will still work.

Did you test it? The audio_sink in this case won't have a volume property, because it's a gconfaudiosink bin, which will contain a pulsesink.

> The if block will only be entered if audio_sink
> has a volume property, which could be the case e.g. if pulse was loaded. If it
> isn't, it won't be entered, but I can't see how that's a problem, and that
> could be the case without my patch anyway (e.g. if the current
> gst_element_factory_make ("pulsesink", "audio-sink") call returns NULL and it
> looks at gconf).

Yes, if pulsesink isn't present in the system we obviously won't have a volume property since no other audiosinks implement this property. That's expected.
Comment 6 Emilio Pozuelo Monfort 2009-10-05 11:20:34 UTC
(In reply to comment #5)
> Did you test it? The audio_sink in this case won't have a volume property,
> because it's a gconfaudiosink bin, which will contain a pulsesink.

Ah I see, that makes sense. I've tested it but not with pulse, and it works fine of course, but that was expected...

I'll look at fixing it, thanks for the insight.
Comment 7 Emilio Pozuelo Monfort 2009-10-05 21:29:39 UTC
Created attachment 144846 [details] [review]
Try to use the GConf audiosink rather than PA, take 2

How about this one? Again I've tested it but not with Pulse. The change looks fine to me, but I'm not familiar with GStreamer/PA. It builds fine and there are no compiler warnings.
Comment 8 Emilio Pozuelo Monfort 2009-10-05 21:30:54 UTC
BTW I guess it would be better to try to look for the property and not for the name of the audiosink directly, in case others appear in the future that implement the volume property. But I don't know how to do that.
Comment 9 Bastien Nocera 2009-10-29 00:04:34 UTC
*** Bug 599948 has been marked as a duplicate of this bug. ***
Comment 10 Sebastian Dröge (slomo) 2009-10-29 08:41:55 UTC
(In reply to comment #7)
> Created an attachment (id=144846) [details] [review]
> Try to use the GConf audiosink rather than PA, take 2
> 
> How about this one? Again I've tested it but not with Pulse. The change looks
> fine to me, but I'm not familiar with GStreamer/PA. It builds fine and there
> are no compiler warnings.

It will leak the pulsesink, you need to unref it after getting it from the bin.

A better idea might be, to check either if there's an element that implements the GstStreamVolume interface inside the bin (gst_bin_get_by_interface) or by iterating all elements in the bin and look if it has a volume property (gst_bin_iterate_recurse).

And really, why does it even matter for totem if pulsesink or something that has a volume property exists? It should simply set the volume property on playbin2, which will internally handle everything!

(And it doesn't make any sense to only use cubic volumes if PA is used, that's very inconsistent... use it always or never)
Comment 11 Sebastian Dröge (slomo) 2009-10-29 14:07:10 UTC
Ok, I'm working on a good fix now... this will need the changes from bug #600027 though and another playbin2 fix.
Comment 13 Sebastian Dröge (slomo) 2009-10-30 08:52:54 UTC
Created attachment 146557 [details] [review]
0001-Don-t-special-case-pulseaudio-and-clean-up-the-volum.patch

Apparently no other fixes are necessary. The only thing that is a bit annoying is, that clicking on the volume button in totem will show the slider and directly forward a click to the slider. Because the slider is positioned relative to the mouse cursor position, this will always lower the volume by a few % :) No idea how to fix this, GTK is not my area of knowledge.

Apart from that the attached patch should provide perfect behaviour together with the changesets mentioned above and in the commit message.

(Patch is against master, not gnome-2-28 branch)
Comment 14 Bastien Nocera 2009-10-30 10:34:55 UTC
As I mentioned on IRC, the patch doesn't handle _not_ restoring the volume when PulseAudio (or another audio sub-system) supports it.

We don't want Totem to restore the volume when PA saves it for us just fine. So this should be hacked around for 2.28, and remove the volume restore code in Totem in master.
Comment 15 Sebastian Dröge (slomo) 2009-10-30 10:49:46 UTC
Created attachment 146559 [details] [review]
0002-Don-t-special-case-pulseaudio-and-clean-up-the-volum.patch

New patch against 2.28, that additionally adds a volume restore hack as requested by Bastien.
Comment 16 Sebastian Dröge (slomo) 2009-10-30 10:53:24 UTC
Created attachment 146560 [details] [review]
0001-Don-t-special-case-pulseaudio-and-clean-up-the-volum.patch

Patch against master
Comment 17 Sebastian Dröge (slomo) 2009-10-30 10:54:13 UTC
Created attachment 146561 [details] [review]
0002-Remove-volume-restoring.patch

Patch against master to remove the volume restoring feature
Comment 18 Sebastian Dröge (slomo) 2009-10-30 11:10:51 UTC
Created attachment 146563 [details] [review]
0002-Remove-volume-restoring-feature.patch

New patch against head, to remove the feature really completely
Comment 19 Sebastian Dröge (slomo) 2009-11-03 14:22:39 UTC
Ok, patches are pushed to master and gnome-2-28 now.
Comment 20 Bastien Nocera 2009-11-03 14:29:13 UTC
And marking as fixed.

Thanks for the patches Sebastian.
Comment 21 Bastien Nocera 2009-11-27 13:25:03 UTC
*** Bug 603127 has been marked as a duplicate of this bug. ***