author Sam Lantinga
Sat, 08 Jun 2019 18:22:18 -0700
changeset 12803 70d338e248c8
parent 10952 fabcc99bb455
permissions -rw-r--r--
Fixed bug 4294 - Audio: perform more validation on conversion request


There are many cases which are not able to be handled by SDL's audio conversion routines, including too low (negative) rate, too high rate (impossible to allocate).

This patch aims to report such issues early and handle others in a graceful manner. The "INT32_MAX / RESAMPLER_SAMPLES_PER_ZERO_CROSSING" value is the conservative approach in terms of what can _technically_ be supported, but its value is 4'194'303, or just shy of 4.2MHz. I highly doubt any sane person would use such rates, especially in SDL2, so I would like to drive this limit further down, but would need some assistance to do that, as doing so would have to introduce an arbitrary value. Are you OK with such approach? What would a good value be? Wikipedia (https://en.wikipedia.org/wiki/High-resolution_audio) lists 96kHz as the highest sampling rate in use, even if I quadruple it for a good measure, to 384kHz it's still an order of magnitude lower than 4MHz.
     2 Bugs are now managed in the SDL bug tracker, here:
     4     https://bugzilla.libsdl.org/
     6 You may report bugs there, and search to see if a given issue has already
     7  been reported, discussed, and maybe even fixed.
    10 You may also find help at the SDL forums/mailing list:
    12     https://discourse.libsdl.org/
    14 Bug reports are welcome here, but we really appreciate if you use Bugzilla, as
    15  bugs discussed on the mailing list may be forgotten or missed.