Hi, On Thu, Mar 24, 2022 at 07:11:42AM +0100, Alexandre Ratchov wrote: > Most audio/video players do a stop/start cycle whenever the play > position is changed, track is changed, etc. Currently, stopping drains > the play buffer, which by default is very large (to workaround very > long kernel non-preemptive code-paths). This makes player controls > sluggish. > > This diff adds a new sio_flush() function to workaround the jumbo > buffer sizes: it stops playback immediately, discarding buffered > data. Basically it's the same as sio_stop() but doesn't wait. The plan > is to make players use it. > > In the network protocol, sio_flush() is implemented by adding a flag > to the message corresponding to sio_stop(). Old sndiod servers ignore > it and just work with new libraries. New sndiod servers see that the > flag is not set by old libraries and properly drain the play buffer. > > Tested with mplayer, mpv and audacious, if we go this way other ports > will follow.
I tested this with Audacious and I like the new behavior a lot! When I change the play position, stop playback or change the track it indeed responds much faster. When pausing playback however, the buffer is still being drained which suprised me a little bit. However, after some printf-debugging I confirmed my suspicion that Audacious does not call SndioPlugin::flush() in that case, so this patch (or sndio in general) doesn't have anything to do with that. I can't really comment on the diff itself, although that makes sense to me. Caspar