Issue metadata
Sign in to add a comment
|
Research/Replace audio sync readers/writers with a lockless FIFO |
||||||||||||||||||||
Issue descriptionCurrently, in order to deliver audio between processes, either for output or input, we employ a rather complex shared memory + "sync socket" mechanism. Tracing the time taken for this, at runtime, shows rather significant overhead for using this mechanism. A lockless FIFO in shared memory can be a much simpler/cleaner design: 1. It's super easy to deal with start-up/shutdown sequences around this because either process can just drop its shared memory mapping whenever it wants to quit. Control messages can then propagate in their own due course to engage asynchronous shutdown. 2. There is no need for strict synchronization around every AudioBus being sent between the processes. Since the rate at which audio is produced is known ahead of time, and is constant (sans clock drift), a consumer can just poll the queue when the next buffer should be there and will get a hit near 100% of the time. 3. A lockless FIFO can serve as either a low-latency buffer, or a large buffer, or anything in-between, as each use case demands. For example, audio output usually requires a low-latency buffer, while the transport of audio input (e.g., from microphones or loopback) can be queued until a thread in the render process is unblocked and able to consume the audio. 4. The infrastructure behind the lockless FIFO can become a re-usable mojo library component. There are many cases in Chromium where data needs to be streamed between processes. Some of these use their own mechanism, while others use mojo data pipes (which often requires extra "chunking" and "order-of-operations" logic). Most of these use cases would also be better satisfied by using the lockless FIFO.
,
May 22 2018
Interesting idea. Agree with Dale that buffering is still needed and I wouldn't take for granted that spinning+polling the queue position will yield lower latency than waking the thread via the socket. The logic would be simpler though.
,
Jul 30
The NextAction date has arrived: 2018-07-30
,
Dec 17
Current status: This is still open for TODO, but blocked until Audio Service launchies 100% (and after dead code paths are removed).
,
Dec 17
|
|||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||
Comment 1 by dalecur...@chromium.org
, May 21 2018