Bug 489049

Summary: Not changing output device while device is in use
Product: [Fedora] Fedora Reporter: Michael Monreal <michael.monreal>
Component: gnome-mediaAssignee: Bastien Nocera <bnocera>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 11CC: bnocera, lkundrak, lpoetter, mclasen
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 501599 (view as bug list) Environment:
Last Closed: 2009-09-16 15:48:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 501599    

Description Michael Monreal 2009-03-06 22:22:11 UTC
Use case: you have some song playing in e.g. totem and plug in your usb headset. You change the output to the usb headset. Playback will continue on the old output until you play another song.

Comment 1 Lennart Poettering 2009-03-19 12:05:48 UTC
Where did you change output to the USB headset? If you do that with pavucontrol then the stream will be moved right away.

I figure you have been using gnome-volume-control for this? Reassigning then.

Comment 2 Michael Monreal 2009-03-19 14:54:31 UTC
(In reply to comment #1)
> I figure you have been using gnome-volume-control for this?

Right.

Comment 3 Bastien Nocera 2009-03-25 12:48:25 UTC
pulseaudio-0.9.15-3.test5.fc11.x86_64
pavucontrol-0.9.7-5.fc11.x86_64

Nope, if I change the default output in pavucontrol (Output devices, drop-down, and tick "Default"), the stream still isn't moved to the correct sink. I tested both with the GStreamer pulse sink (using Totem) and using the ALSA connector (using "mplayer -ao alsa").

As it's easily reproduceable, feel free to ask me for whatever logs you might need.

Comment 4 Lennart Poettering 2009-03-30 14:37:16 UTC
Bastien, the "default" sink in PA is actually a misnomer. It is more of a "fallback" sink for the cases where module-stream-restore knows no other rule. Also, changing the default sink has no effect at all on existing streams.

http://pulseaudio.org/wiki/WritingVolumeControlUIs#TheDefaultDevices

If you want to change all running streams to a new sink you need to update all m-s-r rules and activate them with the "apply_now" flag when doing so.

Comment 5 Bastien Nocera 2009-03-31 01:22:12 UTC
And how do you go about that?

Comment 6 Lennart Poettering 2009-03-31 11:23:13 UTC
Call pa_ext_stream_restore_read() to get all entries and patch them, then write them back with pa_ext_stream_restore_write().

Comment 7 Bastien Nocera 2009-05-01 16:58:01 UTC
Upstream and patch are at:
http://bugzilla.gnome.org/show_bug.cgi?id=581024

Please test with this build:
http://koji.fedoraproject.org/koji/taskinfo?taskID=1331590

Comment 8 Matthias Clasen 2009-05-02 02:15:38 UTC
Tested successfully, tag request has been filed.

Comment 9 Michael Monreal 2009-05-02 14:47:03 UTC
I also tested the latest build from koji and it basicly works as intended now. A few things:

1.) when plugging the usb headset in while sound is playing on the internal card, the sound skips for a second, then resumes as normal (I guess while hal/pulse load the usb audio driver). 

2.) after switching, sound first plays correctly on the new output for about a second, then it stops and/or sounds very bad for about 2-3 seconds before sounding nice again.

3.) switching sound does reset the sound volume to 100% which is probably not what should happen... either keep the volume of the old device or keep track of saved volumes for every device?

Any of those worth filing new bugs for?

Comment 10 Bastien Nocera 2009-05-02 15:01:56 UTC
(In reply to comment #9)
> I also tested the latest build from koji and it basicly works as intended now.
> A few things:
> 
> 1.) when plugging the usb headset in while sound is playing on the internal
> card, the sound skips for a second, then resumes as normal (I guess while
> hal/pulse load the usb audio driver). 

My guess as well, worth filing a bug against PA or the kernel.

> 2.) after switching, sound first plays correctly on the new output for about a
> second, then it stops and/or sounds very bad for about 2-3 seconds before
> sounding nice again.

I saw that in apps that use pulsesink, my guess is it's a PA bug, don't think very many people did what we're doing before.

> 3.) switching sound does reset the sound volume to 100% which is probably not
> what should happen... either keep the volume of the old device or keep track of
> saved volumes for every device?

That's not normal, and I haven't seen that problem. Is it the app volume, or the hardware volume changing?

> Any of those worth filing new bugs for?

Comment 11 Michael Monreal 2009-05-02 15:38:52 UTC
(In reply to comment #10)
> That's not normal, and I haven't seen that problem. Is it the app volume, or
> the hardware volume changing?

Here's what I did:

- started totem, set app volume to 100% and started a song
- set the global output volume to 75% using the tray icon. Totem now reports a volume level of just 8% (why that? totem bug?)
- inserted headset, opened sound preferences, switched output

=> totem, tray icon, "output volume" in sound preferences *all* show 100% volumes now

Switching output device back I can reproduce the same thing every time.

(Issues 1 and 2 reported as Bug 498726 and Bug 498728.)

Comment 12 Bug Zapper 2009-06-09 11:58:08 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 13 Bastien Nocera 2009-09-16 15:48:06 UTC
The original bug was fixed for F11, so closing.