Closed Bug 1257050 Opened 5 years ago Closed 3 years ago
Upmix mono audio to stereo when using Pulse
Audio as backend
User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 Build ID: 20160304160021 Steps to reproduce: TL;DR: using 5.1 speakers, can't get proper playback of mono audio in Firefox with PulseAudio as a backend under any circumstances, and can't get mono audio playback at all without breaking stereo audio playback. REQUESTED FIX: upmix mono audio tracks to front-left+front-right when using PulseAudio. LONG VERSION: When playing mono HTML5 audio with PulseAudio as a backend, Firefox sends a mono stream to PulseAudio, which is mapped to a channel named "mono". PulseAudio can be configured to either upmix/downmix channels, or not, using the enable-remix option in its daemon.conf, usually under /etc/pulse. There is no ability to configure upmix/downmix behaviour other than enabling or disabling it. When PulseAudio is configured to not remix, it maps single-channel audio to a "mono" channel (or Firefox/ffmpeg/cubeb sends that channel map?), which it then discards. An appalling default, but unfortunately some PA devs seem to have a tenuous link to reality :J Stereo audio in this case receives a default map of front-left+front-right, which is played properly. When PulseAudio is configured to remix, given a 5.1 speaker setup it upmixes mono to *all 6* channels, and stereo to *all 6 channels*, even when given a stereo channel map. A pretty terrible alternative. When playing back mono audio in Firefox, this results in: remix off, stereo speaker configuration: no audio remix off, 5.1 speaker configuration: no audio remix on, stereo speaker configuration: audio upmixed to left and right channels remix on, 5.1 speaker configuration: audio upmixed to ALL channels When playing back stereo audio in Firefox, this results in: remix off, stereo speaker configuration: audio sent to left and right channels remix off, 5.1 speaker configuration: audio sent to left and right channels remix on, stereo speaker configuration: audio sent to left and right channels remix on, 5.1 speaker configuration: audio upmixed to ALL channels From the above, only stereo speaker configurations with PulseAudio remixing enabled will result in sensible audio output in all cases. With 5.1 speaker configurations, the choice is between mono and stereo upmixed to all channels, or no mono audio reproduction at all. Other video/audio players can be configured to sidestep this by having them map mono to the 5.1 "centre" channel or upmixing it and mapping it to "front left" and "front right" (and disabling PulseAudio remixing entirely). If Firefox had an option to upmix mono to stereo (or did it by default when PulseAudio is a backend), then it would fix mono playback on 5.1 speaker systems, without breaking any of the other cases. I'm aware PulseAudio's behaviour is ridiculous, but the issue was reported in 2011 and has been languishing since then: https://bugs.freedesktop.org/show_bug.cgi?id=39360 I'm not sure if the issue surfaced as part of the gst->ffmpeg switchover or not? It didn't seem to happen before a few versions ago, but I don't know exactly when. Was GStreamer upmixing mono itself?
Another option should be for Firefox to send a channel map to PulseAudio that maps the mono track to the centre channel instead. Results should be as follows: 2.0 speakers, remix disabled: before: no sound; after: no sound (no change) 2.0 speakers, remix enabled: before: upmixed to 2ch by PA; after: upmixed to 2ch by PA 5.1 speakers, remix disabled: before: no sound; after: audio from centre channel 5.1 speakers, remix enabled: before: upmixed to all channels by PA; after: audio from centre channel
5 years ago
Priority: -- → P2
5 years ago
Depends on: 1262753
I have never experienced such behaviour with pulse under any circumstances. Playback of mono streams have always played nicely (not talking about Firefox here) regardless of the speaker configuration. Could that just be related to just your particular use and configuration pulse. Bug 1262753 won't help in its current state as it wasn't intended to upmix anything. If any workaround is to be placed, that should be in the cubeb pulse backend.
Component: Audio/Video: Playback → Audio/Video: cubeb
302 Alex, I'll be busy on Web Audio API soon, and he's done the last major pulse audio work.
Flags: needinfo?(padenot) → needinfo?(achronop)
(In reply to Jean-Yves Avenard [:jya] from comment #2) > I have never experienced such behaviour with pulse under any circumstances. > Playback of mono streams have always played nicely (not talking about > Firefox here) regardless of the speaker configuration. Do you have pulseaudio upmixing enabled or disabled? Stereo or 5.1 (or greater) config? If you have a 2.x setup you're unlikely to have come across pulseaudio's pathological multi-channel upmix behaviour and been driven to disable it ;)
Assignee: nobody → achronop
Note that in bug 1264199, I ended up always configuring to have a 2 channels audio output (except if force mono settings is on) ; which would likely bypass the problem for the common configuration. But this workaround will only be temporary, as ultimately we want cubeb to handle channel changes natively (and if force mono is enabled, cubeb will get mono)
I'm not clear what is wrong with setting remix on. In stereo it goes to all speakers, in mono it goes to all speakers.
Never saw your reply Anthony. You've described exactly the problem. with surround configurations that is not sane at all. Stereo should go to front left and front right, and mono should either go to centre or front right plus front left.
Mass change P2->P3 to align with new Mozilla triage process.
Priority: P2 → P3
As of PulseAudio 11.0, there is a feature to do what you want -- remixing-use-all-sink-channels. You can use it with: $ echo "remixing-use-all-sink-channels = true" >> ~/.config/pulse/daemon.conf
Hi Arun, indeed, thanks - in fact I was waiting with bated breath for PA 11 for exactly that reason, and immediately used that option when it was released. However, the new option should be set to false, not the (default of) true, since remixing mono/stereo to all channels (instead of just outputting mono to the front, and leaving stereo alone) was the original problem. All has been working perfectly since PA finally landed some sane upmixing behaviour, so a Firefox workaround is no longer needed. For reference in case anyone else sees the same problem, the fix is: # per-user: $ echo 'remixing-use-all-sink-channels = no' >> ~/.config/pulse/daemon.conf # system-wide: $ echo 'remixing-use-all-sink-channels = no' | sudo tee -a /etc/pulse/daemon.conf BTW I can't close this bug as "obsolete", can someone else do that?
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
this bug would have been fixed with bug 1432779
You need to log in before you can comment on or make changes to this bug.