decoder_api: check state before emitting initial seek command

This fixes seeking in the vorbis decoder during MPD startup.
This commit is contained in:
Max Kellermann 2012-02-13 18:27:43 +01:00
parent 7855a32579
commit e1e3ce980a
2 changed files with 8 additions and 0 deletions

2
NEWS
View File

@ -1,5 +1,7 @@
ver 0.16.8 (2012/??/??) ver 0.16.8 (2012/??/??)
* fix for libsamplerate assertion failure * fix for libsamplerate assertion failure
* decoder:
- vorbis (and others): fix seeking at startup
ver 0.16.7 (2012/02/04) ver 0.16.7 (2012/02/04)

View File

@ -89,6 +89,12 @@ decoder_prepare_initial_seek(struct decoder *decoder)
const struct decoder_control *dc = decoder->dc; const struct decoder_control *dc = decoder->dc;
assert(dc->pipe != NULL); 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) if (decoder->initial_seek_running)
/* initial seek has already begun - override any other /* initial seek has already begun - override any other
command */ command */