diff options
author | Max Kellermann <max@duempel.org> | 2008-04-12 04:13:45 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-04-12 04:13:45 +0000 |
commit | 11a5728e1d9d80795f3accd3a15a9704b3497e1a (patch) | |
tree | 8c4df46af8352219c83c851edf045fa440ab8a1a | |
parent | f25ff426390cc50bc601ea7cfc7c04b56b06621b (diff) | |
download | mpd-11a5728e1d9d80795f3accd3a15a9704b3497e1a.tar.gz mpd-11a5728e1d9d80795f3accd3a15a9704b3497e1a.tar.xz mpd-11a5728e1d9d80795f3accd3a15a9704b3497e1a.zip |
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
-rw-r--r-- | src/decode.c | 18 |
1 files changed, 5 insertions, 13 deletions
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) { |