Cli audio playback against jittery sinks and flaky streams#85
Conversation
Signed-off-by: LilDojd <yawner@pm.me> Change-Id: I12ccb6472c6f339f647a2cfb88a591f16a6a6964
Signed-off-by: LilDojd <yawner@pm.me> Change-Id: I7d07ef1a96beb0a83680f3cf882562fd6a6a6964
Signed-off-by: LilDojd <yawner@pm.me> Change-Id: I44fe3bc8f324287fb9be1c3e702b3aa56a6a6964
Signed-off-by: LilDojd <yawner@pm.me> Change-Id: I7cf0d2f5d8e4c86d472e37227223a5346a6a6964
Signed-off-by: LilDojd <yawner@pm.me> Change-Id: Iac0a8c00cb8cbf9dddc3588290697a8e6a6a6964
Signed-off-by: LilDojd <yawner@pm.me> Change-Id: I728c87651d23dc46dbfff58dce2509fd6a6a6964
Signed-off-by: LilDojd <yawner@pm.me> Change-Id: I49c115c247f2fcc8f2bd8f52bd4f9f096a6a6964
Signed-off-by: LilDojd <yawner@pm.me> Change-Id: Ic46c756bb5482d968a5ffdfd84cc27e86a6a6964
mpiorowski
left a comment
There was a problem hiding this comment.
I havent dive deep into review, but AI throw me a fast high:
High: late-cli/src/audio/decoder_thread.rs:89 now feeds the ring buffer with push_slice(pending), which can split the interleaved sample stream at any sample boundary. The consumer in late-cli/src/audio/output.rs:173 assumes it can pop a whole source_channels frame; when it gets only part of one, it drops the partial frame and outputs silence. On stereo this can turn L,R,L,R into L dropped, then R treated as the next frame’s left channel, so under pressure you get sample loss and channel skew. The old mutex queue avoided this by enqueuing whole chunks atomically. This needs frame-aligned writes or a consumer-side partial-frame stash.
|
fix on another pr :) |
Addresses #68. Root cause on the reporter's setup is WSLg's PulseAudio-over-RDP bridge (microsoft/wslg#908, #1429) upstream. We can't fix that, but we can stop the CLI from making it worse. The audio pipeline also had a few latent correctness/perf bugs worth clearing out while in here (cross-referenced with pdeljanov/Symphonia#260).
Lock-free SPSC queue. Replaced
Arc<Mutex<VecDeque<f32>>>withringbuf::HeapRb.Reuse
SampleBufferinstead of frequently allocatingFixed cpal output buffer on Linux:
BufferSize::Fixed(2048)Ran make check