cec: fixed - delayed source switch time was reset, resulting in an attempt every...
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 2 Aug 2012 17:14:18 +0000 (19:14 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 2 Aug 2012 17:14:18 +0000 (19:14 +0200)
src/lib/devices/CECBusDevice.h
src/lib/implementations/CECCommandHandler.cpp

index 4e21553997212b7276d881ddf5bc3c9efc857242..d208fd933d44bd94b7e6f6c944cff79e2e1fbdb8 100644 (file)
@@ -266,8 +266,8 @@ namespace CEC
     bool                  m_bReplaceHandler;
     cec_menu_state        m_menuState;
     bool                  m_bActiveSource;
-    uint64_t              m_iLastActive;
-    uint64_t              m_iLastPowerStateUpdate;
+    int64_t               m_iLastActive;
+    int64_t               m_iLastPowerStateUpdate;
     cec_version           m_cecVersion;
     cec_bus_device_status m_deviceStatus;
     std::set<cec_opcode>  m_unsupportedFeatures;
index 05f5606b93b50fd5032a13e6a63fc7f766f5bc39..8fc844fca9a4629055bf947d3dbfc96db2889c41 100644 (file)
@@ -1114,9 +1114,6 @@ bool CCECCommandHandler::ActivateSource(bool bTransmitDelayedCommandsOnly /* = f
 
         LIB_CEC->AddLog(CEC_LOG_DEBUG, "transmitting delayed activate source command");
       }
-
-      // clear previous pending active source command
-      m_iActiveSourcePending = 0;
     }
 
     // update the power state and menu state
@@ -1155,10 +1152,14 @@ bool CCECCommandHandler::ActivateSource(bool bTransmitDelayedCommandsOnly /* = f
     if (bActiveSourceFailed || !bSourceSwitchAllowed)
     {
       LIB_CEC->AddLog(CEC_LOG_DEBUG, "failed to make '%s' the active source. will retry later", m_busDevice->GetLogicalAddressName());
-      CLockObject lock(m_mutex);
-      m_iActiveSourcePending = GetTimeMs() + (int64_t)CEC_ACTIVE_SOURCE_SWITCH_RETRY_TIME_MS;
       return false;
     }
+    else
+    {
+      CLockObject lock(m_mutex);
+      // clear previous pending active source command
+      m_iActiveSourcePending = 0;
+    }
 
     // mark the handler as initialised
     CLockObject lock(m_mutex);