Skip to content
This repository
Browse code

Merge pull request #3367 from FernetMenta/aefixes

ActiveAE: fix opening wrong device after suspend
  • Loading branch information...
commit e8a8f38b8eb745570dd2ac7ee5960ae40c6864e4 2 parents 560146d + 6cd34b9
Rainer Hochecker authored October 03, 2013
15  xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp
@@ -594,10 +594,13 @@ void CActiveAESink::GetDeviceFriendlyName(std::string &device)
594 594
 
595 595
 void CActiveAESink::OpenSink()
596 596
 {
  597
+  // we need a copy of m_device here because ParseDevice and CreateDevice write back
  598
+  // into this variable
  599
+  std::string device = m_device;
597 600
   std::string driver;
598 601
   bool passthrough = AE_IS_RAW(m_requestedFormat.m_dataFormat);
599 602
 
600  
-  CAESinkFactory::ParseDevice(m_device, driver);
  603
+  CAESinkFactory::ParseDevice(device, driver);
601 604
   if (driver.empty() && m_sink)
602 605
     driver = m_sink->GetName();
603 606
 
@@ -608,7 +611,7 @@ void CActiveAESink::OpenSink()
608 611
     std::transform(sinkName.begin(), sinkName.end(), sinkName.begin(), ::toupper);
609 612
   }
610 613
 
611  
-  if (!m_sink || sinkName != driver || !m_sink->IsCompatible(m_requestedFormat, m_device))
  614
+  if (!m_sink || sinkName != driver || !m_sink->IsCompatible(m_requestedFormat, device))
612 615
   {
613 616
     CLog::Log(LOGINFO, "CActiveAE::OpenSink - sink incompatible, re-starting");
614 617
 
@@ -621,16 +624,16 @@ void CActiveAESink::OpenSink()
621 624
     }
622 625
 
623 626
     // get the display name of the device
624  
-    GetDeviceFriendlyName(m_device);
  627
+    GetDeviceFriendlyName(device);
625 628
 
626 629
     // if we already have a driver, prepend it to the device string
627 630
     if (!driver.empty())
628  
-      m_device = driver + ":" + m_device;
  631
+      device = driver + ":" + device;
629 632
 
630 633
     // WARNING: this changes format and does not use passthrough
631 634
     m_sinkFormat = m_requestedFormat;
632  
-    CLog::Log(LOGDEBUG, "CActiveAE::OpenSink - trying to open device %s", m_device.c_str());
633  
-    m_sink = CAESinkFactory::Create(m_device, m_sinkFormat, passthrough);
  635
+    CLog::Log(LOGDEBUG, "CActiveAE::OpenSink - trying to open device %s", device.c_str());
  636
+    m_sink = CAESinkFactory::Create(device, m_sinkFormat, passthrough);
634 637
 
635 638
     if (!m_sink)
636 639
     {

0 notes on commit e8a8f38

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