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;
|
break;
|
||||||
|
|
||||||
case PlayerCommand::PAUSE:
|
case PlayerCommand::PAUSE:
|
||||||
pc.Unlock();
|
|
||||||
|
|
||||||
paused = !paused;
|
paused = !paused;
|
||||||
if (paused) {
|
if (paused) {
|
||||||
pc.outputs.Pause();
|
|
||||||
pc.Lock();
|
|
||||||
|
|
||||||
pc.state = PlayerState::PAUSE;
|
pc.state = PlayerState::PAUSE;
|
||||||
|
|
||||||
|
const ScopeUnlock unlock(pc.mutex);
|
||||||
|
pc.outputs.Pause();
|
||||||
} else if (!play_audio_format.IsDefined()) {
|
} else if (!play_audio_format.IsDefined()) {
|
||||||
/* the decoder hasn't provided an audio format
|
/* the decoder hasn't provided an audio format
|
||||||
yet - don't open the audio device yet */
|
yet - don't open the audio device yet */
|
||||||
pc.Lock();
|
|
||||||
|
|
||||||
pc.state = PlayerState::PLAY;
|
pc.state = PlayerState::PLAY;
|
||||||
} else {
|
} else {
|
||||||
pc.Lock();
|
|
||||||
|
|
||||||
OpenOutput();
|
OpenOutput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user