Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApplicationPlayer: Sanitize ClosePlayer() and SetPlaySpeed() #3200

Merged
merged 1 commit into from Sep 6, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 10 additions & 6 deletions xbmc/ApplicationPlayer.cpp
Expand Up @@ -38,11 +38,11 @@ boost::shared_ptr<IPlayer> CApplicationPlayer::GetInternal() const

void CApplicationPlayer::ClosePlayer()
{
CSingleLock lock(m_player_lock);
if (m_pPlayer)
boost::shared_ptr<IPlayer> player = GetInternal();
if (player)
{
CloseFile();
m_pPlayer.reset();
player.reset();
}
}

Expand Down Expand Up @@ -661,6 +661,10 @@ void CApplicationPlayer::GetScalingMethods(std::vector<int> &scalingMethods)

void CApplicationPlayer::SetPlaySpeed(int iSpeed, bool bApplicationMuted)
{
boost::shared_ptr<IPlayer> player = GetInternal();
if (!player)
return;

if (!IsPlayingAudio() && !IsPlayingVideo())
return ;
if (m_iPlaySpeed == iSpeed)
Expand All @@ -687,13 +691,13 @@ void CApplicationPlayer::SetPlaySpeed(int iSpeed, bool bApplicationMuted)
{
if (m_iPlaySpeed == 1)
{ // restore volume
m_pPlayer->SetVolume(VOLUME_MAXIMUM);
player->SetVolume(VOLUME_MAXIMUM);
}
else
{ // mute volume
m_pPlayer->SetVolume(VOLUME_MINIMUM);
player->SetVolume(VOLUME_MINIMUM);
}
m_pPlayer->SetMute(bApplicationMuted);
player->SetMute(bApplicationMuted);
}
}

Expand Down