Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Issue 32757 Implement PulseAudio backend
Starred by 70 users Project Member Reported by scherkus@chromium.org, Jan 20 2010 Back to list
Status: Fixed
Owner:
Closed: Mar 2013
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Feature

Blocked on:
issue 111392

Blocking:
issue chromium-os:1409
issue 40111
issue 55489
issue 55490
issue 108396
issue 157290
issue 183166

Restricted
  • Only users with EditIssue permission may comment.



Sign in to add a comment
It'd be nifty to see if we can code directly to PulseAudio's API instead of 
ALSA.

Not sure what the benefits would be, but we'll leave that up to the owner of 
this bug :)
 
Comment 1 by evan@chromium.org, Jan 24 2010
I wonder if it'd make us show up as a separate application in pulse's per-app volume 
settings?  I noticed mplayer does but our flash doesn't.
Comment 2 by evan@chromium.org, Jan 24 2010
Durrr, of course that is flash using alsa, not us.
Yeah it's an interesting idea we've kicked around.. could give us overall better 
experience on pulse systems.
Labels: -Pri-3 Pri-2
Labels: -Mstone-X Mstone-6
Labels: -Pri-2 Pri-1
Please assign if it's a P1.
Status: Assigned
Bah there is an owner but he hasn't quite attained provisional committer status yet.

I'll assign to me for now (this almost might get punted anyway)
Labels: -Internals-Video -Area-Internals Feature-Media Area-WebKit
Labels: -Mstone-6 Mstone-7
Labels: -Pri-1 -Mstone-7 Pri-2 Mstone-X
Status: Available
Comment 12 by evan@chromium.org, Jan 26 2011
Labels: -HelpWanted
We're trying to deprecate HelpWanted, so I'm bulk-removing it from some bugs.
Comment 13 by tra...@gmail.com, Jun 18 2011
almost all desktop distributions use pulse by default and it might certainly be really very user-friendly to have better support for PulseAudio in Chromium. :)
Labels: -Mstone-X Mstone-16
Owner: vrk@chromium.org
Status: Assigned
vrk: pass to slock
Comment 15 by slock@chromium.org, Jul 21 2011
Owner: slock@chromium.org
Comment 16 by slock@chromium.org, Jul 21 2011
Blocking: 55490
Comment 17 by slock@chromium.org, Jul 21 2011
Blocking: 55489
Project Member Comment 18 by bugdroid1@chromium.org, Aug 19 2011
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=97408

------------------------------------------------------------------------
r97408 | slock@chromium.org | Thu Aug 18 18:42:47 PDT 2011

Changed paths:
 A http://src.chromium.org/viewvc/chrome/trunk/src/media/audio/linux/pulse_output.cc?r1=97408&r2=97407&pathrev=97408
 M http://src.chromium.org/viewvc/chrome/trunk/src/media/base/media_switches.cc?r1=97408&r2=97407&pathrev=97408
 M http://src.chromium.org/viewvc/chrome/trunk/src/media/media.gyp?r1=97408&r2=97407&pathrev=97408
 M http://src.chromium.org/viewvc/chrome/trunk/src/media/base/media_switches.h?r1=97408&r2=97407&pathrev=97408
 A http://src.chromium.org/viewvc/chrome/trunk/src/media/audio/linux/pulse_output.h?r1=97408&r2=97407&pathrev=97408
 M http://src.chromium.org/viewvc/chrome/trunk/src/media/audio/linux/audio_manager_linux.cc?r1=97408&r2=97407&pathrev=97408
 M http://src.chromium.org/viewvc/chrome/trunk/src/media/audio/linux/alsa_output_unittest.cc?r1=97408&r2=97407&pathrev=97408
 M http://src.chromium.org/viewvc/chrome/trunk/src/media/audio/linux/audio_manager_linux.h?r1=97408&r2=97407&pathrev=97408

PulseAudio Sound Playback on Linux

This is the preliminary implementation of a PulseAudio sound backend for Chrome on Linux.  At first, PulseAudio's mainloop, mainloop_api, and context constructs will be used instead of the message loop system used in alsa_output.  This will be stereo only at first.  Also, at first, PulseAudio will be dynamically linked in media.gyp as opposed to the final solution which will dynamically link PulseAudio in runtime if it is available.

