alsa: capture devices don't need a mixbuf allocated.

This commit is contained in:
Ryan C. Gordon 2016-08-03 01:00:30 -04:00
parent 3ed9b0f567
commit 38f4b68ca7
1 changed files with 8 additions and 6 deletions

View File

@ -700,13 +700,15 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
SDL_CalculateAudioSpec(&this->spec); SDL_CalculateAudioSpec(&this->spec);
/* Allocate mixing buffer */ /* Allocate mixing buffer */
this->hidden->mixlen = this->spec.size; if (!iscapture) {
this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); this->hidden->mixlen = this->spec.size;
if (this->hidden->mixbuf == NULL) { this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
ALSA_CloseDevice(this); if (this->hidden->mixbuf == NULL) {
return SDL_OutOfMemory(); ALSA_CloseDevice(this);
return SDL_OutOfMemory();
}
SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen);
} }
SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen);
/* Switch to blocking mode for playback */ /* Switch to blocking mode for playback */
ALSA_snd_pcm_nonblock(pcm_handle, 0); ALSA_snd_pcm_nonblock(pcm_handle, 0);