signal all waiting threads when receiving an active source message, cache the current...
[deb_libcec.git] / src / lib / implementations / CECCommandHandler.cpp
index 3b0187a1c3edbc1ef6560143bc2cd652470d5b84..5a2afb17143d9d95314de110a2068f1f95cc7ba1 100644 (file)
@@ -209,12 +209,13 @@ int CCECCommandHandler::HandleActiveSource(const cec_command &command)
   if (command.parameters.size == 2)
   {
     uint16_t iAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
+    m_processor->GetDevices()->SetActiveSource(iAddress);
     CCECBusDevice *device = m_processor->GetDeviceByPhysicalAddress(iAddress);
     if (device)
-    {
       device->MarkAsActiveSource();
-      return COMMAND_HANDLED;
-    }
+
+    m_processor->GetDevices()->SignalAll(command.opcode);
+    return COMMAND_HANDLED;
   }
 
   return CEC_ABORT_REASON_INVALID_OPERAND;