Skip to content
This repository
Browse code

Merge pull request #3200 from herrnst/appplayer-lock

ApplicationPlayer: Sanitize ClosePlayer() and SetPlaySpeed()
  • Loading branch information...
commit 421a4e84766a6097382c25e11506d8a6964b57b8 2 parents 5f6255f + 4926675
Peter Frühberger authored September 06, 2013

Showing 1 changed file with 10 additions and 6 deletions. Show diff stats Hide diff stats

  1. 16  xbmc/ApplicationPlayer.cpp
16  xbmc/ApplicationPlayer.cpp
@@ -38,11 +38,11 @@ boost::shared_ptr<IPlayer> CApplicationPlayer::GetInternal() const
38 38
 
39 39
 void CApplicationPlayer::ClosePlayer()
40 40
 {
41  
-  CSingleLock lock(m_player_lock);
42  
-  if (m_pPlayer)
  41
+  boost::shared_ptr<IPlayer> player = GetInternal();
  42
+  if (player)
43 43
   {
44 44
     CloseFile();
45  
-    m_pPlayer.reset();
  45
+    player.reset();
46 46
   }
47 47
 }
48 48
 
@@ -661,6 +661,10 @@ void CApplicationPlayer::GetScalingMethods(std::vector<int> &scalingMethods)
661 661
 
662 662
 void CApplicationPlayer::SetPlaySpeed(int iSpeed, bool bApplicationMuted)
663 663
 {
  664
+  boost::shared_ptr<IPlayer> player = GetInternal();
  665
+  if (!player)
  666
+    return;
  667
+
664 668
   if (!IsPlayingAudio() && !IsPlayingVideo())
665 669
     return ;
666 670
   if (m_iPlaySpeed == iSpeed)
@@ -687,13 +691,13 @@ void CApplicationPlayer::SetPlaySpeed(int iSpeed, bool bApplicationMuted)
687 691
   {
688 692
     if (m_iPlaySpeed == 1)
689 693
     { // restore volume
690  
-      m_pPlayer->SetVolume(VOLUME_MAXIMUM);
  694
+      player->SetVolume(VOLUME_MAXIMUM);
691 695
     }
692 696
     else
693 697
     { // mute volume
694  
-      m_pPlayer->SetVolume(VOLUME_MINIMUM);
  698
+      player->SetVolume(VOLUME_MINIMUM);
695 699
     }
696  
-    m_pPlayer->SetMute(bApplicationMuted);
  700
+    player->SetMute(bApplicationMuted);
697 701
   }
698 702
 }
699 703
 

0 notes on commit 421a4e8

Please sign in to comment.
Something went wrong with that request. Please try again.