Commit 4f6c54ec authored by Max Kellermann's avatar Max Kellermann

output/osx: catch kAudioDevicePropertyHogMode errors

Our AudioObjectGetPropertyDataT() wrapper throws exception on error, and calling it from OSXOutput::Disable() can cause MPD crash due to std::terminate(). Closes https://github.com/MusicPlayerDaemon/MPD/issues/932
parent 2bdf1b22
ver 0.21.26 (not yet released)
* output
- osx: fix crash bug
- sles: support floating point samples
ver 0.21.25 (2020/07/06)
......
......@@ -477,7 +477,7 @@ osx_output_set_buffer_size(AudioUnit au, AudioStreamBasicDescription desc)
}
static void
osx_output_hog_device(AudioDeviceID dev_id, bool hog)
osx_output_hog_device(AudioDeviceID dev_id, bool hog) noexcept
{
static constexpr AudioObjectPropertyAddress aopa = {
kAudioDevicePropertyHogMode,
......@@ -485,8 +485,16 @@ osx_output_hog_device(AudioDeviceID dev_id, bool hog)
kAudioObjectPropertyElementMaster
};
pid_t hog_pid = AudioObjectGetPropertyDataT<pid_t>(dev_id,
aopa);
pid_t hog_pid;
try {
hog_pid = AudioObjectGetPropertyDataT<pid_t>(dev_id, aopa);
} catch (...) {
Log(LogLevel::DEBUG, std::current_exception(),
"Failed to query HogMode");
return;
}
if (hog) {
if (hog_pid != -1) {
FormatDebug(osx_output_domain,
......
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