continue main loop instead of nesting loops

To unify the decoderParent() main loop some more, use it to wait for
the decoder to change the song.  Only one single processDecodeInput()
caller left after this patch.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7273 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Max Kellermann 2008-04-12 04:13:45 +00:00 committed by Eric Wong
parent f25ff42639
commit 11a5728e1d

View File

@ -574,20 +574,13 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
advanceOutputBufferTo(cb, nextChunk); advanceOutputBufferTo(cb, nextChunk);
} }
/* wait for the decoder to work on the new song */ doCrossFade = 0;
while (pc->queueState == PLAYER_QUEUE_DECODE ||
pc->queueLockState == PLAYER_QUEUE_LOCKED) {
processDecodeInput(pc, dc, cb,
&pause, &bbp, &doCrossFade,
&decodeWaitedOn,
&next);
if (pc->stop) {
dropBufferedAudio();
quitDecode(pc,dc);
return;
}
/* wait for the decoder to work on the new song */
if (pc->queueState == PLAYER_QUEUE_DECODE ||
pc->queueLockState == PLAYER_QUEUE_LOCKED) {
player_sleep(); player_sleep();
continue;
} }
if (pc->queueState != PLAYER_QUEUE_PLAY) if (pc->queueState != PLAYER_QUEUE_PLAY)
break; break;
@ -596,7 +589,6 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
if (waitOnDecode(pc, dc, cb, &decodeWaitedOn) < 0) if (waitOnDecode(pc, dc, cb, &decodeWaitedOn) < 0)
return; return;
doCrossFade = 0;
pc->queueState = PLAYER_QUEUE_EMPTY; pc->queueState = PLAYER_QUEUE_EMPTY;
wakeup_main_task(); wakeup_main_task();
} else if (dc->state == DECODE_STATE_STOP && !dc->start) { } else if (dc->state == DECODE_STATE_STOP && !dc->start) {