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.
This commit is contained in:
parent
c6035ea332
commit
a1ce999978
@ -217,8 +217,14 @@ static void decodeParent(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (decodeWaitedOn) {
|
if (decodeWaitedOn) {
|
||||||
if(dc.state!=DECODE_STATE_START &&
|
if (dc.error != DECODE_ERROR_NOERROR) {
|
||||||
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 */
|
/* the decoder is ready and ok */
|
||||||
decodeWaitedOn = 0;
|
decodeWaitedOn = 0;
|
||||||
if(openAudioDevice(&(ob.audioFormat))<0) {
|
if(openAudioDevice(&(ob.audioFormat))<0) {
|
||||||
@ -242,13 +248,6 @@ static void decodeParent(void)
|
|||||||
pc.channels = dc.audioFormat.channels;
|
pc.channels = dc.audioFormat.channels;
|
||||||
sizeToTime = audioFormatSizeToTime(&ob.audioFormat);
|
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 {
|
else {
|
||||||
/* the decoder is not yet ready; wait
|
/* the decoder is not yet ready; wait
|
||||||
some more */
|
some more */
|
||||||
|
Loading…
Reference in New Issue
Block a user