audioloudnorm: Fix limiter buffer index wraparound off-by-one for the last buffer

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1650>
This commit is contained in:
Sebastian Dröge 2024-07-02 19:30:34 +03:00 committed by Backport Bot
parent 1a8a1dcf17
commit 9693aa6cc5

View file

@ -753,7 +753,7 @@ impl State {
// amount of samples the last frame is short to reach the correct read position.
if next_frame_size < FRAME_SIZE {
self.limiter_buf_index += FRAME_SIZE - next_frame_size;
if self.limiter_buf_index > self.limiter_buf.len() {
if self.limiter_buf_index >= self.limiter_buf.len() {
self.limiter_buf_index -= self.limiter_buf.len();
}
}