BUG= 32757 
TEST=


Review URL: http://codereview.chromium.org/7473021
------------------------------------------------------------------------
Comment 19 by bl...@blami.net, Aug 20 2011
Will be still possible to use plain ALSA if I don't have Pulse audio daemon installed but have Pulse libs on my system (dependency hell)?
Sounds a bit like a rather uncommon case, isn't it?
Cc: phajdan.jr@chromium.org
This is off-topic, but there is -Duse_pulseaudio gyp switch.
Labels: bulkmove Mstone-17
Status: Available
Moving Slock bugs to Avail and next Mstone
Labels: Mstone-18
Owner: ----
Labels: -Feature-Media -bulkmove Feature-Media-Audio
Comment 25 Deleted
Labels: -Mstone-18
If you can't wait until the next milestone release and are frustrated that chrome/flash is appropriating the alsa device and your device only support 1 stream in hardware you can force alsa to use pulseaudio as shown here 
http://pulseaudio.org/wiki/PerfectSetup#ALSAApplications

The verify if chrome is using pulse audio use pavucontrol "Pulseaudio volume control" it should show something similar to the screenshot attached.  I assume once chrome is natively using pulseaudio it will indicate in the label in pavucontrol and you can remove the asound.conf setting to verify.
Screenshot.png
56.9 KB View Download
Blocking: 108396
hi, my 2cents, I solved this problem for flashplayer in Firefox as follows: http://mennucc1.debian.net/flash64.html . Unfortunately flashplayer in google-chrome (version 19.0.1061.1 dev) ignores my workaround :-(
Blockedon: 111392
i'm running a system halfway upgraded from ubuntu-lucid to ubuntu-precise, but all the sound libs are precise

i'm seeing a ton of these lines in xsession-errors
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream

perhaps this might help, i don't believe chrome should be using any alsa components when running through pulseaudio.  

when playing an mp3 with vlc, i get
sudo lsof +D /usr/lib | grep -i vlc | grep -e pulse -e alsa
vlc       16374   mem    REG  252,0   385240  663060 /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so
vlc       16374   mem    REG  252,0   294704  663061 /usr/lib/x86_64-linux-gnu/libpulse.so.0.13.5

but chrome is doing this
sudo lsof +D /usr/lib | grep -i chrome | grep -e pulse -e alsa
chrome    10644   mem    REG  252,0    27248  917575 /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_pcm_pulse.so
chrome    10644   mem    REG  252,0   385240  663060 /usr/lib/x86_64-linux-gnu/libpulsecommon-1.1.so
chrome    10644   mem    REG  252,0   294704  663061 /usr/lib/x86_64-linux-gnu/libpulse.so.0.13.5

i don't think chrome should be accessing libasound_module_pcm_pulse.so
this might also explain why i get a line 
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
written to my .xsession-errors every second or so
Comment 34 by red...@gmail.com, Aug 8 2012
I'm running oneiric, though I upgraded alsa to 1.0.25. I'm getting something similar (running Chromium now). I also see vlc using the libalsa plugin.

$ sudo lsof +D /usr/lib | grep -e pulse -e alsa | grep -i -e vlc -e chrom -e spot
chromium- 2175   mem    REG    8,1     5540 9176796 /usr/lib/i386-linux-gnu/alsa-lib/libasound_module_rate_speexrate.so
spotify   2955   mem    REG    8,1   408016 8914235 /usr/lib/i386-linux-gnu/libpulsecommon-1.0.so
spotify   2955   mem    REG    8,1   313604 8914024 /usr/lib/i386-linux-gnu/libpulse.so.0.13.4
vlc       5781   mem    REG    8,1   408016 8914235 /usr/lib/i386-linux-gnu/libpulsecommon-1.0.so
vlc       5781   mem    REG    8,1   313604 8914024 /usr/lib/i386-linux-gnu/libpulse.so.0.13.4
vlc       5781   mem    REG    8,1    17936 2884672 /usr/lib/vlc/plugins/audio_output/libpulse_plugin.so
vlc       5781   mem    REG    8,1    26284 2887989 /usr/lib/vlc/plugins/audio_output/libalsa_plugin.so


The error I get in .xsession-errors is slightly different also, and I only see it when playing sound in vlc or spotify then trying to play a video in Chromium. I'll get two of these if I refresh a YouTube page while sound is already playing elsewhere:
ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave
you are correct, i have a locally build vlc version v2.0.3, and i too have libalsa_plugin listed, ... i missed that, my bad

sudo lsof +D /opt/vlc/v2.0.3/ | grep -e pulse -e alsa | grep -i -e vlc -e chrom -e spot
vlc     19699 rhuddusa mem    REG  252,0    89424 1584753 /opt/vlc/v2.0.3/modules/audio_output/.libs/libpulse_plugin.so
vlc     19699 rhuddusa mem    REG  252,0    58982 1584762 /opt/vlc/v2.0.3/modules/audio_output/.libs/libalsa_plugin.so


but those vlc plugins for alsa are different than my chrome / your chromium peeking into /usr/lib/XXX/alsa-lib/
Comment 36 by red...@gmail.com, Aug 10 2012
So I tried going back to Chrome 22 and all this looks the same, but I get glitchy clicking all the time now, sometimes even when there isn't any audio playing from anywhere at all. I still only get two errors in .xsession-errors when I try to open something.

With Chromium it's alright because there's a simple enough (albeit annoying) workaround; I just need to pause other audio before playing something. In Chrome though the clicking is pretty unbearable and there's no way around it. I like having the extra features, but yikes, I'll stick with Chromium 18 for now. *sigh*
Comment 37 by red...@gmail.com, Aug 28 2012
The glitchiness (clicking and fast-playing) seems to have disappeared in Chrome 23 (knock on wood!). I'm thinking the pause-all-other-audio-before-being-able-to-play-sound-in-chrome bug is another issue. Is anybody else experiencing that? 
Project Member Comment 39 by bugdroid1@chromium.org, Nov 16 2012
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=168116

------------------------------------------------------------------------
r168116 | dalecurtis@google.com | 2012-11-16T02:13:06.621825Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/audio/pulse/pulse_output.h?r1=168116&r2=168115&pathrev=168116
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/base/audio_bus_unittest.cc?r1=168116&r2=168115&pathrev=168116
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/base/audio_bus.cc?r1=168116&r2=168115&pathrev=168116
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/base/audio_bus.h?r1=168116&r2=168115&pathrev=168116
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/audio/audio_io.h?r1=168116&r2=168115&pathrev=168116
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/audio/pulse/pulse_output.cc?r1=168116&r2=168115&pathrev=168116

Get PulseAudio implementation working.

- Switches from iterating the PA mainloop to a threaded mainloop
which PulseAudio runs on its own.
- Fixes several bugs and cleans up the code.

Performance is much better than ALSA. I'm able to run audio
output at 440 frames smoothly with Pulse whereas ALSA I
couldn't get it to run below 1k w/o glitching.

Sadly while the jitter is much better too, it's still not
as smooth as the 8k buffer we were using previously:
http://commondatastorage.googleapis.com/dalecurtis-shared/alsa-vs-pulse.png

Which means I still need to look into writing some clock
smoothing in order for us to turn on renderer side mixing.

Unit tests to come later, mostly just getting it working now.

BUG= 32757 
TEST=media_unittests / manual playback tests.

Review URL: https://codereview.chromium.org/11098031
------------------------------------------------------------------------
Comment 40 by tow...@gmail.com, Nov 29 2012
Just tested it, it seems to work quite well.

It would be good to set the appropriate properties on the streams, such that the titles (and perhaps even the icons) are more informative.


Screenshot from 2012-11-29 02:33:27.png
109 KB View Download
 Issue 157876  has been merged into this issue.
 Issue 140188  has been merged into this issue.
