Firefox on Linux should play Ogg audio on USB headphones, when they're selected as default audio out device

RESOLVED WORKSFORME

Status

()

enhancement
RESOLVED WORKSFORME
10 years ago
4 years ago

People

(Reporter: dholbert, Unassigned)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

10 years ago
STEPS TO REPRODUCE: (on Ubuntu 9.04 Jaunty)
 1. Connect a set of USB headphones to your computer. (I'm using TekNmotion's "PulseWave" model.)

 2. In the Ubuntu main menu, choose System / Preferences / Sound

 3. Under "Sound Events" and "Music and Movies", choose your USB headphone set from the dropdown box. (mine shows up as "C-Media USB Headphone Set USB Audio".)  Use the "test" buttons to verify that you hear sound in the USB headphones.

 4. Start Firefox, and load the URL.
    --> Check USB headphones for sound
    --> Check speakers (using normal audio-out jack) for sound

EXPECTED RESULTS:
 * The audio should play on the USB headphones.
 * There should be no sound playing via the normal audio jack.

ACTUAL RESULTS:
 * No sound on USB headphones
 * Sound plays via normal audio out jack.

NOTE:
  For comparison, you can save a local copy of the Ogg file and try playing it in Totem (Ubuntu's default video player).  When I do that, I get sound on the USB headphones, with nothing on the audio out jack. (expected results)
(Reporter)

Comment 1

10 years ago
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2a1pre) Gecko/20090528 Minefield/3.6a1pre
(Reporter)

Comment 2

10 years ago
NOTE: I also get this issue with Flash audio (e.g. Pandora, YouTube), though that may be a Flash bug.

In contrast, the Totem browser plugin (which shows up, embedded, whenever I directly load an mp3 file in Firefox) gives expected behavior -- it plays its audio via the USB headphones.
(Reporter)

Updated

10 years ago
Summary: Firefox on Linux should play audio on USB headphones, when they're selected as default audio out device → Firefox on Linux should play Ogg audio on USB headphones, when they're selected as default audio out device
We're using the default ALSA PCM device (see sa_stream_open in media/libsydneyaudio/src/sydney_audio_alsa.c), which I think is determined by your ALSA configuration ($HOME/.asoundrc or /etc/asound.conf).  If PulseAudio is enabled, I would expect things to work like you expected them to.  Do you have PulseAudio enabled?  I think it's the default since Ubuntu 8.04.
(Reporter)

Comment 4

