| Summary: | Resampling non-8-bit audio may result in garbage | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Dávid Nagy <nagydavid91> |
| Component: | audio | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P1 | ||
| Version: | 2.0.1 | ||
| Hardware: | x86 | ||
| OS: | Windows (XP) | ||
| Attachments: |
Testcase demonstrating the bug and a possible fix
My proposed fix. |
||
Ryan, can you look at this for the 2.0.2 release? Thanks! Created attachment 1669 [details]
My proposed fix.
Apply to SDL2-2.0.1/src/audio/sdlgenaudiocvt.pl
(In reply to nagydavid91+sdl-bugzilla from comment #2) > Created attachment 1669 [details] > My proposed fix. This patch is now https://hg.libsdl.org/SDL/rev/5da12bedaace ...thanks! --ryan. |
Created attachment 1554 [details] Testcase demonstrating the bug and a possible fix When resampling, the calculation of the new size ignores the size of the samples (and the number of channels). const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); This might result in a size that is not a multiple of the sample size. And since upsampling is done from the end to the beginning, the new samples will start at the wrong place.