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/1649>
This commit is contained in:
Sebastian Dröge 2024-07-02 19:30:34 +03:00
parent bd2a039c8d
commit c701aa6f84

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();
}
}