Allow a stream to get its trigger_done() callback called on the realtime thread
I’m working on adding interrupt-driven scheduling to the custom audio source and sink used by Qubes OS. The sink works fine, but the source doesn’t. Logs indicate that the source xruns because it triggers the graph before it has completed.
This can be fixed by not driving the graph again until the trigger_done()
callback has fired. Unfortunately, the trigger_done()
callback is called on the main thread, not the realtime thread. Therefore, this would cause the graph to be blocked until something happens on a non-realtime thread, which isn’t allowed.
SPA plugins can work around this by using the process()
method instead. However, this would require my module to be rewritten as a SPA plugin, which is highly undesirable as SPA plugins require significantly more boilerplate.
A good solution to this problem would be a flag that causes trigger_done()
to be called on the realtime thread.