diff options
author | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:18 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:18 +0200 |
commit | a1ce999978adb716bec99ac259faf20d88306443 (patch) | |
tree | 7a70b93fb6b20056c9bd10b45863bda39b77c7d8 /src | |
parent | c6035ea33256159fd27a1b2cb34878cfbdca0fca (diff) | |
download | mpd-a1ce999978adb716bec99ac259faf20d88306443.tar.gz mpd-a1ce999978adb716bec99ac259faf20d88306443.tar.xz mpd-a1ce999978adb716bec99ac259faf20d88306443.zip |
check for decoder error before state!=START
When dc->error!=NOERROR, we do not need to check state!=START.
Simplify the checks by moving the error check to the top.
Diffstat (limited to 'src')
-rw-r--r-- | src/player_thread.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/player_thread.c b/src/player_thread.c index 761e0fba0..6f0828f93 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -217,8 +217,14 @@ static void decodeParent(void) } if (decodeWaitedOn) { - if(dc.state!=DECODE_STATE_START && - dc.error==DECODE_ERROR_NOERROR) { + if (dc.error != DECODE_ERROR_NOERROR) { + /* the decoder failed */ + assert(dc.next_song == NULL || dc.next_song->url != NULL); + pc.errored_song = dc.next_song; + pc.error = PLAYER_ERROR_FILE; + break; + } + else if (dc.state != DECODE_STATE_START) { /* the decoder is ready and ok */ decodeWaitedOn = 0; if(openAudioDevice(&(ob.audioFormat))<0) { @@ -242,13 +248,6 @@ static void decodeParent(void) pc.channels = dc.audioFormat.channels; sizeToTime = audioFormatSizeToTime(&ob.audioFormat); } - else if(dc.state!=DECODE_STATE_START) { - /* the decoder failed */ - assert(dc.next_song == NULL || dc.next_song->url != NULL); - pc.errored_song = dc.next_song; - pc.error = PLAYER_ERROR_FILE; - break; - } else { /* the decoder is not yet ready; wait some more */ |