fix(natives): buffer forwarded PulseAudio playback
This commit is contained in:
@@ -27,13 +27,18 @@ use parking_lot::Mutex;
|
||||
use tokio::sync::Notify;
|
||||
|
||||
const AUDIO_CHANNELS: u32 = 1;
|
||||
// PulseAudio TCP playback stutters with a 20 ms target buffer; 50 ms absorbs
|
||||
// transport jitter while preserving interactive latency.
|
||||
#[cfg(target_os = "linux")]
|
||||
const PLAYBACK_PERIOD_MS: u32 = 50;
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
const PLAYBACK_PERIOD_MS: u32 = 20;
|
||||
// miniaudio's PulseAudio backend reserves three periods. Android's OpenSL ES
|
||||
// source emits 125 ms fragments, so Linux capture needs at least 150 ms queued.
|
||||
#[cfg(target_os = "linux")]
|
||||
const CAPTURE_PERIOD_MS: u32 = 50;
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
const CAPTURE_PERIOD_MS: u32 = PLAYBACK_PERIOD_MS;
|
||||
const CAPTURE_PERIOD_MS: u32 = 20;
|
||||
const PLAYBACK_DRAIN_CALLBACKS: usize = 2;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed Linux `AudioCapture` stalling on PulseAudio sources that emit fragments larger than miniaudio's previous 60 ms capture buffer, including Android OpenSL ES microphones reached through a forwarded PulseAudio server.
|
||||
- Fixed Linux native audio over forwarded PulseAudio servers: capture now handles 125 ms Android fragments without stalling, and playback buffers enough audio to avoid TCP underruns and stuttering.
|
||||
|
||||
## [17.1.3] - 2026-07-24
|
||||
|
||||
|
||||
Reference in New Issue
Block a user