audio: SDL_AudioStream's *_sample_frame_size should be in bytes, not bits.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 13 Feb 2017 16:56:41 -0500
changeset 10883c6b2a9e91f91
parent 10882 3f210b3522a3
child 10884 ef3983cd6645
audio: SDL_AudioStream's *_sample_frame_size should be in bytes, not bits.

Fixes failures where SDL_AudioStreamGet() incorrectly thinks it got a partial
sample frame request.
src/audio/SDL_audiocvt.c
     1.1 --- a/src/audio/SDL_audiocvt.c	Mon Feb 13 16:55:00 2017 -0500
     1.2 +++ b/src/audio/SDL_audiocvt.c	Mon Feb 13 16:56:41 2017 -0500
     1.3 @@ -1087,11 +1087,11 @@
     1.4         the resampled data (!!! FIXME: decide if that works in practice, though!). */
     1.5      pre_resample_channels = SDL_min(src_channels, dst_channels);
     1.6  
     1.7 -    retval->src_sample_frame_size = SDL_AUDIO_BITSIZE(src_format) * src_channels;
     1.8 +    retval->src_sample_frame_size = (SDL_AUDIO_BITSIZE(src_format) / 8) * src_channels;
     1.9      retval->src_format = src_format;
    1.10      retval->src_channels = src_channels;
    1.11      retval->src_rate = src_rate;
    1.12 -    retval->dst_sample_frame_size = SDL_AUDIO_BITSIZE(dst_format) * dst_channels;
    1.13 +    retval->dst_sample_frame_size = (SDL_AUDIO_BITSIZE(dst_format) / 8) * dst_channels;
    1.14      retval->dst_format = dst_format;
    1.15      retval->dst_channels = dst_channels;
    1.16      retval->dst_rate = dst_rate;