music_mad.c (MAD_Seek): Avoid a junk chunk be played after seek.
authorVitaly Novichkov
Sun, 22 Dec 2019 17:20:50 +0300
changeset 1115760a8cb05f97
parent 1114 5ca667177b34
child 1116 9835d67a27f9
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
     1.1 --- a/src/codecs/music_mad.c	Sun Dec 22 15:55:50 2019 +0300
     1.2 +++ b/src/codecs/music_mad.c	Sun Dec 22 17:20:50 2019 +0300
     1.3 @@ -408,6 +408,8 @@
     1.4          music->status &= ~MS_error_flags;
     1.5  
     1.6          MP3_RWseek(&music->mp3file, 0, RW_SEEK_SET);
     1.7 +        /* Avoid junk chunk be played after seek -- Vitaly Novichkov */
     1.8 +        SDL_memset(music->input_buffer, 0, sizeof(music->input_buffer));
     1.9      }
    1.10  
    1.11      /* Now we have to skip frames until we come to the right one.