From e0699ba2327e760132c73c7d9e6e7dc9de4ea5f1 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sat, 28 Dec 2019 01:20:02 +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. Backport from default / 2.0 branch commit 760a8cb05f97, thanks to Vitaly Novichkov. --- music_mad.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/music_mad.c b/music_mad.c index 21846b84..f03b88e2 100644 --- a/music_mad.c +++ b/music_mad.c @@ -308,6 +308,8 @@ mad_seek(mad_data *mp3_mad, double position) { mp3_mad->output_end = 0; MP3_RWseek(&mp3_mad->mp3file, 0, RW_SEEK_SET); + /* Avoid junk chunk be played after seek -- Vitaly Novichkov */ + memset (mp3_mad->input_buffer, 0, sizeof(mp3_mad->input_buffer)); } /* Now we have to skip frames until we come to the right one.