diff --git a/src/audio/dsp/SDL_dspaudio.c b/src/audio/dsp/SDL_dspaudio.c index 80641b150..fa6a9105a 100644 --- a/src/audio/dsp/SDL_dspaudio.c +++ b/src/audio/dsp/SDL_dspaudio.c @@ -166,6 +166,15 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture) devname = ((iscapture) ? inputDevices[0] : outputDevices[0]); } + /* Make sure fragment size stays a power of 2, or OSS fails. */ + /* I don't know which of these are actually legal values, though... */ + if (this->spec.channels > 8) + this->spec.channels = 8; + else if (this->spec.channels > 4) + this->spec.channels = 4; + else if (this->spec.channels > 2) + this->spec.channels = 2; + /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden));