Skip to content

Commit

Permalink
FLAC_seek: clear audio stream before seeking to fix initial stutter
Browse files Browse the repository at this point in the history
Fixes http://bugzilla.libsdl.org/show_bug.cgi?id=4680 - reported by
Braden Obrzut.  Patch from Michael Day.
  • Loading branch information
sezero committed Nov 18, 2019
1 parent 7775ac1 commit e62a8b8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions music_flac.c
Expand Up @@ -643,6 +643,7 @@ static int FLAC_Seek(void *context, double position)
FLAC_Music *music = (FLAC_Music *)context;
double seek_sample = music->sample_rate * position;

SDL_AudioStreamClear(music->stream);
music->pcm_pos = seek_sample;
if (!flac.FLAC__stream_decoder_seek_absolute(music->flac_decoder, (FLAC__uint64)seek_sample)) {
if (flac.FLAC__stream_decoder_get_state(music->flac_decoder) == FLAC__STREAM_DECODER_SEEK_ERROR) {
Expand Down

0 comments on commit e62a8b8

Please sign in to comment.