Commit d2e47e01 authored by Max Kellermann's avatar Max Kellermann

player/Thread: reduce unlock/lock overhead in PlayerCommand::PAUSE handler

parent a5b8d791
......@@ -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();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment