Commit a1993661 authored by Max Kellermann's avatar Max Kellermann

output/alsa: remove period_time adjust loop

This loop was introduced in commit 24c1f463, 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!
parent 2a6d5583
...@@ -56,8 +56,6 @@ static const char default_device[] = "default"; ...@@ -56,8 +56,6 @@ static const char default_device[] = "default";
static constexpr unsigned MPD_ALSA_BUFFER_TIME_US = 500000; static constexpr unsigned MPD_ALSA_BUFFER_TIME_US = 500000;
static constexpr unsigned MPD_ALSA_RETRY_NR = 5;
class AlsaOutput final class AlsaOutput final
: AudioOutput, MultiSocketMonitor, DeferredMonitor { : AudioOutput, MultiSocketMonitor, DeferredMonitor {
...@@ -730,10 +728,8 @@ AlsaSetupHw(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, ...@@ -730,10 +728,8 @@ AlsaSetupHw(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams,
AudioFormat &audio_format, PcmExport::Params &params) AudioFormat &audio_format, PcmExport::Params &params)
{ {
int err; int err;
unsigned retry = MPD_ALSA_RETRY_NR;
unsigned int period_time_ro = period_time; unsigned int period_time_ro = period_time;
configure_hw:
/* configure HW params */ /* configure HW params */
err = snd_pcm_hw_params_any(pcm, hwparams); err = snd_pcm_hw_params_any(pcm, hwparams);
if (err < 0) if (err < 0)
...@@ -831,15 +827,9 @@ configure_hw: ...@@ -831,15 +827,9 @@ configure_hw:
} }
err = snd_pcm_hw_params(pcm, hwparams); err = snd_pcm_hw_params(pcm, hwparams);
if (err == -EPIPE && --retry > 0 && period_time_ro > 0) { if (err < 0)
period_time_ro = period_time_ro >> 1;
goto configure_hw;
} else if (err < 0)
throw FormatRuntimeError("snd_pcm_hw_params() failed: %s", throw FormatRuntimeError("snd_pcm_hw_params() failed: %s",
snd_strerror(-err)); snd_strerror(-err));
if (retry != MPD_ALSA_RETRY_NR)
FormatDebug(alsa_output_domain,
"ALSA period_time set to %d", period_time);
} }
/** /**
......
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