Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Ported ALSA minimum-sample-count fix from 1.2 branch to 1.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Aug 21, 2011
1 parent b48b60e commit cb5df71
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/audio/alsa/SDL_alsa_audio.c
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit cb5df71

Please sign in to comment.