[alsa-devel] [PATCH - IOPLUG DRAIN 0/2]

Wischer, Timo (ADITG/ESB) twischer at de.adit-jv.com
Fri Mar 23 08:23:56 CET 2018


> The application needs to sync manually via poll() instead.

You mean the user application which opens the ALSA virtual device (aka IO plugin), right?


> It's also the behavior of the kernel driver, which ioplug follows.

I know that your suggested solution is the behavior of the kernel.
But in kernel space we have the DMA interrupt which checks the state for draining.

To use the same mechanism in the IO plug each IO plug needs to have its own thread which checks state for draining.
In case of pulse without this additional thread I have no idea how pulseaudio can be informed that draining starts
because in nonblocking mode there is no function in the pulse IO plugin which is called to inform about the state change to draining.

The only solution which I have in my mind is this additional thread
state_check_thread()
{
while (true) {
if (state == DRAINING)
pa_stream_drain()
...
}
}

Therefore with your proposed solution there is additional effort in each new IO plug required to support draining in nonblocking mode. (With my solution exactly the same mechanism (drain callback and poll) is used in blocking and nonblocking mode. Therefore new  IO plugins will support both modes without additional efforts in the IO plugin implementation)

I hope my concern is now more clear.


Best regards

Timo


More information about the Alsa-devel mailing list