Wednesday 16 January 2013

Chrome sound and pulse audio

A while ago I suddenly stopped having sound in Google Chrome. The symptoms were a hung YouTube and Google Music (the progress bar would be stuck at 0 and not progress). I booted Chrome through the command line, but no helpful messages as to diagnose the absence of sound. The rest of the system was unaffected.

I suspected it was the Flash plugin. But, wait, I am using HTML5 YouTube and Google Music...

I traced back to see what I had changed on my system to cause such problem; it had been a while since I used this sort of web applications, so didn't really know how far back I had to look.

Of the packages I had recently updated, I only found the Kernel to be a reasonable suspect. Alas, my kernel configuration has been the same for quite a while.

After a bit of googling and fiddling with Portage, I realised that Chrome uses PulseAudio whereas the rest of my system uses GStreamer (either directly or through Phonon). Could this be a bad config?
As I delved into /etc/pulse/ I noticed a strange thing... I had not one, but two audio devices; the first being my Intel HD Audio and the second an AMD Radeon audio device. Weird. Could PulseAudio be routing the audio through this card instead?

I searched Portage for pavucontrol (PulseAudio Control) but it would pull in loads of GTK dependencies; surely there must be a command-line solution?
I looked on the config files for PulseAudio, and with the help of Google, I found http://ptspts.blogspot.co.uk/2009/03/how-to-select-alsa-sound-card-and-have.html and after I tried this, the videos on YouTube were suddenly playing about twice as fast as they should. Well, at least they were playing!

What if instead of selecting an audio sink for PulseAudio, I could route it through ALSA? After all, that's what GStreamer is doing, and it's working fine. That solution turned out to be very easy and quick, as described at http://forum.pinguyos.com/Thread-How-to-Pulseaudio-and-Alsa.

On my system, all I had to do was comment out the udev module on /etc/pulse/default.pa

#load-module module-udev-detect
and enable the ALSA module
load-module module-alsa-sink

And sound's back!

No comments:

Post a Comment