From a199366157e513688432e8a70cfb802277e79735 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 26 Oct 2017 08:40:59 +0200 Subject: [PATCH] output/alsa: remove period_time adjust loop This loop was introduced in commit 24c1f46353213e3392b542a6c3655bcd215e7c63, but -EPIPE is not a possible error condition for snd_pcm_hw_params(). This code does not appear to make sense. Problems with a wrong period_time should be caught before that by snd_pcm_hw_params_set_period_time_near(). This commit removes the last "goto" in MPD! Yay! --- src/output/plugins/AlsaOutputPlugin.cxx | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx index cabba781d..545db5347 100644 --- a/src/output/plugins/AlsaOutputPlugin.cxx +++ b/src/output/plugins/AlsaOutputPlugin.cxx @@ -56,8 +56,6 @@ static const char default_device[] = "default"; static constexpr unsigned MPD_ALSA_BUFFER_TIME_US = 500000; -static constexpr unsigned MPD_ALSA_RETRY_NR = 5; - class AlsaOutput final : AudioOutput, MultiSocketMonitor, DeferredMonitor { @@ -730,10 +728,8 @@ AlsaSetupHw(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, AudioFormat &audio_format, PcmExport::Params ¶ms) { int err; - unsigned retry = MPD_ALSA_RETRY_NR; unsigned int period_time_ro = period_time; -configure_hw: /* configure HW params */ err = snd_pcm_hw_params_any(pcm, hwparams); if (err < 0) @@ -831,15 +827,9 @@ configure_hw: } err = snd_pcm_hw_params(pcm, hwparams); - if (err == -EPIPE && --retry > 0 && period_time_ro > 0) { - period_time_ro = period_time_ro >> 1; - goto configure_hw; - } else if (err < 0) + if (err < 0) throw FormatRuntimeError("snd_pcm_hw_params() failed: %s", snd_strerror(-err)); - if (retry != MPD_ALSA_RETRY_NR) - FormatDebug(alsa_output_domain, - "ALSA period_time set to %d", period_time); } /**