gst-av
gst-av copied to clipboard
Fix uint32_t overflow that was causing glitched audio
The following patch fixes a uint32_t overflow which happens with small sample rates.
Given the default buffer size (192000 bytes), and 8000Hz 1 channels s16 spec, the buffer duration is 12 seconds which is larger than UINT32_MAX. Because of an implicit cast in calculate_duration, it would return garbage values, which in turn means gst-av would push broken timestamps. This would confuse the audio sink, causing rather large skips.
This problem can be easily reproduced with some highly-compressed audio podcasts. See https://together.jolla.com/question/23341/garbled-playback-of-some-mp3s-with-builtin-player/
Thanks to @keithzg for documenting the problem and collecting testcases.
LGTM. +1
The SFOS-specific repo is now available at https://github.com/sailfishos/gst-av and this patch has been merged there.