audio: calculate resampling time directly, don't increment (thanks, Eric!).
authorRyan C. Gordon <icculus@icculus.org>
Wed, 11 Oct 2017 11:43:35 -0400
changeset 1159461c151bcd76a
parent 11593 b5e404b928ea
child 11595 091789122901
audio: calculate resampling time directly, don't increment (thanks, Eric!).

Fixes buffer overruns as floating point errors accumulate.

Partially fixes Bugzilla #3848.
src/audio/SDL_audiocvt.c
     1.1 --- a/src/audio/SDL_audiocvt.c	Wed Oct 11 02:33:55 2017 -0400
     1.2 +++ b/src/audio/SDL_audiocvt.c	Wed Oct 11 11:43:35 2017 -0400
     1.3 @@ -527,7 +527,7 @@
     1.4              *(dst++) = outsample;
     1.5          }
     1.6  
     1.7 -        outtime += outtimeincr;
     1.8 +        outtime = i * outtimeincr;
     1.9      }
    1.10  
    1.11      return outframes * chans * sizeof (float);