Skip to content

Commit

Permalink
music_mad.c (MAD_Seek): Avoid a junk chunk be played after seek.
Browse files Browse the repository at this point in the history
If buffer isn't cleared, the garbage left after previously played
frame will be played after seek until playing frame on the target
position.
  • Loading branch information
Wohlstand committed Dec 22, 2019
1 parent ae8bde7 commit 02b3042
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/codecs/music_mad.c
Expand Up @@ -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.
Expand Down

0 comments on commit 02b3042

Please sign in to comment.