10 years ago
(In reply to comment #3)
> your ALSA configuration ($HOME/.asoundrc or /etc/asound.conf).

Neither of those files exist on my machine.  The closest match I can find is 
/etc/ld.so.conf.d/libasound2.conf -- that file just contains the string "/usr/lib/alsa-lib" and nothing else.

One possibly-relevant note, though -- in step 3 from the steps to reproduce, I just noticed that I have *two* options for my headphones, in the sound-preferences drop-down list:
  * C-Media USB Headphone Set USB Audio (ALSA)
  * C-Media USB Headphone Set USB Audio (OSS)
If I select the "ALSA" one and click "Test", though, I get no sound -- instead, I get an immediate error dialog saying "audiotestsrc wave=sine freq=512 ! audioconvert ! audioresample ! gconfaudiosink profile=music: Could not open audio device for playback."

So, I've been using the "OSS" entry - perhaps that's why Firefox isn't able to find it.

> Do you have PulseAudio enabled?  I think it's the default since Ubuntu 8.04.

I think so... I haven't manually disabled it, and if I run "ps aux | grep pulseaudio", it shows me that the "/usr/bin/pulseaudio --start" is currently running.
Is your Ubuntu install fresh, or an upgrade from a previous release?

My question about PulseAudio wasn't specific enough, sorry.  Since we use ALSA (via sydneyaudio), the question is really whether ALSA is be redirected to PulseAudio.  An easy way to test this is to start playing a video in Firefox, then bring up the PulseAudio volume control and look for a stream owned by Firefox.  It'll only show up while sound is playing, since that's the only time we have the sound device active.

The Flash problem is a separate issue (they've got their own sound code, but also use ALSA directly), but the cause might be related.  Which version of Flash do you have installed?  I know some versions of Flash and PulseAudio had issues that were worked around by installing libflashsupport.  I think the current situation with the latest Flash 10 release is that it should work with PulseAudio (and you no longer need libflashsupport and should remove it).

I tested this situation out on my Fedora 11 (beta) setup, but can't see the same problem.  I only see my USB sound device show up once (no ALSA vs OSS issue), and Firefox's media support uses whatever output device I choice (including switching at runtime while a video is playing).
On a Fedora 8 install with PulseAudio removed, I see the behaviour you describe.  I'm guessing that you're seeing this behaviour because our audio stream isn't going via PulseAudio but direct to the sound hardware.

If that's the case, I wonder if we should still try to fix this for ALSA-only users.  It's probably only a matter of calling the appropriate GNOME/GTK+ API to find out the user's prefer output device.
(Reporter)

Comment 7

10 years ago
(In reply to comment #5)
> Is your Ubuntu install fresh, or an upgrade from a previous release?

It's fresh (starting with a beta version of Jaunty).

> the question is really whether ALSA is be redirected to
> PulseAudio.  An easy way to test this is to start playing a video in Firefox,
> then bring up the PulseAudio volume control and look for a stream owned by
> Firefox.  It'll only show up while sound is playing, since that's the only time
> we have the sound device active.

I'm not sure where to find the PulseAudio volume control, but I tried the "pacmd" command-line utility, and it does mention a Firefox client. (See output below, with "[--snip--]" representing other audio clients that I've omitted).  

This command's output includes the Firefox client up until the video completes, or until I close the video's tab.  (Interestingly, Firefox still shows up as a client when I pause a video.  But then if I close the tab, or resume the video & let it finish, it'll no longer show up as a client.)

Here's the output:

[dholbert@orange:~]$ pacmd list-clients
Welcome to PulseAudio! Use "help" for usage information.
>>> 11 client(s) logged in.
[--snip--]
esound-protocol.peer = "UNIX socket client"
    index: 102
    driver: <pulsecore/protocol-native.c>
    owner module: 10
    properties:
application.name = "ALSA plug-in [firefox-bin]"
native-protocol.peer = "UNIX socket client"
native-protocol.version = "14"
application.process.id = "1494"
application.process.user = "dholbert"
application.process.host = "orange"
application.process.binary = "firefox-bin"
application.language = "en_US.UTF-8"
    index: 103
    driver: <pulsecore/cli.c>
    owner module: 17
    properties:
application.name = "UNIX socket client"

> Which version of Flash do you have installed?

about:plugins tells me I've got Flash 10.0 r22, which is installed via the "flashplugin-nonfree" package, at version 10.0.22.87ubuntu2

Comment 8

10 years ago
> Interestingly, Firefox still shows up as a
> client when I pause a video.  But then if I 
> close the tab, or resume the video & let it 
> finish, it'll no longer show up as a client.)

This is normal and correct operation. Pausing a video only pauses the audio stream. Without this PulseAudio settings for that stream (volume, etc) would change whenever a video is paused and resumed.
(Reporter)

Comment 9

10 years ago
(In reply to comment #8)
> This is normal and correct operation.  Pausing a video only pauses the audio
> stream.

Ah, thanks for clarifying.  I was just including that chunk of information because it seemed to contradict this chunk of comment #5

> It'll only show up while sound is playing, since that's the only time
> we have the sound device active.

In any case, the bottom line of comment 7 is that I don't think I've got PulseAudio removed, and it looks like Firefox _is_ connecting to PulseAudio (but still ending up on the wrong audio output device).

Comment 10

10 years ago
Ah, right. That part of comment 5 used to be right until recently. We used to close the audio stream when pausing and the change to pause/resume it was only recent.
I was going to suggest that whatever tool you're using to change the audio output isn't taking effect for ALSA/PulseAudio, but if Totem works as expected (as you said it does) then I'm out of ideas.

It sounds like the PulseAudio integration is different on Ubuntu to Fedora, so I'll install Ubuntu in a VM once the 3.5RC fires are out and work out what's going on.
(Reporter)

Comment 12

10 years ago
(In reply to comment #11)
> if Totem works as expected
> (as you said it does) then I'm out of ideas.

Yup, Totem definitely works.

> I'll install Ubuntu in a VM once the 3.5RC fires are out and work out what's
> going on.

Thanks! I'll try booting the Ubuntu Live CD to confirm that I see the problem there, just to make absolutely sure it's not some odd kink in my post-install configuration.
(Reporter)

Comment 13

10 years ago
Just as a sanity check -- I've now confirmed this bug in the stock Ubuntu 9.04 LiveCD environment, using downloaded builds of latest-mozilla-central and latest-mozilla-1.9.1.  I'm also using a different physical machine from the one I was testing before. (I was previously using a Dell Optiplex 745 desktop; I'm now using a Thinkpad T60)

These are the nightly builds I tested:
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2a1pre) Gecko/20090602 Minefield/3.6a1pre
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1pre) Gecko/20090602 Shiretoko/3.5pre

Ubuntu LiveCD URL: http://releases.ubuntu.com/9.04/ubuntu-9.04-desktop-i386.iso

I just followed the steps from comment 0, with no other modifications to the stock LiveCD environment, and I do see the bug -- Firefox plays Ogg audio on my speakers, whereas Totem plays Ogg audio on my USB headphones.

Comment 14

8 years ago
The "pulseaudio volume control" you're looking for is run by the command "pavucontrol". It's a GUI that will let you see the fall-back ("default") sound device (under the output-devices tab) as well as all the current streams. If you see a stream for firefox there, firefox is working correctly. In "pavucontrol", you can also select an override for that stream, to say "go to device X".

Check if the "Set as Fallback" checkbox-button is turned on on your usb headphones under "Output Devices". You can check if this is working correctly by running "paplay <some .wav file>", and seeing if it correctly plays on the usb headphones.

Then, under 'playback', select the firefox stream (if it exists), and make sure it's going to the default. You can manually tell it to use the usb as well.

If the stream isn't showing up under pavucontrol, then there may be a Firefox bug at play. If it does show up, this is largely outside of Firefox's control.

(There's potentially a related enhancement where Firefox might do better to 'tag' the audio with a particular role, but that's a different issue)

The status on this bug should be set to WORKSFORME or INCOMPLETE, unless the original reporter can confirm that it's not showing up under pavucontrol. If it is showing up under pavucontrol, under a fresh install, with the 'fallback' device set to the USB headphones, but the stream still going to the wrong device..... then firefox is probably doing something kind of weird :)
Component: Audio/Video → Audio/Video: Playback
My understanding is that this issue has been fixed. Re-open if there is still a problem.
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → WORKSFORME
(Reporter)

Updated

4 years ago
Flags: needinfo?(dholbert)
(Reporter)

Comment 16

4 years ago
Yup, this is WORKSFORME. (Using a different USB-headphones configuration, with a "plugable"-brand USB audio adapter, but I think it's effectively equivalent to what I had in comment 0.)

tinyvid.tv is timing out right now, so I used this URL as my testcase: http://www.vorbis.com/music/Epoq-Lepidoptera.ogg
Flags: needinfo?(dholbert)
(Reporter)

Comment 17

4 years ago
(For the record, I'm using Ubuntu 15.10 at this point - not 9.04 as in comment 0.  Only mentioning in case this became WORKSFORME as a result of an Ubuntu change rather than a Firefox change.)
You need to log in before you can comment on or make changes to this bug.