[pulseaudio-discuss] pulseaudio cannot recognise ALSA plughw

Lennart Poettering lennart at poettering.net
Thu Jan 22 13:25:36 PST 2009


On Tue, 20.01.09 02:21, Aleksander Kamenik (aleksander at krediidiinfo.ee) wrote:

> 
> Lennart Poettering wrote:
> > On Tue, 20.01.09 00:45, Aleksander Kamenik (aleksander at krediidiinfo.ee) wrote:
> > 
> >>> One thing you might try before you file that bug is commenting the
> >>> invocation of snd_pcm_hw_params_set_periods_integer() in that
> >>> function, recompiling and testing whether that changes the behaviour.
> >> I guess your idea was to include a goto finish; right before the 
> >> problematic code with snd_pcm_hw_params_set_periods_near() by commenting 
> >> the 'if ((ret = snd_pcm_hw_params_set_periods_integer(pcm_handle, 
> >> hwparams)) < 0)' line?
> > 
> > No, my idea was to comment the two lines that deal with
> > snd_pcm_hw_params_set_periods_integer(), as I said.
> > 
> > i.e., comment these two lines:
> > 
> > <snip>
> > if ((ret = snd_pcm_hw_params_set_periods_integer(pcm_handle, hwparams)) < 0)
> >     goto finish;
> > </snip>
> 
> Oh, that's how I understood it at the beginning and tried it. This 
> didn't do anything at all, cause the comparison fails and goto finish; 
> is not executed. I got exactly the same errors at the same place when 
> running gdb. And the same behaviour. Of course I might have missed 
> something, but it looked exactly like my previous run with the original 
> code. That's why I thought you meant something else.

OK, if that minimal change doesn't really change anything, then please
file a bug against ALSA as mentioned.

> 
> > 
> >> However I also tried commenting out the 
> >> snd_pcm_hw_params_set_periods_near() function calls. Thanks to this my 
> >> USB sound card popped up in the pulse audio volume control. My 
> >> integrated nvidia chip worked.
> > 
> > Ah, that's interesting. Apparently your sound card does not support
> > integral number of periods. Weird thing. Could you please paste the
> > output of "pulseaudio -vvvv" with that minimal commenting change made?
> 
> Right. Starting up pulseaudio with this patch:
> 
> diff -Naur pulseaudio-0.9.14/src/modules/alsa-util.c 
> pulseaudio-0.9.14.changed/src/modules/alsa-util.c
> --- pulseaudio-0.9.14/src/modules/alsa-util.c   2009-01-13 
> 01:11:38.000000000 +0200
> +++ pulseaudio-0.9.14.changed/src/modules/alsa-util.c   2009-01-20 
> 00:25:46.000000000 +0200
> @@ -369,11 +369,11 @@
> 
>       if ((ret = snd_pcm_hw_params_set_periods_integer(pcm_handle, 
> hwparams)) < 0)
>           goto finish;
> -
> +/*
>       if (_periods > 0) {
> 
> -        /* First we pass 0 as direction to get exactly what we asked
> -         * for. That this is necessary is presumably a bug in ALSA */
> +        * First we pass 0 as direction to get exactly what we asked
> +         * for. That this is necessary is presumably a bug in ALSA *
> 
>           dir = 0;
>           if ((ret = snd_pcm_hw_params_set_periods_near(pcm_handle, 
> hwparams, &_periods, &dir)) < 0) {
> @@ -385,7 +385,7 @@
>               }
>           }
>       }
> -
> +*/
>       if (_period_size > 0)
>           if ((ret = snd_pcm_hw_params_set_buffer_size_near(pcm_handle, 
> hwparams, &buffer_size)) < 0)
>               goto finish;
> 
> Result:
> 
> http://pastebin.com/m5eb3e962

No, this patch is a bit too intrusive. We need to set the
buffer/period settings. On your setup ALSA refuses that in every way
so we this should be considered a bug in ALSA.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4



More information about the pulseaudio-discuss mailing list