Fixed bus error when converting 16-bit to float for non-integral-multiple sample rates

This commit is contained in:
Sam Lantinga 2016-12-19 11:15:53 -08:00
parent 366c77a9f0
commit b2f6c4c1bd
1 changed files with 3 additions and 1 deletions

View File

@ -1191,8 +1191,10 @@ open_audio_device(const char *devname, int iscapture,
return 0; return 0;
} }
if (device->convert.needed) { if (device->convert.needed) {
device->convert.len = (int) (((double) device->spec.size) / device->convert.len = (int) (((double) device->spec.samples) /
device->convert.len_ratio); device->convert.len_ratio);
device->convert.len *= SDL_AUDIO_BITSIZE(device->spec.format) / 8;
device->convert.len *= device->spec.channels;
device->convert.buf = device->convert.buf =
(Uint8 *) SDL_malloc(device->convert.len * (Uint8 *) SDL_malloc(device->convert.len *