Skip to content
Permalink
Browse files

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.
  • Loading branch information
sezero committed Dec 27, 2019
1 parent 647d093 commit e0699ba2327e760132c73c7d9e6e7dc9de4ea5f1
Showing with 2 additions and 0 deletions.
  1. +2 −0 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.

0 comments on commit e0699ba

Please sign in to comment.