X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fimplementations%2FCECCommandHandler.cpp;h=08bc528430cb81b184dd60a3b59b5c025f211c32;hb=085df3099c0067ae6ccb5638718f34a30bf04e48;hp=cf0984b02f0a862d5df4dbb010b47351952d119c;hpb=05529b92cea31f5194afe1a675d6898bda9584f9;p=deb_libcec.git diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index cf0984b..08bc528 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -1174,9 +1174,10 @@ 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()); + int64_t now(GetTimeMs()); CLockObject lock(m_mutex); - if (m_iActiveSourcePending == 0) - m_iActiveSourcePending = GetTimeMs() + (int64_t)CEC_ACTIVE_SOURCE_SWITCH_RETRY_TIME_MS; + if (m_iActiveSourcePending == 0 || m_iActiveSourcePending < now) + m_iActiveSourcePending = now + (int64_t)CEC_ACTIVE_SOURCE_SWITCH_RETRY_TIME_MS; return false; } else