Commit 98babc20 authored by Ryan C. Gordon's avatar Ryan C. Gordon

Ported ALSA minimum-sample-count fix from 1.2 branch to 1.3.

parent 40480fb3
......@@ -81,7 +81,8 @@ static int (*ALSA_snd_pcm_sw_params_set_start_threshold)
static int (*ALSA_snd_pcm_sw_params) (snd_pcm_t *, snd_pcm_sw_params_t *);
static int (*ALSA_snd_pcm_nonblock) (snd_pcm_t *, int);
static int (*ALSA_snd_pcm_wait)(snd_pcm_t *, int);
static int (*ALSA_snd_pcm_sw_params_set_avail_min)
(snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t);
#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
#define snd_pcm_hw_params_sizeof ALSA_snd_pcm_hw_params_sizeof
......@@ -140,6 +141,7 @@ load_alsa_syms(void)
SDL_ALSA_SYM(snd_pcm_sw_params);
SDL_ALSA_SYM(snd_pcm_nonblock);
SDL_ALSA_SYM(snd_pcm_wait);
SDL_ALSA_SYM(snd_pcm_sw_params_set_avail_min);
return 0;
}
......@@ -618,6 +620,13 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture)
ALSA_snd_strerror(status));
return 0;
}
status = ALSA_snd_pcm_sw_params_set_avail_min(pcm_handle, swparams, this->spec.samples);
if (status < 0) {
ALSA_CloseDevice(this);
SDL_SetError("Couldn't set minimum available samples: %s",
ALSA_snd_strerror(status));
return 0;
}
status =
ALSA_snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, 1);
if (status < 0) {
......
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