aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_control.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/decoder_control.c')
-rw-r--r--src/decoder_control.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/decoder_control.c b/src/decoder_control.c
index 7aa80c2c6..44bb63e15 100644
--- a/src/decoder_control.c
+++ b/src/decoder_control.c
@@ -80,8 +80,14 @@ dc_start_async(struct song *song)
void
dc_stop(struct notify *notify)
{
- if (dc.command == DECODE_COMMAND_START ||
- (dc.state != DECODE_STATE_STOP && dc.state != DECODE_STATE_ERROR))
+ if (dc.command != DECODE_COMMAND_NONE)
+ /* Attempt to cancel the current command. If it's too
+ late and the decoder thread is already executing
+ the old command, we'll call STOP again in this
+ function (see below). */
+ dc_command(notify, DECODE_COMMAND_STOP);
+
+ if (dc.state != DECODE_STATE_STOP && dc.state != DECODE_STATE_ERROR)
dc_command(notify, DECODE_COMMAND_STOP);
}