player/Thread: merge two mutex locks

This commit is contained in:
Max Kellermann
2017-12-22 00:42:10 +01:00
parent 4bcc38c749
commit ea8ab4ddf2

View File

@@ -610,6 +610,8 @@ Player::SeekDecoder() noexcept
ClearAndReplacePipe(dc.pipe); ClearAndReplacePipe(dc.pipe);
} }
const std::lock_guard<Mutex> lock(pc.mutex);
const SongTime start_time = pc.next_song->GetStartTime(); const SongTime start_time = pc.next_song->GetStartTime();
pc.next_song.reset(); pc.next_song.reset();
queued = false; queued = false;
@@ -618,7 +620,7 @@ Player::SeekDecoder() noexcept
(just in case that happens to be still in (just in case that happens to be still in
progress) */ progress) */
if (!LockWaitDecoderStartup()) if (!WaitDecoderStartup())
return false; return false;
/* send the SEEK command */ /* send the SEEK command */
@@ -630,8 +632,6 @@ Player::SeekDecoder() noexcept
where = total_time; where = total_time;
} }
const std::lock_guard<Mutex> lock(pc.mutex);
try { try {
const PlayerControl::ScopeOccupied occupied(pc); const PlayerControl::ScopeOccupied occupied(pc);