player/Control: add method LockSetOutputError()
This commit is contained in:
parent
7e1b53480e
commit
baa2bc0c38
|
@ -369,6 +369,22 @@ public:
|
|||
*/
|
||||
void SetError(PlayerError type, std::exception_ptr &&_error);
|
||||
|
||||
/**
|
||||
* Set the error and set state to PlayerState::PAUSE.
|
||||
*/
|
||||
void SetOutputError(std::exception_ptr &&_error) {
|
||||
SetError(PlayerError::OUTPUT, std::move(_error));
|
||||
|
||||
/* pause: the user may resume playback as soon as an
|
||||
audio output becomes available */
|
||||
state = PlayerState::PAUSE;
|
||||
}
|
||||
|
||||
void LockSetOutputError(std::exception_ptr &&_error) {
|
||||
const ScopeLock lock(mutex);
|
||||
SetOutputError(std::move(_error));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether an error has occurred, and if so, rethrows
|
||||
* it.
|
||||
|
|
|
@ -461,10 +461,7 @@ Player::OpenOutput()
|
|||
audio output becomes available */
|
||||
paused = true;
|
||||
|
||||
pc.Lock();
|
||||
pc.SetError(PlayerError::OUTPUT, std::current_exception());
|
||||
pc.state = PlayerState::PAUSE;
|
||||
pc.Unlock();
|
||||
pc.LockSetOutputError(std::current_exception());
|
||||
|
||||
idle_add(IDLE_PLAYER);
|
||||
|
||||
|
@ -911,16 +908,11 @@ Player::PlayNextChunk()
|
|||
|
||||
buffer.Return(chunk);
|
||||
|
||||
pc.Lock();
|
||||
|
||||
pc.SetError(PlayerError::OUTPUT, std::current_exception());
|
||||
|
||||
/* pause: the user may resume playback as soon as an
|
||||
audio output becomes available */
|
||||
pc.state = PlayerState::PAUSE;
|
||||
paused = true;
|
||||
|
||||
pc.Unlock();
|
||||
pc.LockSetOutputError(std::current_exception());
|
||||
|
||||
idle_add(IDLE_PLAYER);
|
||||
|
||||
|
|
Loading…
Reference in New Issue