From e1e3ce980af1f2fb1c4b4f3e4788a4f478bc43e7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 13 Feb 2012 18:27:43 +0100 Subject: decoder_api: check state before emitting initial seek command This fixes seeking in the vorbis decoder during MPD startup. --- NEWS | 2 ++ src/decoder_api.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/NEWS b/NEWS index 3202bc05e..1f19983a7 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ ver 0.16.8 (2012/??/??) * fix for libsamplerate assertion failure +* decoder: + - vorbis (and others): fix seeking at startup ver 0.16.7 (2012/02/04) diff --git a/src/decoder_api.c b/src/decoder_api.c index 695ca0281..19de47855 100644 --- a/src/decoder_api.c +++ b/src/decoder_api.c @@ -89,6 +89,12 @@ decoder_prepare_initial_seek(struct decoder *decoder) const struct decoder_control *dc = decoder->dc; assert(dc->pipe != NULL); + if (dc->state != DECODE_STATE_DECODE) + /* wait until the decoder has finished initialisation + (reading file headers etc.) before emitting the + virtual "SEEK" command */ + return false; + if (decoder->initial_seek_running) /* initial seek has already begun - override any other command */ -- cgit v1.2.3