Which version of Chrome will r168116 (comment #39) appear in? I am currently using 24.0.1312.27_beta170126 — does that contain this commit?
I am now on Google Chrome 25 / Unstable and still there seems to be no native PulseAudio support (KMix shows a ALSA-plugin stream). Which version of Google Chrome will this appear in?

Google Chrome	25.0.1364.26 (Offizieller Build 175314) dev
Betriebssystem	Linux 
WebKit	537.22 (@138920)
JavaScript	V8 3.15.11.5
Flash	11.5.31.135
Comment 45 by devuran...@gmx.net, Jan 12 2013
It is the same (alsa-plugin is being used) with the official stable build for Ubuntu by Google:
Google Chrome	24.0.1312.52 (Offizieller Build 175374) 
Betriebssystem	Linux 
WebKit	537.17 (@138969)
JavaScript	V8 3.14.5.3
Flash	11.5.31.137
Comment 46 by qme...@gmail.com, Jan 17 2013
Pulse support would be great in Chrome version 26 or greater for users of Open Sound System because Chrome lost OSS support during one of the upgrades of version 24 -

https://code.google.com/p/chromium/issues/detail?id=158478

Chrome version 26 Dev is still silent with OSS whereas pulse gives excellent performance with most other programs in Debian using OSS4 as described in the issue above.
Re: comment #46: Have you tried Chrome 26? Does it support Pulse?

Can someone from Chromium or Google please reply in which version of Chrome this will debut? Or is there an easy way to figure out which branches this revision was merged into?
Comment 48 by qme...@gmail.com, Feb 4 2013
PulseAudio Volume Control with Chrome 26 supports Alsa playback with Alsa plugin. Restored Debian default Alsa after mainline kernel 3.8-rc4 lost Open Sound System support. Chrome had lost OSS support since 2.4. 

Pulse + Alsa + Chrome is fine - even the microphone search on a line-in input. Audio quality is comparable to OSS with default-sample-rate = 96000 in /etc/pulse/daemon.conf
Comment 49 by nya...@gmail.com, Feb 4 2013
Alsa support is a reasonable workaround, but it's not the same as full Pulse integration.  Among other things, Chrome can't have a persistent PA role, which means ducking/corking can't work, and volume settings for Chrome can't be persisted.

"Alsa works" is fine advice, but not a solution to this bug.

I'd also like to know when full integration is landing.
Comment 50 by devuran...@gmx.net, Feb 22 2013
(In reply to comment #47)
> Can someone from Chromium or Google please reply in which version of Chrome this 
> will debut? Or is there an easy way to figure out which branches this revision was 
> merged into?

 issue #116435  comment #129: "We've got a native Pulse Audio driver coming in M27"

Thanks for answering this!
Comment 51 by devuran...@gmx.net, Feb 27 2013
I am at google-chrome-27.0.1423.0_alpha184590 now, and still PulseAudio refers to Chrome as "ALSA plug-in". So apparently the information about "M27" was wrong or means soemthing other than version 27.
Comment 52 by tow...@gmail.com, Feb 27 2013
Is it still off-by-default behind the --use-pulseaudio flag?
Comment 53 by devuran...@gmx.net, Feb 27 2013
 issue #116435  comment #133 dalecur...@chromium.org:
> 27 is still under active development :) I hope to get all the relevant patches
> landed this week.
Project Member Comment 54 by bugdroid1@chromium.org, Mar 1 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=185593

------------------------------------------------------------------------
r185593 | dalecurtis@chromium.org | 2013-03-01T21:06:11.395865Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/audio/pulse/pulse_output.cc?r1=185593&r2=185592&pathrev=185593

Always fully fill PulseAudio's requested buffer. Allow larger initial requests.

Instead of forcing PulseAudio to always call us with a buffer size matching
our requested size, let it automatically choose its initial buffers and only
ask for our requested size in steady state.

Doing this requires using a WaitTillDataReady() for those times when we
need to fill a larger buffer than we expect.

BUG= 32757 
NOTRY=true
TEST=no more PulseAudio glitching when using native sample rate.

Review URL: https://chromiumcodereview.appspot.com/12328097
------------------------------------------------------------------------
Project Member Comment 55 by bugdroid1@chromium.org, Mar 10 2013
Labels: -Feature-Media-Audio -Area-WebKit Cr-Content Cr-Internals-Media-Audio
Comment 56 by devuran...@gmx.net, Mar 21 2013
I am using "27.0.1444.3 (Official Build 188745) dev" now, and it contains PulseAudio support. Thanks!

PepperFlash audio is still choppy when the system gets under load, but that was a problem with ALSA support earlier already.
Cc: xians@chromium.org
Labels: M-27
Owner: dalecur...@chromium.org
Status: Fixed
Big thanks to xians@ for completing the audio input side of this task!
Comment 58 by qme...@gmail.com, Mar 22 2013
An interesting side effect is that certain mp3 playlists do not advance automatically.
For Google Chrome Version 27.0.1448.0 dev Pulse Audio Volume Control shows Chromium: Playback on. For 
http://www.last.fm/listen/artist/Guillaume%2Bde%2BMachaut/similarartists
playback stalls after each song and although the next song is loaded, it remains paused and will only play if the play button is clicked. 
In contrast the older Chromium Version 25.0.1364.160 Debian 7.0 (186726) on the same site shows Alsa Plugin Playback in Pulse Audio Volume Control and opens the sound streams automatically as they should.

Sound quality of the new Pulse Chrome is excellent though.
@qmewlo, that shouldn't be happening, can you file a new bug for that problem? Given our architecture it seems unlikely to be directly related to Pulse, but it may be getting tickled differently under the various output drivers.
Comment 60 by qme...@gmail.com, Mar 22 2013
Filed as  Issue 223236 
Comment 61 by mlo...@gmail.com, Mar 22 2013
Anyone else experiencing odd audio now that there's PulseAudio support?  Watching videos on Youtube and Twitch.tv, people talking sound like they've inhaled a bit of helium.   Ubuntu 13.04 with HDMI audio.
@mloebl: Is playback at normal speed or sped up?
Comment 63 by mlo...@gmail.com, Mar 22 2013
@dalecurtis:  It's possible now that you mention it, however if it's sped up it's barely noticeable.  Just noticed it recently on either 27.0.1448.0 or the build just before it.  Prior to this, it's been fine.  
@mleobl: That's weird. It's possible we're misdetecting the output sample rate and since we tell Pulse not to resample it's playing 48kHz content at 44kHz.

Can you try some HTML5 media at different sample rates? Do you know what sample rate your have your hardware set to? I.e. What does pactl info say for "Default Sample Specification" ?
Comment 65 by mlo...@gmail.com, Mar 23 2013
@dalecurtis: 

You were right on the money...  pactl reported 44.1k, but audio was off until I manually set sample rate in daemon.conf and restarted PulseAudio.  Odd as I've never had to do that before.  User error on my part?

I was seeing this both on Twitch (via Flash) and on Youtube (part of HTML5 trial.)  
I'm not sure; I've seen PulseAudio get in weird states. I wonder if it will report an inconsistent sample rate if it's not set in the config. Chrome is assuming it's always going to report a single sample rate and we resample to match it.
Comment 67 by mlo...@gmail.com, Mar 23 2013
Thanks for the help, 48k works fine as well.  I'll leave things alone and see how things go.
As for me, changing from 44.1k to 48k doesen't solves a problem. The music is playing better than at 44.1k, but still with "helium-effect" a bit. (27.0.1450.0)

The last normal version which is works for me is 27.0.1425.0.
@EGuemon4155: Are you restarting PulseAudio in between sample rate changes? What does your "pactl info" report?
Yes, I always do restart by 'killall pulseaudio' command. Also, I use PulseAudio 3.0. Strange, but at ALSA, PepperFlash dosen't works correctly too -- the sound is crackling a little bit.

pactl info http://pastebin.com/htgHdSNJ
All of this video works fine and time-synchronized. So, the problem suppose to be is in Pepper Flash 
dalecur:
So, NOW, all are working fine, thanks in advance! The trick was in daemon.conf, I forgot to uncomment  string "default-sample-rate" and change it to 48000
Project Member Comment 74 by bugdroid1@chromium.org, Apr 6 2013
Labels: -Cr-Content Cr-Blink
Labels: Restrict-AddIssueComment-EditIssue
See  issue 229918  for more on the "default-sample-rate" issue.  A PulseAudio maintainer has told us that Pulse won't always obey the sample rate, so we may need to tweak our options to let Pulse handle those cases at the risk of glitching.

This bug is old enough now that I'm closing it for comments too.  Please file new bugs for PulseAudio issues, or if they are "faster than normal" playback problems, see  issue 229918  for workarounds. 
Sign in to add a comment