diff options
author | Max Kellermann <max@duempel.org> | 2015-11-05 00:38:09 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-11-05 00:38:09 +0100 |
commit | 3a387643b34d11d17c37e83812aedbf5f8171029 (patch) | |
tree | bfdcd444cb566b9247f4d32a485342bfd6e9c831 /src | |
parent | e6b37703daf859383358f409fab9fafdb4873a1d (diff) | |
download | mpd-3a387643b34d11d17c37e83812aedbf5f8171029.tar.gz mpd-3a387643b34d11d17c37e83812aedbf5f8171029.tar.xz mpd-3a387643b34d11d17c37e83812aedbf5f8171029.zip |
player/Thread: move player_command_finished() to PlayerControl
Diffstat (limited to 'src')
-rw-r--r-- | src/player/Control.hxx | 6 | ||||
-rw-r--r-- | src/player/Thread.cxx | 16 |
2 files changed, 10 insertions, 12 deletions
diff --git a/src/player/Control.hxx b/src/player/Control.hxx index 2b15e89d8..ae4465ca6 100644 --- a/src/player/Control.hxx +++ b/src/player/Control.hxx @@ -263,6 +263,12 @@ struct PlayerControl { ClientSignal(); } + void LockCommandFinished() { + Lock(); + CommandFinished(); + Unlock(); + } + private: /** * Wait for the command to be finished by the player thread. diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx index 5673f4867..3c315ebcf 100644 --- a/src/player/Thread.cxx +++ b/src/player/Thread.cxx @@ -310,14 +310,6 @@ public: void Run(); }; -static void -player_command_finished(PlayerControl &pc) -{ - pc.Lock(); - pc.CommandFinished(); - pc.Unlock(); -} - void Player::StartDecoder(MusicPipe &_pipe) { @@ -581,7 +573,7 @@ Player::SeekDecoder() while (decoder_starting) { if (!CheckDecoderStartup()) { /* decoder failure */ - player_command_finished(pc); + pc.LockCommandFinished(); return false; } } @@ -597,13 +589,13 @@ Player::SeekDecoder() if (!dc.Seek(where + start_time)) { /* decoder failure */ - player_command_finished(pc); + pc.LockCommandFinished(); return false; } elapsed_time = where; - player_command_finished(pc); + pc.LockCommandFinished(); assert(xfade_state == CrossFadeState::UNKNOWN); @@ -1190,7 +1182,7 @@ player_task(void *arg) pc.outputs.Close(); - player_command_finished(pc); + pc.LockCommandFinished(); return; case PlayerCommand::CANCEL: |