mirror of
https://github.com/clangen/musikcube.git
synced 2024-12-29 09:18:36 +00:00
Fixed a deadlock in PlaybackService when changing tracks from an IPlaybackRemote.
This commit is contained in:
parent
482433e5da
commit
bc87e4d28c
@ -255,6 +255,11 @@ void PlaybackService::ProcessMessage(IMessage &message) {
|
||||
int64 eventType = streamMessage->GetEventType();
|
||||
|
||||
if (eventType == StreamPlaying) {
|
||||
TrackPtr track;
|
||||
|
||||
{
|
||||
std::unique_lock<std::recursive_mutex> lock(this->playlistMutex);
|
||||
|
||||
if (this->nextIndex != NO_POSITION) {
|
||||
/* in most cases when we get here it means that the next track is
|
||||
starting, so we want to update our internal index. however, because
|
||||
@ -274,13 +279,11 @@ void PlaybackService::ProcessMessage(IMessage &message) {
|
||||
}
|
||||
|
||||
if (this->index != NO_POSITION) {
|
||||
TrackPtr track;
|
||||
|
||||
{
|
||||
std::unique_lock<std::recursive_mutex> lock(this->playlistMutex);
|
||||
track = this->playlist.Get(this->index);
|
||||
}
|
||||
}
|
||||
|
||||
if (track) {
|
||||
this->OnTrackChanged(this->index, track);
|
||||
}
|
||||
|
||||
@ -364,6 +367,8 @@ bool PlaybackService::Previous() {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_lock<std::recursive_mutex> lock(this->playlistMutex);
|
||||
|
||||
if (transport.Position() > PREVIOUS_GRACE_PERIOD) {
|
||||
this->Play(index);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user