cec: fixed handling of CEC_OPCODE_SET_STREAM_PATH
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 10 Nov 2011 17:30:00 +0000 (18:30 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 10 Nov 2011 18:00:37 +0000 (19:00 +0100)
src/lib/CECProcessor.cpp
src/lib/implementations/CECCommandHandler.cpp

index 53a1da3405e7e3a1c4b5a41a39444fda83c58d75..6259dae8ef0d6e116035e7f509479a09a3a50373 100644 (file)
@@ -298,15 +298,15 @@ bool CCECProcessor::SetActiveView(void)
     return bReturn;
 
   if (!m_logicalAddresses.empty() && m_busDevices[m_logicalAddresses.primary])
-  {
-    SetStreamPath(m_busDevices[m_logicalAddresses.primary]->GetPhysicalAddress());
-    bReturn = m_busDevices[m_logicalAddresses.primary]->TransmitActiveSource();
-  }
-  return false;
+    bReturn = SetStreamPath(m_busDevices[m_logicalAddresses.primary]->GetPhysicalAddress());
+
+  return bReturn;
 }
 
 bool CCECProcessor::SetStreamPath(uint16_t iStreamPath)
 {
+  bool bReturn(false);
+
   CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamPath);
   if (device)
   {
@@ -314,10 +314,14 @@ bool CCECProcessor::SetStreamPath(uint16_t iStreamPath)
       m_busDevices[iPtr]->m_bActiveSource = false;
 
     device->m_bActiveSource = true;
-    return true;
+
+    if (m_logicalAddresses.isset(device->m_iLogicalAddress))
+      bReturn = device->TransmitActiveSource();
+    else
+      bReturn = true;
   }
 
-  return false;
+  return bReturn;
 }
 
 bool CCECProcessor::SetInactiveView(void)
index e9b0a79c2b86910dd1b5ab2a9a5b0c409deed68d..2db0c7232ba96301919baa8a675885753562ad77 100644 (file)
@@ -341,11 +341,10 @@ bool CCECCommandHandler::HandleSetStreamPath(const cec_command &command)
   {
     int streamaddr = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
     CStdString strLog;
-    strLog.Format(">> %i requests stream path from physical address %04x", command.initiator, streamaddr);
+    strLog.Format(">> %i sets stream path to physical address %04x", command.initiator, streamaddr);
     m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str());
-    CCECBusDevice *device = GetDeviceByPhysicalAddress(streamaddr);
-    if (device)
-      return device->TransmitActiveSource();
+
+    return m_busDevice->GetProcessor()->SetStreamPath(streamaddr);
   }
   return true;
 }