[pulseaudio-discuss] [PATCH] Don't use tsched on unsafe ALSA plugins

Alexander E. Patrakov patrakov at gmail.com
Sun Apr 20 22:23:53 PDT 2014


21.04.2014 05:04, Raymond Yau wrote:
>  >
>  > Since the dca ALSA plugin is based on extplug, it has a slave and
> therefore
>  > a card. Thus, PulseAudio thinks that it looks like hardware and attempts
>  > rewinds, which this plugin cannot handle correctly, because ALSA never
>  > notifies extplug plugins about rewinds.
>  >
>  > The same mishandling of rewinds applies to some other plugins.
>  >
>  > Work around this ALSA bug by switching to IRQ-based scheduling on strange
>  > plugin types.
>
> Do you mean pulseaudio won't perform any rewind when switching to
> interrupt driven mode ?

Yes. The same function pa_alsa_pcm_is_hw() is used to decide whether to 
enable tsched mode and whether to enable rewinds.

http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/alsa-sink.c#n1010

http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/alsa-sink.c#n2346

http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/alsa-util.c#n245

I will express my thoughts on this in more detail when replying to 
David's mail.

> What algorithm do pulseaudio use when use interrupt driven  scheduling
> since pulseaudio allow user to specify number of periods ?
>
> http://0pointer.de/blog/projects/pulse-glitch-free.html
>
> e.g. 4 periods per buffer
>
> 1) write data to sound card whenever there is an empty period
> 2) write data to sound card when half of buffer is empty
> 3) write data to sound card when there is only one period left

I don't know for sure. Judging from this paragraph from the blog, it is (1).

"""
PulseAudio <= 0.9.10 uses a fragment size of 25ms by default, with four 
fragments. That means that right now, unless you reconfigure your 
PulseAudio manually clients will not get latencies lower than 100ms 
whatever you try, [...].
"""

>  > +    if (type == SND_PCM_TYPE_MULTI) return true;     /* EMU10K1,
> Audigy2, others */
>
> Seem emu10k1 and audigy2 are not a good example since snd_pcm_start fail
> with EBADFD when using multi plugin (multi channel) with start
> threshold set to boundary
>
> alsa-sink.c: Starting playback.
> I: (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_START failed (-77)
>
> https://bugzilla.redhat.com/show_bug.cgi?id=608936#c19

Point taken. As you seem to suggest that, with start threshold set to 
boundary, the multi plugin fails on all cards, I will no longer 
whitelist it.

-- 
Alexander E. Patrakov


More information about the pulseaudio-discuss mailing list