From 61586de20392f748030c872e33ca399e140597b7 Mon Sep 17 00:00:00 2001 From: David Reid Date: Mon, 5 Aug 2024 10:34:01 +1000 Subject: [PATCH] PulseAudio: Default to a blocking main loop. --- CHANGES.md | 1 - miniaudio.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 7d46b6f7..1b67da17 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,7 +12,6 @@ v0.11.22 - TBD * AAudio: The default minimum SDK version has been increased from 26 to 27 when enabling AAudio. If you need to support version 26, you can use `#define MA_AAUDIO_MIN_ANDROID_SDK_VERSION 26`. * AAudio: Fix ma_device_get_info() implementation * PulseAudio: Allow setting the channel map requested from PulseAudio in device configs -* PulseAudio: Attempt to fix a deadlock. This involves converting the PulseAudio main loop from blocking to non-blocking. To restore the old blocking behaviour, you can do so via the device config: `deviceConfig.pulse.blockingMainLoop = MA_TRUE`. v0.11.21 - 2023-11-15 diff --git a/miniaudio.h b/miniaudio.h index 2600a160..e54da68f 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -41837,10 +41837,14 @@ MA_API ma_bool32 ma_context_is_loopback_supported(ma_context* pContext) MA_API ma_device_config ma_device_config_init(ma_device_type deviceType) { ma_device_config config; + MA_ZERO_OBJECT(&config); config.deviceType = deviceType; config.resampling = ma_resampler_config_init(ma_format_unknown, 0, 0, 0, ma_resample_algorithm_linear); /* Format/channels/rate don't matter here. */ + /* Use a blocking PulseAudio loop by default. Non-blocking currently results in glitches with low period sizes. */ + config.pulse.blockingMainLoop = MA_TRUE; + return config; }