From 6f59d71e0767a3fb84ff9b63555082938c7f4402 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 6 Jul 2016 15:37:11 +0200 Subject: [PATCH] decoder/API: check initial_seek_running in _check_cancel_read() The "seeking" flag is not set for the initial seek, and so decoder_read() could be canceled when another SEEK was emitted during initial seek. This fixes several seek problems, for example the one reported for the FLAC decoder plugin: https://bugs.musicpd.org/view.php?id=4552 --- NEWS | 1 + src/decoder/DecoderAPI.cxx | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 8ae416442..dc81a79c4 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ ver 0.19.17 (not yet released) * decoder - flac: fix assertion failure while seeking + - fix seek problems in several plugins * fix spurious seek error "Failed to allocate silence buffer" * replay gain: fix "replay_gain_handler mixer" setting * DSD: use 0x69 as silence pattern diff --git a/src/decoder/DecoderAPI.cxx b/src/decoder/DecoderAPI.cxx index 941d3a70d..d7c9bc7ee 100644 --- a/src/decoder/DecoderAPI.cxx +++ b/src/decoder/DecoderAPI.cxx @@ -301,7 +301,8 @@ decoder_check_cancel_read(const Decoder *decoder) /* ignore the SEEK command during initialization, the plugin should handle that after it has initialized successfully */ if (dc.command == DecoderCommand::SEEK && - (dc.state == DecoderState::START || decoder->seeking)) + (dc.state == DecoderState::START || decoder->seeking || + decoder->initial_seek_running)) return false; return true;