Commit 78f97108f9dad22db6708f28322561eb9828fc36

Ryan C. Gordon 2022-11-05T10:38:33

audio: Avoid accumulation errors in resampler. Fixes #6391.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c
index e79437e..0884fa3 100644
--- a/src/audio/SDL_audiocvt.c
+++ b/src/audio/SDL_audiocvt.c
@@ -247,7 +247,7 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate,
             *(dst++) = outsample;
         }
 
-        outtime += outtimeincr;
+        outtime = outtimeincr * i;
     }
 
     return outframes * chans * sizeof (float);