Skip to content

Commit

Permalink
alsa: capture devices don't need a mixbuf allocated.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Aug 3, 2016
1 parent 3ed9b0f commit 38f4b68
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/audio/alsa/SDL_alsa_audio.c
Expand Up @@ -700,13 +700,15 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
SDL_CalculateAudioSpec(&this->spec);

/* Allocate mixing buffer */
this->hidden->mixlen = this->spec.size;
this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
if (this->hidden->mixbuf == NULL) {
ALSA_CloseDevice(this);
return SDL_OutOfMemory();
if (!iscapture) {
this->hidden->mixlen = this->spec.size;
this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
if (this->hidden->mixbuf == NULL) {
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 */
ALSA_snd_pcm_nonblock(pcm_handle, 0);
Expand Down

0 comments on commit 38f4b68

Please sign in to comment.