1
0
mirror of https://github.com/rofafor/vdr-plugin-satip.git synced 2023-10-10 13:37:42 +02:00

Added a double check for the idle release.

This commit is contained in:
Rolf Ahrenberg 2015-05-23 15:28:37 +03:00
parent 6384b8694e
commit 4e2535a7e2
2 changed files with 11 additions and 8 deletions

16
tuner.c
View File

@ -29,7 +29,6 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
nextServerM(NULL, deviceP.GetId(), 0),
mutexM(),
reConnectM(),
idleReleaseM(),
keepAliveM(),
statusUpdateM(),
pidUpdateCacheM(),
@ -92,8 +91,10 @@ cSatipTuner::~cSatipTuner()
void cSatipTuner::Action(void)
{
debug1("%s Entering [device %d]", __PRETTY_FUNCTION__, deviceIdM);
bool lastIdleStatus = false;
cTimeMs idleCheck(eIdleCheckTimeoutMs);
reConnectM.Set(eConnectTimeoutMs);
idleReleaseM.Set(eIdleTimeoutMs);
// Do the thread loop
while (Running()) {
UpdateCurrentState();
@ -118,7 +119,8 @@ void cSatipTuner::Action(void)
case tsTuned:
debug4("%s: tsTuned [device %d]", __PRETTY_FUNCTION__, deviceIdM);
reConnectM.Set(eConnectTimeoutMs);
idleReleaseM.Set(eIdleTimeoutMs);
idleCheck.Set(eIdleCheckTimeoutMs);
lastIdleStatus = false;
// Read reception statistics via DESCRIBE and RTCP
if (hasLockM || ReadReceptionStatus()) {
// Quirk for devices without valid reception data
@ -148,12 +150,14 @@ void cSatipTuner::Action(void)
RequestState(tsSet, smInternal);
break;
}
if (idleReleaseM.TimedOut()) {
idleReleaseM.Set(eIdleTimeoutMs);
if (deviceM->IsIdle()) {
if (idleCheck.TimedOut()) {
bool currentIdleStatus = deviceM->IsIdle();
if (lastIdleStatus && currentIdleStatus) {
info("Idle timeout - releasing [device %d]", deviceIdM);
RequestState(tsRelease, smInternal);
}
lastIdleStatus = currentIdleStatus;
idleCheck.Set(eIdleCheckTimeoutMs);
break;
}
break;

View File

@ -83,7 +83,7 @@ private:
eStatusUpdateTimeoutMs = 1000, // in milliseconds
ePidUpdateIntervalMs = 250, // in milliseconds
eConnectTimeoutMs = 5000, // in milliseconds
eIdleTimeoutMs = 30000, // in milliseconds
eIdleCheckTimeoutMs = 15000, // in milliseconds
eMinKeepAliveIntervalMs = 30000 // in milliseconds
};
enum eTunerState { tsIdle, tsRelease, tsSet, tsTuned, tsLocked };
@ -101,7 +101,6 @@ private:
cSatipTunerServer nextServerM;
cMutex mutexM;
cTimeMs reConnectM;
cTimeMs idleReleaseM;
cTimeMs keepAliveM;
cTimeMs statusUpdateM;
cTimeMs pidUpdateCacheM;