diff options
author | Martijn van Beurden <mvanb1@gmail.com> | 2022-04-25 20:29:57 +0200 |
---|---|---|
committer | Martijn van Beurden <mvanb1@gmail.com> | 2022-04-27 10:29:34 +0200 |
commit | 7e785eb9a84f9147246eb2b0e5e35ec01db5a815 (patch) | |
tree | 65b3b0f7539995e77f135e3bd5cf90a43b2f27d8 /src | |
parent | 9c495ae3acb35cefd641eb8881281098165c8851 (diff) | |
download | flac-7e785eb9a84f9147246eb2b0e5e35ec01db5a815.tar.gz |
Fix seeking bug
Commit 159cd6c introduced a bug that only triggered upon seeking
from the start of a headerless FLAC file to the first frame (so
really not a seek at all). Furthermore that commit did nothing
else in any other circumstance. This commit fixes that, by both
fixing the problem and the behaviour the commit mentioned earlier
meant to introduce.
Co-authored-by: Robert Kausch <robert.kausch@freac.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/libFLAC/stream_decoder.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c index 564a106a..8bdf38b6 100644 --- a/src/libFLAC/stream_decoder.c +++ b/src/libFLAC/stream_decoder.c @@ -3091,7 +3091,8 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s upper_bound = stream_length; upper_bound_sample = total_samples > 0 ? total_samples : target_sample /*estimate it*/; - if(decoder->protected_->state == FLAC__STREAM_DECODER_READ_FRAME) { + if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC && + decoder->private_->samples_decoded != 0) { if(target_sample < decoder->private_->samples_decoded) { if(FLAC__stream_decoder_get_decode_position(decoder, &upper_bound)) upper_bound_sample = decoder->private_->samples_decoded; |