Commit 3b2b5edd authored by Max Kellermann's avatar Max Kellermann

player/Thread: move mutex lock out of SeekDecoder()

parent 5bd1fbb0
...@@ -274,7 +274,7 @@ private: ...@@ -274,7 +274,7 @@ private:
/** /**
* This is the handler for the #PlayerCommand::SEEK command. * This is the handler for the #PlayerCommand::SEEK command.
* *
* The player lock is not held. * Caller must lock the mutex.
* *
* @return false if the decoder has failed * @return false if the decoder has failed
*/ */
...@@ -613,9 +613,10 @@ Player::SeekDecoder() noexcept ...@@ -613,9 +613,10 @@ Player::SeekDecoder() noexcept
{ {
assert(pc.next_song != nullptr); assert(pc.next_song != nullptr);
pc.outputs.Cancel(); {
const ScopeUnlock unlock(pc.mutex);
const std::lock_guard<Mutex> lock(pc.mutex); pc.outputs.Cancel();
}
if (!dc.IsCurrentSong(*pc.next_song)) { if (!dc.IsCurrentSong(*pc.next_song)) {
/* the decoder is already decoding the "next" song - /* the decoder is already decoding the "next" song -
...@@ -717,10 +718,7 @@ Player::ProcessCommand() noexcept ...@@ -717,10 +718,7 @@ Player::ProcessCommand() noexcept
break; break;
case PlayerCommand::SEEK: case PlayerCommand::SEEK:
{ SeekDecoder();
const ScopeUnlock unlock(pc.mutex);
SeekDecoder();
}
break; break;
case PlayerCommand::CANCEL: case PlayerCommand::CANCEL:
......
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