[pulseaudio-discuss] Does pulseaudio resample when source and sink sample rate / bits are identical?

Joshua Redstone redstone at gmail.com
Sat Jul 16 13:35:11 PDT 2011


Hi Colin,
Yeah, I'm using TCP because the source audio is generated on a different
machine from the one that has the USB sound card.
I have a laptop with an internet music player on it, and I have a settop PC
(pretty wimpy)  that has a USB audio card connected to my stereo.
I run the music player on my laptop because I want to control the audio from
my laptop, and running the player on the settop and using vnc/nx is way to
slow.

So maybe the pulseaudio isn't doing any resampling work and is just churning
to copy bytes around.  Is there any optimizations I should have set up?  In
my /etc/pulse/default.pa I have:
   load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;
192.168.0.0/16 port=8675

On the whole, I'm pretty happy with the setup.  I'm trying to become an
audio-snob :) and so wanted to make sure all my audio bits from the music
player were getting to the sound card without unnecessary transformations.

Josh

On Sat, Jul 16, 2011 at 1:23 PM, Colin Guthrie <gmane at colin.guthr.ie> wrote:

> Hi Josh,
>
> 'Twas brillig, and Joshua Redstone at 16/07/11 18:50 did gyre and gimble:
> > I'm running pulseaudio 0.9.22-24-g67d18 on Ubuntu 11.04, with a source
> > at  "s16le 2ch 44100Hz" and a USB card that is configured the same way.
> >  I see CPU usage at 25% - I would have thought that if the source/sink
> > sample rates are identical and there is nothing else going on in the
> > system, that pulseaudio would have no sample conversion work to do.
> >  Is there a setting to get more info on what it's doing?  I've tried
> > 'pulseaudio -vv' and I see:
>
> ...sniped...
>
> >     D: alsa-util.c:   rate         : 44100
> >     D: alsa-util.c:   exact rate   : 44100 (44100/1)
> >
> >     and later on, when I play a stream:
> >
> >     I: sink-input.c: Created input 0 "ALSA Playback" on
> >
> alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00-default.analog-stereo
> >     with sample spec s16le 2ch 44100Hz and channel map
> >     front-left,front-right
> >     I: sink-input.c:     media.name <http://media.name> = "ALSA
> Playback"
> >     I: sink-input.c:     application.name <http://application.name> =
> >     "ALSA plug-in [chrome]"
> >     I: sink-input.c:     native-protocol.peer = "TCP/IP client from
> >     192.168.0.200:46969 <http://192.168.0.200:46969>"
> >
> > It seems like they match up exactly, or am I missing something?
>
> This is interesting.....
>
> The rates match up directly but it seems you are using TCP for
> communications. This means that the client application (Chrome in this
> case) is talking over a network socket to the daemon.
>
> This method is inefficient if you don't *have* to use it like this.
>
> In a typical setup PA client and server will both be run by the same
> user. When this happens, the client can talk to the server via a local
> domain socket which is more efficient. But more importantly than TCP vs.
> local domain, one of the key things the latter enables is SHM data
> transfer. Rather than copying audio data over the "wire" to the server,
> SHM, allows the client to just share it's memory space with the server
> allowing for lower overhead.
>
> I suspect you are using padevchooser which is basically cocking this all
> up. This is one of the many reasons we deprecated padevchooser many
> years ago and do not recommend it's usage.
>
> I still wouldn't expect such high CPU usage rates, so perhaps PA is
> waking up more than it needs to to service your USB speakers still, but
> getting a proper connection working is a good first step all the same.
>
> Col
>
> --
>
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
>
> Day Job:
>  Tribalogic Limited [http://www.tribalogic.net/]
> Open Source:
>  Mageia Contributor [http://www.mageia.org/]
>  PulseAudio Hacker [http://www.pulseaudio.org/]
>  Trac Hacker [http://trac.edgewall.org/]
>
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>



-- 
Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20110716/e2166be4/attachment.html>


More information about the pulseaudio-discuss mailing list