ActiveAE: some fixes to mode optimized
authorRainer Hochecker <fernetmenta@online.de>
Mon, 11 Nov 2013 14:29:39 +0000 (15:29 +0100)
committerRainer Hochecker <fernetmenta@online.de>
Mon, 11 Nov 2013 14:29:39 +0000 (15:29 +0100)
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp

index fa2328f..20fd56e 100644 (file)
@@ -1300,13 +1300,10 @@ void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &sett
     // consider user channel layout for those cases
     // 1. input stream is multichannel
     // 2. stereo upmix is selected
-    // 3. already playing > 2 channels and "audiophile" is not set
-    //    this is the case if e.g. a stream changes config from 5.1 to 2.0
-    //    which would cause a short audio drop-out if we changed the sink
+    // 3. fixed mode
     if ((format.m_channelLayout.Count() > 2) ||
          settings.stereoupmix ||
-         (settings.config == AE_CONFIG_FIXED) ||
-         (m_stats.GetWaterLevel() > 0 && m_internalFormat.m_channelLayout.Count() > 2 && (settings.config != AE_CONFIG_MATCH)))
+         (settings.config == AE_CONFIG_FIXED))
     {
       CAEChannelInfo stdLayout;
       switch (settings.channels)
@@ -1325,10 +1322,16 @@ void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &sett
         case 10: stdLayout = AE_CH_LAYOUT_7_1; break;
       }
 
-      if (m_settings.config == AE_CONFIG_MATCH)
-        format.m_channelLayout.ResolveChannels(stdLayout);
-      else
+      if (m_settings.config == AE_CONFIG_FIXED)
         format.m_channelLayout = stdLayout;
+      else
+        format.m_channelLayout.ResolveChannels(stdLayout);;
+    }
+    // don't change from multi to stereo in AUTO mode
+    else if ((settings.config == AE_CONFIG_AUTO) &&
+              m_stats.GetWaterLevel() > 0 && m_internalFormat.m_channelLayout.Count() > 2)
+    {
+      format.m_channelLayout = m_internalFormat.m_channelLayout;
     }
 
     if (m_sink.GetDeviceType(m_settings.device) == AE_DEVTYPE_IEC958)
@@ -1994,7 +1997,7 @@ void CActiveAE::LoadSettings()
   m_settings.channels = CSettings::Get().GetInt("audiooutput.channels");
   m_settings.samplerate = CSettings::Get().GetInt("audiooutput.samplerate");
 
-  m_settings.stereoupmix = CSettings::Get().GetBool("audiooutput.stereoupmix");
+  m_settings.stereoupmix = (m_settings.channels > AE_CH_LAYOUT_2_0) ? CSettings::Get().GetBool("audiooutput.stereoupmix") : false;
   m_settings.normalizelevels = CSettings::Get().GetBool("audiooutput.normalizelevels");
 
   m_settings.passthrough = m_settings.config == AE_CONFIG_FIXED ? false : CSettings::Get().GetBool("audiooutput.passthrough");