moved the initial buffering code into the big loop
Eliminating some duplicated and. This also decreases the number of lines calling processDecodeInput(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7260 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
aaebd9ef2b
commit
b89b019723
23
src/decode.c
23
src/decode.c
@ -365,6 +365,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
|
|||||||
{
|
{
|
||||||
int pause = 0;
|
int pause = 0;
|
||||||
int quit = 0;
|
int quit = 0;
|
||||||
|
int buffering = 1;
|
||||||
unsigned int bbp = buffered_before_play;
|
unsigned int bbp = buffered_before_play;
|
||||||
/** cross fading enabled for the current song? 0=must check;
|
/** cross fading enabled for the current song? 0=must check;
|
||||||
1=enabled; -1=disabled */
|
1=enabled; -1=disabled */
|
||||||
@ -390,8 +391,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
|
|||||||
pc->play = 0;
|
pc->play = 0;
|
||||||
wakeup_main_task();
|
wakeup_main_task();
|
||||||
|
|
||||||
while (availableOutputBuffer(cb) < bbp &&
|
while (!quit) {
|
||||||
dc->state != DECODE_STATE_STOP) {
|
|
||||||
processDecodeInput(pc, dc, cb,
|
processDecodeInput(pc, dc, cb,
|
||||||
&pause, &bbp, &doCrossFade,
|
&pause, &bbp, &doCrossFade,
|
||||||
&nextChunk, &decodeWaitedOn, &next);
|
&nextChunk, &decodeWaitedOn, &next);
|
||||||
@ -401,17 +401,14 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player_sleep();
|
if (buffering) {
|
||||||
}
|
if (availableOutputBuffer(cb) < bbp) {
|
||||||
|
/* not enough decoded buffer space yet */
|
||||||
while (!quit) {
|
player_sleep();
|
||||||
processDecodeInput(pc, dc, cb,
|
continue;
|
||||||
&pause, &bbp, &doCrossFade,
|
} else
|
||||||
&nextChunk, &decodeWaitedOn, &next);
|
/* buffering is complete */
|
||||||
if (pc->stop) {
|
buffering = 0;
|
||||||
dropBufferedAudio();
|
|
||||||
quitDecode(pc,dc);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decodeWaitedOn) {
|
if (decodeWaitedOn) {
|
||||||
|
Loading…
Reference in New Issue
Block a user