player/Thread: move mutex lock out of StopDecoder()
This commit is contained in:
parent
860d13c7d8
commit
505d0bfa51
@ -239,7 +239,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
* Stop the decoder and clears (and frees) its music pipe.
|
* Stop the decoder and clears (and frees) its music pipe.
|
||||||
*
|
*
|
||||||
* Player lock is not held.
|
* Caller must lock the mutex.
|
||||||
*/
|
*/
|
||||||
void StopDecoder() noexcept;
|
void StopDecoder() noexcept;
|
||||||
|
|
||||||
@ -373,7 +373,6 @@ void
|
|||||||
Player::StopDecoder() noexcept
|
Player::StopDecoder() noexcept
|
||||||
{
|
{
|
||||||
const PlayerControl::ScopeOccupied occupied(pc);
|
const PlayerControl::ScopeOccupied occupied(pc);
|
||||||
const std::lock_guard<Mutex> protect(pc.mutex);
|
|
||||||
|
|
||||||
dc.Stop();
|
dc.Stop();
|
||||||
|
|
||||||
@ -592,7 +591,10 @@ Player::SeekDecoder() noexcept
|
|||||||
/* the decoder is already decoding the "next" song -
|
/* the decoder is already decoding the "next" song -
|
||||||
stop it and start the previous song again */
|
stop it and start the previous song again */
|
||||||
|
|
||||||
StopDecoder();
|
{
|
||||||
|
const std::lock_guard<Mutex> lock(pc.mutex);
|
||||||
|
StopDecoder();
|
||||||
|
}
|
||||||
|
|
||||||
/* clear music chunks which might still reside in the
|
/* clear music chunks which might still reside in the
|
||||||
pipe */
|
pipe */
|
||||||
@ -727,12 +729,10 @@ Player::ProcessCommand() noexcept
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsDecoderAtNextSong()) {
|
if (IsDecoderAtNextSong())
|
||||||
/* the decoder is already decoding the song -
|
/* the decoder is already decoding the song -
|
||||||
stop it and reset the position */
|
stop it and reset the position */
|
||||||
const ScopeUnlock unlock(pc.mutex);
|
|
||||||
StopDecoder();
|
StopDecoder();
|
||||||
}
|
|
||||||
|
|
||||||
pc.next_song.reset();
|
pc.next_song.reset();
|
||||||
queued = false;
|
queued = false;
|
||||||
@ -1120,6 +1120,8 @@ Player::Run() noexcept
|
|||||||
pc.Lock();
|
pc.Lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::lock_guard<Mutex> lock(pc.mutex);
|
||||||
|
|
||||||
StopDecoder();
|
StopDecoder();
|
||||||
|
|
||||||
ClearAndDeletePipe();
|
ClearAndDeletePipe();
|
||||||
@ -1131,8 +1133,6 @@ Player::Run() noexcept
|
|||||||
song.reset();
|
song.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::lock_guard<Mutex> lock(pc.mutex);
|
|
||||||
|
|
||||||
pc.ClearTaggedSong();
|
pc.ClearTaggedSong();
|
||||||
|
|
||||||
if (queued) {
|
if (queued) {
|
||||||
|
Loading…
Reference in New Issue
Block a user