player/Thread: move code to WaitDecoderStartup()
This commit is contained in:
parent
3a387643b3
commit
30cad0c5f1
@ -202,6 +202,25 @@ private:
|
|||||||
*/
|
*/
|
||||||
bool CheckDecoderStartup();
|
bool CheckDecoderStartup();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call CheckDecoderStartup() repeatedly until the decoder has
|
||||||
|
* finished startup. Returns false on decoder error (and
|
||||||
|
* finishes the #PlayerCommand).
|
||||||
|
*
|
||||||
|
* This method does not check for commands. It is only
|
||||||
|
* allowed to be used while a command is being handled.
|
||||||
|
*/
|
||||||
|
bool WaitDecoderStartup() {
|
||||||
|
while (decoder_starting) {
|
||||||
|
if (!CheckDecoderStartup()) {
|
||||||
|
pc.LockCommandFinished();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop the decoder and clears (and frees) its music pipe.
|
* Stop the decoder and clears (and frees) its music pipe.
|
||||||
*
|
*
|
||||||
@ -570,13 +589,8 @@ Player::SeekDecoder()
|
|||||||
|
|
||||||
/* wait for the decoder to complete initialization */
|
/* wait for the decoder to complete initialization */
|
||||||
|
|
||||||
while (decoder_starting) {
|
if (!WaitDecoderStartup())
|
||||||
if (!CheckDecoderStartup()) {
|
return false;
|
||||||
/* decoder failure */
|
|
||||||
pc.LockCommandFinished();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* send the SEEK command */
|
/* send the SEEK command */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user