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!
This commit is contained in:
parent
2a6d5583d1
commit
a199366157
@ -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,
|
|||||||
AudioFormat &audio_format, PcmExport::Params ¶ms)
|
AudioFormat &audio_format, PcmExport::Params ¶ms)
|
||||||
{
|
{
|
||||||
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:
|
|||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user