decoder_thread: check for STOP before calling the plugin

Before calling the plugin's decode method, we should ensure that we
didn't receive a STOP command during initialization.
This commit is contained in:
Max Kellermann 2009-11-07 15:37:18 +01:00
parent 4dadb965a7
commit 3546d931a1

View File

@ -96,6 +96,9 @@ decoder_stream_decode(const struct decoder_plugin *plugin,
assert(input_stream->ready);
assert(decoder->dc->state == DECODE_STATE_START);
if (decoder->dc->command == DECODE_COMMAND_STOP)
return true;
decoder_unlock(decoder->dc);
/* rewind the stream, so each plugin gets a fresh start */
@ -124,6 +127,9 @@ decoder_file_decode(const struct decoder_plugin *plugin,
assert(g_path_is_absolute(path));
assert(decoder->dc->state == DECODE_STATE_START);
if (decoder->dc->command == DECODE_COMMAND_STOP)
return true;
decoder_unlock(decoder->dc);
decoder_plugin_file_decode(plugin, decoder, path);