ActiveAE: try other sinks in case of create fails
authorRainer Hochecker <fernetmenta@online.de>
Tue, 14 Jan 2014 08:46:07 +0000 (09:46 +0100)
committerRainer Hochecker <fernetmenta@online.de>
Wed, 15 Jan 2014 08:58:18 +0000 (09:58 +0100)
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp

index d921846..55e2ca9 100644 (file)
@@ -657,6 +657,29 @@ void CActiveAESink::OpenSink()
   CLog::Log(LOGDEBUG, "CActiveAESink::OpenSink - trying to open device %s", device.c_str());
   m_sink = CAESinkFactory::Create(device, m_sinkFormat, passthrough);
 
+  // try first device in out list
+  if (!m_sink && !m_sinkInfoList.empty())
+  {
+    driver = m_sinkInfoList.front().m_sinkName;
+    device = m_sinkInfoList.front().m_deviceInfoList.front().m_deviceName;
+    GetDeviceFriendlyName(device);
+    if (!driver.empty())
+      device = driver + ":" + device;
+    m_sinkFormat = m_requestedFormat;
+    CLog::Log(LOGDEBUG, "CActiveAESink::OpenSink - trying to open device %s", device.c_str());
+    m_sink = CAESinkFactory::Create(device, m_sinkFormat, passthrough);
+  }
+
+  // open NULL sink
+  // TODO: should not be required by ActiveAE
+  if (!m_sink)
+  {
+    device = "NULL:NULL";
+    m_sinkFormat = m_requestedFormat;
+    CLog::Log(LOGDEBUG, "CActiveAESink::OpenSink - open NULL sink");
+    m_sink = CAESinkFactory::Create(device, m_sinkFormat, passthrough);
+  }
+
   if (!m_sink)
   {
     CLog::Log(LOGERROR, "CActiveAESink::OpenSink - no sink was returned");