player/Thread: reduce unlock/lock overhead in PlayerCommand::PAUSE handler
This commit is contained in:
parent
a5b8d7917f
commit
d2e47e014a
@ -681,23 +681,17 @@ Player::ProcessCommand()
|
||||
break;
|
||||
|
||||
case PlayerCommand::PAUSE:
|
||||
pc.Unlock();
|
||||
|
||||
paused = !paused;
|
||||
if (paused) {
|
||||
pc.outputs.Pause();
|
||||
pc.Lock();
|
||||
|
||||
pc.state = PlayerState::PAUSE;
|
||||
|
||||
const ScopeUnlock unlock(pc.mutex);
|
||||
pc.outputs.Pause();
|
||||
} else if (!play_audio_format.IsDefined()) {
|
||||
/* the decoder hasn't provided an audio format
|
||||
yet - don't open the audio device yet */
|
||||
pc.Lock();
|
||||
|
||||
pc.state = PlayerState::PLAY;
|
||||
} else {
|
||||
pc.Lock();
|
||||
|
||||
OpenOutput();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user