On Tue, Oct 30, 2018 at 04:01:26PM +0200, Jari Vetoniemi wrote: > Correction to my last message. It's in NONBLOCK mode. I didn't check the > sio_open argument. > > >Typically if the server can't accept more data immediately; in this > >case, later, sio_revents() will return POLLOUT to indicate that > >sio_write() can accept data again. > > Does this mean, I have to provide pollfds for sndiod to let it know > when it can accept data? The PCSX2 for example, uses NONBLOCK mode as > well, but it seems to work fine, even without implementing such event > handling. Non-blocking operation requires poll() & friends; no program can work without it; if it does it's probably by accident. First, how would a program know when to call sio_write()? if sio_write() is called too late, playback will underrun. If it's called in a loop, the process will consume 100% CPU; on most systems, the process will have its scheduling priority decreased and audio may start stuttering. Second, and most importantly, libsndio needs to manage its own state; sio_revents() is the place where it receives messages from the server and processes them. For instance, if sio_revents() is not called, the client wouldn't be notified that playback started and won't send data to the server. I bet this is what happens.Received on Tue Oct 30 2018 - 18:31:32 CET
This archive was generated by hypermail 2.3.0 : Tue Aug 09 2022 - 16:23:47 CEST