aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-11 08:55:55 +0100
committerMax Kellermann <max@duempel.org>2009-11-11 08:55:55 +0100
commitdca4d9cf83849877206379a20a1e478ed1b5dc55 (patch)
tree11e6364f1f80dee1ca5d17580dff38360d52b3c7 /src
parent68f77e4163db78bbc3740555591b95aad824d82c (diff)
downloadmpd-dca4d9cf83849877206379a20a1e478ed1b5dc55.tar.gz
mpd-dca4d9cf83849877206379a20a1e478ed1b5dc55.tar.xz
mpd-dca4d9cf83849877206379a20a1e478ed1b5dc55.zip
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.
Diffstat (limited to '')
-rw-r--r--src/decoder/flac_plugin.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c
index 1d5d48d09..0c0d994b7 100644
--- a/src/decoder/flac_plugin.c
+++ b/src/decoder/flac_plugin.c
@@ -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;