From 3f58345cf0eb0882fe32e35801744fb505bd2249 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sun, 18 Jan 2026 15:51:01 +0100 Subject: [PATCH] Catch exceptions when updating mic state --- server/audio/audio_pipewire.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/server/audio/audio_pipewire.cpp b/server/audio/audio_pipewire.cpp index 8f2809cc..b5b9eab0 100644 --- a/server/audio/audio_pipewire.cpp +++ b/server/audio/audio_pipewire.cpp @@ -354,10 +354,24 @@ void pipewire_device::mic_state_changed(void * self_v, pw_stream_state old, pw_s case PW_STREAM_STATE_UNCONNECTED: case PW_STREAM_STATE_CONNECTING: case PW_STREAM_STATE_PAUSED: - self->session.send_control(to_headset::feature_control{to_headset::feature_control::microphone, false}); + try + { + self->session.send_control(to_headset::feature_control{to_headset::feature_control::microphone, false}); + } + catch (std::exception & e) + { + U_LOG_W("failed to update microphone state: %s", e.what()); + } return; case PW_STREAM_STATE_STREAMING: - self->session.send_control(to_headset::feature_control{to_headset::feature_control::microphone, true}); + try + { + self->session.send_control(to_headset::feature_control{to_headset::feature_control::microphone, true}); + } + catch (std::exception & e) + { + U_LOG_W("failed to update microphone state: %s", e.what()); + } return; } }