summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-02 23:58:27 +0100
committerwm4 <wm4@nowhere>2015-11-03 00:23:28 +0100
commit609de236a9e2bf64407fa447c32d2cc1262d1727 (patch)
tree847dcce669f6ddfc037c1d566f9db190e5f2f6b7 /audio
parent3f0d831af0a7247075e1be7a253b4cfca7c2d9ba (diff)
downloadmpv-609de236a9e2bf64407fa447c32d2cc1262d1727.tar.bz2
mpv-609de236a9e2bf64407fa447c32d2cc1262d1727.tar.xz
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.
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao_alsa.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c
index bae7def017..9f297bbade 100644
--- a/audio/out/ao_alsa.c
+++ b/audio/out/ao_alsa.c
@@ -479,6 +479,13 @@ static int init_device(struct ao *ao, bool second_try)
err = snd_pcm_hw_params_any(p->alsa, alsa_hwparams);
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_RW_NONINTERLEAVED
: SND_PCM_ACCESS_RW_INTERLEAVED;
@@ -537,13 +544,6 @@ static int init_device(struct ao *ao, bool second_try)
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
(p->alsa, alsa_hwparams, &ao->samplerate, NULL);
CHECK_ALSA_ERROR("Unable to set samplerate-2");