music_mad.c (mad_seek): Avoid a junk chunk be played after seek. SDL-1.2
authorOzkan Sezer <sezeroz@gmail.com>
Sat, 28 Dec 2019 01:20:02 +0300
branchSDL-1.2
changeset 1125cf41cf196597
parent 1124 a606a79a3b9f
child 1126 0a038da72ba2
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
     1.1 --- a/music_mad.c	Thu Dec 26 17:28:50 2019 +0300
     1.2 +++ b/music_mad.c	Sat Dec 28 01:20:02 2019 +0300
     1.3 @@ -308,6 +308,8 @@
     1.4  	mp3_mad->output_end = 0;
     1.5  
     1.6  	MP3_RWseek(&mp3_mad->mp3file, 0, RW_SEEK_SET);
     1.7 +	/* Avoid junk chunk be played after seek -- Vitaly Novichkov */
     1.8 +	memset (mp3_mad->input_buffer, 0, sizeof(mp3_mad->input_buffer));
     1.9    }
    1.10  
    1.11    /* Now we have to skip frames until we come to the right one.