decoder: reset state and command in decoder_task()
Eliminate one goto in decodeStart() by moving some cleanup to decoder_task().
This commit is contained in:
parent
86fbac54fd
commit
347e816247
|
@ -46,7 +46,7 @@ static void decodeStart(void)
|
||||||
dc.current_song = dc.next_song; /* NEED LOCK */
|
dc.current_song = dc.next_song; /* NEED LOCK */
|
||||||
if (!input_stream_open(&inStream, path_max_fs)) {
|
if (!input_stream_open(&inStream, path_max_fs)) {
|
||||||
dc.error = DECODE_ERROR_FILE;
|
dc.error = DECODE_ERROR_FILE;
|
||||||
goto stop_no_close;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
decoder.seeking = false;
|
decoder.seeking = false;
|
||||||
|
@ -159,9 +159,6 @@ static void decodeStart(void)
|
||||||
stop:
|
stop:
|
||||||
if (close_instream)
|
if (close_instream)
|
||||||
input_stream_close(&inStream);
|
input_stream_close(&inStream);
|
||||||
stop_no_close:
|
|
||||||
dc.state = DECODE_STATE_STOP;
|
|
||||||
dc.command = DECODE_COMMAND_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void * decoder_task(mpd_unused void *arg)
|
static void * decoder_task(mpd_unused void *arg)
|
||||||
|
@ -173,6 +170,9 @@ static void * decoder_task(mpd_unused void *arg)
|
||||||
case DECODE_COMMAND_START:
|
case DECODE_COMMAND_START:
|
||||||
case DECODE_COMMAND_SEEK:
|
case DECODE_COMMAND_SEEK:
|
||||||
decodeStart();
|
decodeStart();
|
||||||
|
|
||||||
|
dc.state = DECODE_STATE_STOP;
|
||||||
|
dc.command = DECODE_COMMAND_NONE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DECODE_COMMAND_STOP:
|
case DECODE_COMMAND_STOP:
|
||||||
|
|
Loading…
Reference in New Issue