mirror of
https://github.com/mpv-player/mpv
synced 2024-12-17 20:34:58 +00:00
ao_alsa: disable resampling first thing
Again, this could have bad access, is unlikely, and has no bad consequences. It's noteworthy that vlc and the ALSA PCM example both do this first, even if they set the sample rate later.
This commit is contained in:
parent
3f0d831af0
commit
609de236a9
@ -479,6 +479,13 @@ static int init_device(struct ao *ao, bool second_try)
|
|||||||
err = snd_pcm_hw_params_any(p->alsa, alsa_hwparams);
|
err = snd_pcm_hw_params_any(p->alsa, alsa_hwparams);
|
||||||
CHECK_ALSA_ERROR("Unable to get initial parameters");
|
CHECK_ALSA_ERROR("Unable to get initial parameters");
|
||||||
|
|
||||||
|
// Some ALSA drivers have broken delay reporting, so disable the ALSA
|
||||||
|
// resampling plugin by default.
|
||||||
|
if (!p->cfg_resample) {
|
||||||
|
err = snd_pcm_hw_params_set_rate_resample(p->alsa, alsa_hwparams, 0);
|
||||||
|
CHECK_ALSA_ERROR("Unable to disable resampling");
|
||||||
|
}
|
||||||
|
|
||||||
snd_pcm_access_t access = af_fmt_is_planar(ao->format)
|
snd_pcm_access_t access = af_fmt_is_planar(ao->format)
|
||||||
? SND_PCM_ACCESS_RW_NONINTERLEAVED
|
? SND_PCM_ACCESS_RW_NONINTERLEAVED
|
||||||
: SND_PCM_ACCESS_RW_INTERLEAVED;
|
: SND_PCM_ACCESS_RW_INTERLEAVED;
|
||||||
@ -537,13 +544,6 @@ static int init_device(struct ao *ao, bool second_try)
|
|||||||
goto alsa_error;
|
goto alsa_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some ALSA drivers have broken delay reporting, so disable the ALSA
|
|
||||||
// resampling plugin by default.
|
|
||||||
if (!p->cfg_resample) {
|
|
||||||
err = snd_pcm_hw_params_set_rate_resample(p->alsa, alsa_hwparams, 0);
|
|
||||||
CHECK_ALSA_ERROR("Unable to disable resampling");
|
|
||||||
}
|
|
||||||
|
|
||||||
err = snd_pcm_hw_params_set_rate_near
|
err = snd_pcm_hw_params_set_rate_near
|
||||||
(p->alsa, alsa_hwparams, &ao->samplerate, NULL);
|
(p->alsa, alsa_hwparams, &ao->samplerate, NULL);
|
||||||
CHECK_ALSA_ERROR("Unable to set samplerate-2");
|
CHECK_ALSA_ERROR("Unable to set samplerate-2");
|
||||||
|
Loading…
Reference in New Issue
Block a user