Commit 11a5728e authored by Max Kellermann's avatar Max Kellermann Committed by Eric Wong

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
parent f25ff426
...@@ -574,20 +574,13 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * ...@@ -574,20 +574,13 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
advanceOutputBufferTo(cb, nextChunk); advanceOutputBufferTo(cb, nextChunk);
} }
doCrossFade = 0;
/* wait for the decoder to work on the new song */ /* wait for the decoder to work on the new song */
while (pc->queueState == PLAYER_QUEUE_DECODE || if (pc->queueState == PLAYER_QUEUE_DECODE ||
pc->queueLockState == PLAYER_QUEUE_LOCKED) { pc->queueLockState == PLAYER_QUEUE_LOCKED) {
processDecodeInput(pc, dc, cb,
&pause, &bbp, &doCrossFade,
&decodeWaitedOn,
&next);
if (pc->stop) {
dropBufferedAudio();
quitDecode(pc,dc);
return;
}
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 * ...@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment