From 02b3042b7d775f0791303489d3073179eb6e0a9b Mon Sep 17 00:00:00 2001 From: Vitaly Novichkov Date: Sun, 22 Dec 2019 17:20:50 +0300 Subject: [PATCH] music_mad.c (MAD_Seek): Avoid a junk chunk be played after seek. If buffer isn't cleared, the garbage left after previously played frame will be played after seek until playing frame on the target position. --- src/codecs/music_mad.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/codecs/music_mad.c b/src/codecs/music_mad.c index e4340a97..08a1f173 100644 --- a/src/codecs/music_mad.c +++ b/src/codecs/music_mad.c @@ -408,6 +408,8 @@ static int MAD_Seek(void *context, double position) music->status &= ~MS_error_flags; MP3_RWseek(&music->mp3file, 0, RW_SEEK_SET); + /* Avoid junk chunk be played after seek -- Vitaly Novichkov */ + SDL_memset(music->input_buffer, 0, sizeof(music->input_buffer)); } /* Now we have to skip frames until we come to the right one.