From 92f54f0b59e7f5c4041193e261b9280251dc67a2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 28 Feb 2016 10:15:02 +0100 Subject: [PATCH] output/alsa: disable DoP if it fails See http://bugs.musicpd.org/view.php?id=4496 --- NEWS | 1 + src/output/plugins/AlsaOutputPlugin.cxx | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 9c761fd6f..0be6fe953 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,7 @@ ver 0.20 (not yet released) - alsa: fix multi-channel order - alsa: remove option "use_mmap" - alsa: support DSD_U32 + - alsa: disable DoP if it fails - jack: reduce CPU usage - pulse: set channel map to WAVE-EX - recorder: record tags diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx index dcc0493fc..743f7f575 100644 --- a/src/output/plugins/AlsaOutputPlugin.cxx +++ b/src/output/plugins/AlsaOutputPlugin.cxx @@ -731,13 +731,25 @@ AlsaOutput::SetupOrDop(AudioFormat &audio_format, PcmExport::Params ¶ms, Error &error) { #ifdef ENABLE_DSD - if (dop && audio_format.format == SampleFormat::DSD) { + Error dop_error; + if (dop && audio_format.format == SampleFormat::DSD && + SetupDop(audio_format, params, dop_error)) { params.dop = true; - return SetupDop(audio_format, params, error); + return true; } #endif - return AlsaSetup(this, audio_format, params, error); + if (AlsaSetup(this, audio_format, params, error)) + return true; + +#ifdef ENABLE_DSD + if (dop_error.IsDefined()) + /* if DoP was attempted, prefer returning the original + DoP error instead of the fallback error */ + error = std::move(dop_error); +#endif + + return false; } inline bool