decoder/flac: fixed CUE seeking range check

If flac_container_decode() gets a seek destination which is out of
range, it ignores the SEEK command (never finishes it).  This leads to
MPD lockup, because the player thread waits for completion.
This commit is contained in:
Max Kellermann 2009-11-11 08:55:55 +01:00
parent 68f77e4163
commit dca4d9cf83
2 changed files with 9 additions and 14 deletions

1
NEWS
View File

@ -7,6 +7,7 @@ ver 0.15.6 (2009/??/??)
* decoders:
- ffmpeg: convert metadata
- oggflac: rewind stream after FLAC detection
- flac: fixed CUE seeking range check
* output_thread: check again if output is open on PAUSE
* update: delete ignored symlinks from database
* database: increased maximum line length to 32 kB

View File

@ -629,21 +629,15 @@ flac_container_decode(struct decoder* decoder,
FLAC__uint64 seek_sample = t_start +
(decoder_seek_where(decoder) * data.audio_format.sample_rate);
//if (seek_sample >= t_start && seek_sample <= t_end && data.total_time > 30)
if (seek_sample >= t_start && seek_sample <= t_end)
{
if (flac_seek_absolute(flac_dec, (FLAC__uint64)seek_sample))
{
data.time = (float)(seek_sample - t_start) /
data.audio_format.sample_rate;
data.position = 0;
if (seek_sample >= t_start && seek_sample <= t_end &&
flac_seek_absolute(flac_dec, (FLAC__uint64)seek_sample)) {
data.time = (float)(seek_sample - t_start) /
data.audio_format.sample_rate;
data.position = 0;
decoder_command_finished(decoder);
}
else
decoder_seek_error(decoder);
//decoder_command_finished(decoder);
}
decoder_command_finished(decoder);
} else
decoder_seek_error(decoder);
}
else if (flac_get_state(flac_dec) == flac_decoder_eof)
break;