From 11a5728e1d9d80795f3accd3a15a9704b3497e1a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 12 Apr 2008 04:13:45 +0000 Subject: 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 --- src/decode.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src/decode.c') diff --git a/src/decode.c b/src/decode.c index 145f034b1..b3107cd1d 100644 --- a/src/decode.c +++ b/src/decode.c @@ -574,20 +574,13 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * advanceOutputBufferTo(cb, nextChunk); } - /* wait for the decoder to work on the new song */ - 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; - } + doCrossFade = 0; + /* wait for the decoder to work on the new song */ + if (pc->queueState == PLAYER_QUEUE_DECODE || + pc->queueLockState == PLAYER_QUEUE_LOCKED) { player_sleep(); + continue; } if (pc->queueState != PLAYER_QUEUE_PLAY) break; @@ -596,7 +589,6 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * if (waitOnDecode(pc, dc, cb, &decodeWaitedOn) < 0) return; - doCrossFade = 0; pc->queueState = PLAYER_QUEUE_EMPTY; wakeup_main_task(); } else if (dc->state == DECODE_STATE_STOP && !dc->start) { -- cgit v1.2.3