Fixed another small race condition in transport where changing tracks

right when the transport is automatically switching over to the
preloaded next track could cause a crash.
This commit is contained in:
casey 2016-05-26 10:13:07 -07:00
parent 3968e39f7f
commit 73305d420d

View File

@ -245,10 +245,18 @@ void Transport::RemoveActive(Player* player) {
void Transport::OnPlaybackFinished(Player* player) {
this->RaiseStreamEvent(Transport::StreamFinished, player);
if (this->nextPlayer) {
this->StartWithPlayer(this->nextPlayer);
bool startedNext = false;
{
boost::recursive_mutex::scoped_lock lock(this->stateMutex);
if (this->nextPlayer) {
this->StartWithPlayer(this->nextPlayer);
startedNext = true;
}
}
else {
if (!startedNext) {
this->SetPlaybackState(Transport::PlaybackStopped);
}