fixed - update the active source status correct on stream path changes
authorLars Op den Kamp <lars@opdenkamp.eu>
Wed, 14 Nov 2012 01:21:34 +0000 (02:21 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Wed, 14 Nov 2012 01:21:34 +0000 (02:21 +0100)
src/lib/implementations/CECCommandHandler.cpp

index ad2488750b129cbe784fa3f186757d3cf46f47d0..3423c283b1960195a2ffb5f9bb3988ef2fe2b353 100644 (file)
@@ -573,11 +573,21 @@ int CCECCommandHandler::HandleSetStreamPath(const cec_command &command)
 
     /* one of the device handled by libCEC has been made active */
     CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamAddress);
-    if (device && device->IsHandledByLibCEC())
+    if (device)
     {
-      device->ActivateSource();
+      if (device->IsHandledByLibCEC())
+        device->ActivateSource();
+      else
+        device->MarkAsActiveSource();
       return COMMAND_HANDLED;
     }
+    else
+    {
+      cec_logical_address previousSource = m_processor->GetActiveSource(false);
+      CCECBusDevice* device = m_processor->GetDevice(previousSource);
+      if (device && device->GetCurrentPhysicalAddress() != iStreamAddress)
+        device->MarkAsInactiveSource();
+    }
   }
 
   return CEC_ABORT_REASON_INVALID_OPERAND;