player/Thread: move code to ForwardDecoderError()
This commit is contained in:
parent
efd871ad2f
commit
166b490eed
@ -239,6 +239,14 @@ private:
|
|||||||
*/
|
*/
|
||||||
bool SeekDecoder();
|
bool SeekDecoder();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the decoder has reported an error, and forward it
|
||||||
|
* to PlayerControl::SetError().
|
||||||
|
*
|
||||||
|
* @return false if an error has occurred
|
||||||
|
*/
|
||||||
|
bool ForwardDecoderError();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After the decoder has been started asynchronously, wait for
|
* After the decoder has been started asynchronously, wait for
|
||||||
* the "START" command to finish. The decoder may not be
|
* the "START" command to finish. The decoder may not be
|
||||||
@ -344,6 +352,18 @@ Player::StopDecoder()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Player::ForwardDecoderError()
|
||||||
|
{
|
||||||
|
Error error = dc.GetError();
|
||||||
|
if (error.IsDefined()) {
|
||||||
|
pc.SetError(PlayerError::DECODER, std::move(error));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Player::WaitForDecoder()
|
Player::WaitForDecoder()
|
||||||
{
|
{
|
||||||
@ -353,10 +373,8 @@ Player::WaitForDecoder()
|
|||||||
queued = false;
|
queued = false;
|
||||||
|
|
||||||
pc.Lock();
|
pc.Lock();
|
||||||
Error error = dc.GetError();
|
|
||||||
if (error.IsDefined()) {
|
|
||||||
pc.SetError(PlayerError::DECODER, std::move(error));
|
|
||||||
|
|
||||||
|
if (!ForwardDecoderError()) {
|
||||||
delete pc.next_song;
|
delete pc.next_song;
|
||||||
pc.next_song = nullptr;
|
pc.next_song = nullptr;
|
||||||
|
|
||||||
@ -457,10 +475,8 @@ Player::CheckDecoderStartup()
|
|||||||
|
|
||||||
pc.Lock();
|
pc.Lock();
|
||||||
|
|
||||||
Error error = dc.GetError();
|
if (!ForwardDecoderError()) {
|
||||||
if (error.IsDefined()) {
|
|
||||||
/* the decoder failed */
|
/* the decoder failed */
|
||||||
pc.SetError(PlayerError::DECODER, std::move(error));
|
|
||||||
pc.Unlock();
|
pc.Unlock();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user