Is function delay of the pulse plugin correct?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Please correct me if I am wrong: "avail" means (buffer - buffer_fill),
while "delay" means (buffer_fill + device/downstream delay/latency).
Some drivers/devices do not track the device delay, and then delay =
buffer_fill.

While troubleshooting some playback code, I hit that snd_pcm_delay on
the plugin pulse (device pulse) was always returning 0 frames, while
snd_pcm_avail was returning dynamic (correct) values.

IIUC while pulse_pcm.c uses generic code for avail, it overrides the
generic snd_pcm_ioplug_delay
https://github.com/alsa-project/alsa-lib/blob/35d2efefa95d28e0cd963a06e051f8125823f077/src/pcm/pcm_ioplug.c#L110
with specific pulse_delay
https://github.com/alsa-project/alsa-plugins/blob/52574cb5ccbb8b546df2759e4b341a20332269b6/pulse/pcm_pulse.c#L379
. IIUC this method returns only delay obtained from Pulseaudio, i.e. no
fill of the pulse plugin buffer is included. And IIUC in this specific
case pulseaudio keeps returning zero for the pa_stream_get_latency call,
making snd_pcm_delay return zero too. Therefore the equation (buffer
size = avail + delay - driver/device delay) does not seem to hold for
the pulse plugin.

The new pipewire plugin does not seem to override the generic
snd_pcm_ioplug_delay method
https://github.com/PipeWire/pipewire-alsa/blob/master/alsa-plugins/pcm_pipewire.c#L691-L702
.

Please, is that behavior correct?

With regards,

Pavel.



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux