[osx/coreaudio] - suppress default output device changed callbacks for 2 seconds...
authorMemphiz <memphis@machzwo.de>
Wed, 2 Jul 2014 18:06:27 +0000 (20:06 +0200)
committerMemphiz <memphis@machzwo.de>
Sun, 20 Jul 2014 15:52:59 +0000 (17:52 +0200)
xbmc/cores/AudioEngine/Sinks/osx/CoreAudioStream.cpp

index cfa4cbd..4064702 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "CoreAudioStream.h"
+#include "CoreAudioDevice.h"
 
 #include "CoreAudioHelpers.h"
 #include "utils/log.h"
@@ -212,6 +213,13 @@ bool CCoreAudioStream::SetVirtualFormat(AudioStreamBasicDescription* pDesc)
 
   std::string formatString;
 
+  // suppress callbacks for the default output device change
+  // for the next 2 seconds because setting format
+  // might trigger a change (when setting/unsetting an encoded
+  // passthrough format)
+  CCoreAudioDevice::SuppressDefaultOutputDeviceCB(2000);
+
+
   if (!m_OriginalVirtualFormat.mFormatID)
   {
     // Store the original format (as we found it) so that it can be restored later
@@ -292,6 +300,12 @@ bool CCoreAudioStream::SetPhysicalFormat(AudioStreamBasicDescription* pDesc)
 
   std::string formatString;
 
+  // suppress callbacks for the default output device change
+  // for the next 2 seconds because setting format
+  // might trigger a change (when setting/unsetting an encoded
+  // passthrough format)
+  CCoreAudioDevice::SuppressDefaultOutputDeviceCB(2000);
+
   if (!m_OriginalPhysicalFormat.mFormatID)
   {
     // Store the original format (as we found it) so that it can be restored later