From: Lars Op den Kamp Date: Thu, 2 Aug 2012 17:14:18 +0000 (+0200) Subject: cec: fixed - delayed source switch time was reset, resulting in an attempt every... X-Git-Tag: upstream/2.2.0~1^2~19^2^2~4 X-Git-Url: https://git.piment-noir.org/?p=deb_libcec.git;a=commitdiff_plain;h=045b2e29de7d187e8586fa3f6b59b9c6470efd31 cec: fixed - delayed source switch time was reset, resulting in an attempt every second until it succeeded --- diff --git a/src/lib/devices/CECBusDevice.h b/src/lib/devices/CECBusDevice.h index 4e21553..d208fd9 100644 --- a/src/lib/devices/CECBusDevice.h +++ b/src/lib/devices/CECBusDevice.h @@ -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 m_unsupportedFeatures; diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index 05f5606..8fc844f 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -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);