Commit 9c3cf39f authored by Max Kellermann's avatar Max Kellermann

output/PipeWire: catch exceptions in ParamChanged()

Fixes a potential crash bug.
parent d2fb2296
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "../Error.hxx" #include "../Error.hxx"
#include "mixer/plugins/PipeWireMixerPlugin.hxx" #include "mixer/plugins/PipeWireMixerPlugin.hxx"
#include "pcm/Silence.hxx" #include "pcm/Silence.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "system/Error.hxx" #include "system/Error.hxx"
#include "util/BitReverse.hxx" #include "util/BitReverse.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
...@@ -656,7 +657,14 @@ PipeWireOutput::ParamChanged([[maybe_unused]] uint32_t id, ...@@ -656,7 +657,14 @@ PipeWireOutput::ParamChanged([[maybe_unused]] uint32_t id,
{ {
if (restore_volume) { if (restore_volume) {
restore_volume = false; restore_volume = false;
try {
::SetVolume(*stream, channels, volume); ::SetVolume(*stream, channels, volume);
} catch (...) {
FmtError(pipewire_output_domain,
FMT_STRING("Failed to restore volume: {}"),
std::current_exception());
}
} }
#if defined(ENABLE_DSD) && defined(SPA_AUDIO_DSD_FLAG_NONE) #if defined(ENABLE_DSD) && defined(SPA_AUDIO_DSD_FLAG_NONE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment