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.

Backport from default / 2.0 branch commit 760a8cb05f97, thanks to
Vitaly Novichkov.
  • Loading branch information
sezero committed Dec 27, 2019
1 parent 647d093 commit e0699ba
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions music_mad.c
Expand Up @@ -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.
Expand Down

0 comments on commit e0699ba

Please sign in to comment.