[alsa-devel] On non-rewindability of resamplers

Raymond Yau superquad.vortex2 at gmail.com
Wed May 28 09:58:13 CEST 2014


> Yes. The test program is attached. For stereo S16_LE output, it reports
32 samples (i.e. 128 bytes) as the minimum period size.

your program segfault when using NULL plugin


>> what other events pulseaudio need to rewind beside
>> 1) change in volume of sink/source

Volume change of the sink is supposed to be real time event

User are allowed to change the volume slider even when the sink is not
playing or source is not capturing

If the requested volume cannot be satisfied by changing hardware volume
controls , does pulseaudio keep the calculated software volume adjustment
when the sink start playing while the hardware volume is supposed to be
updated immediately ?

when user specify ignore_DB=1 or codec does not have any volume control
(e.g. SPDIF stereo playback) which force pulseaudio to use software volume.
The software volume will be same as the requested volume(volume slider in
sound preference) even when there is no playing stream.

Do this software volume setting  saved in pulseaudio database when shutdown
and  restore on pulseaudio next startup by module-device-restore for the
SPDIF stereo profile ?

>> 2) change in volume of streams

since there may be multiple streams (clients)  playing at the same time, Do
pulseaudio still keep copies of unmixed audio of all connected clients ?

>> 3) change in latency
>> 4) sync slaves of combined sinks
> I don't think that (4) is valid. It is handled by resampling, not
> 5) explicit rewrite request from the client (if the sink has already
rendered the rewritten data into its buffer)

> 6) state change ("If we are added for the first time...") of the sink

If the stream is the first client ,

How about a low latency client connect to server when a high latency client
is already playing ?

Do pulseaudio still rewind the sink when low latency client is playing and
a  high latency client connect to server ?

> 7) corking/uncorking

Do you mean pause of the playing stream while other stream is still playing

> 8) end of underrun (for specific sink inputs)

if appl_ptr is behind hw_ptr , you need to use snd_pcm_forward to advance
the appl_ptr to a suitable position which you write enough data so that
final appl_ptr is at least one period ahead of hwptr

Why do end of underrun need rewind ?

> 9) moving streams between sinks

What happen when the sinks have different buffer size ?

Do all playing streams need to re-adjust latency ?

More information about the Alsa-devel mailing list