Improve resilience of volume change.
authorStewart Gebbie <sgebbie@gethos.net>
Wed, 26 Jun 2013 10:04:20 +0000 (12:04 +0200)
committerStewart Gebbie <sgebbie@gethos.net>
Thu, 27 Jun 2013 14:22:25 +0000 (16:22 +0200)
Building on the previous fix for the audio volume jumps experienced
when switching tracks, this adds a double check that the underlying audio
layer has actually set the volume to the new value. This may fail because
the COMXAudio object it not yet initialised.

If there is a failure, then the volume change is retried in the next
iteration of COMXPlayer::Process().

xbmc/cores/omxplayer/OMXPlayer.cpp
xbmc/cores/omxplayer/OMXPlayerAudio.cpp
xbmc/cores/omxplayer/OMXPlayerAudio.h

index 882c660..6aa8f6c 100644 (file)
@@ -1332,8 +1332,8 @@ void COMXPlayer::Process()
 
     if(m_change_volume && m_CurrentAudio.started)
     {
-      m_omxPlayerAudio.SetCurrentVolume(m_current_mute ? VOLUME_MINIMUM : m_current_volume);
-      m_change_volume = false;
+      if(m_player_audio.SetCurrentVolume(m_current_mute ? VOLUME_MINIMUM : m_current_volume))
+        m_change_volume = false;
     }
 
     // process the packet
index c6ba9c6..4fddae3 100644 (file)
@@ -717,9 +717,9 @@ void OMXPlayerAudio::UnRegisterAudioCallback()
   m_omxAudio.UnRegisterAudioCallback();
 }
 
-void OMXPlayerAudio::SetCurrentVolume(float fVolume)
+bool OMXPlayerAudio::SetCurrentVolume(float fVolume)
 {
-  m_omxAudio.SetCurrentVolume(fVolume);
+  return m_omxAudio.SetCurrentVolume(fVolume);
 }
 
 void OMXPlayerAudio::SetSpeed(int speed)
index 87c6023..cc478c2 100644 (file)
@@ -109,7 +109,7 @@ public:
   void SubmitEOS();
   void  RegisterAudioCallback(IAudioCallback* pCallback);
   void  UnRegisterAudioCallback();
-  void SetCurrentVolume(float fVolume);
+  bool SetCurrentVolume(float fVolume);
   void SetSpeed(int iSpeed);
   int  GetAudioBitrate();
   std::string GetPlayerInfo();