mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 13:37:42 +02:00
Added a timeout for releasing idling devices.
This commit is contained in:
parent
6c4c8a10b7
commit
6384b8694e
4
HISTORY
4
HISTORY
@ -137,3 +137,7 @@ VDR Plugin 'satip' Revision History
|
|||||||
interface.
|
interface.
|
||||||
- Added new ATTA and DETA SVDRP commands.
|
- Added new ATTA and DETA SVDRP commands.
|
||||||
- Set the default device count to two.
|
- Set the default device count to two.
|
||||||
|
|
||||||
|
2015-xx-xx: Version 2.2.3
|
||||||
|
|
||||||
|
- Added a timeout for releasing idling devices.
|
||||||
|
5
device.c
5
device.c
@ -460,6 +460,11 @@ int cSatipDevice::GetCISlot(void)
|
|||||||
return slot;
|
return slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cSatipDevice::IsIdle(void)
|
||||||
|
{
|
||||||
|
return !Receiving();
|
||||||
|
}
|
||||||
|
|
||||||
uchar *cSatipDevice::GetData(int *availableP)
|
uchar *cSatipDevice::GetData(int *availableP)
|
||||||
{
|
{
|
||||||
debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||||
|
1
device.h
1
device.h
@ -110,6 +110,7 @@ public:
|
|||||||
virtual int GetId(void);
|
virtual int GetId(void);
|
||||||
virtual int GetPmtPid(void);
|
virtual int GetPmtPid(void);
|
||||||
virtual int GetCISlot(void);
|
virtual int GetCISlot(void);
|
||||||
|
virtual bool IsIdle(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __SATIP_DEVICE_H
|
#endif // __SATIP_DEVICE_H
|
||||||
|
@ -16,6 +16,7 @@ public:
|
|||||||
virtual int GetId(void) = 0;
|
virtual int GetId(void) = 0;
|
||||||
virtual int GetPmtPid(void) = 0;
|
virtual int GetPmtPid(void) = 0;
|
||||||
virtual int GetCISlot(void) = 0;
|
virtual int GetCISlot(void) = 0;
|
||||||
|
virtual bool IsIdle(void) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cSatipDeviceIf(const cSatipDeviceIf&);
|
cSatipDeviceIf(const cSatipDeviceIf&);
|
||||||
|
2
satip.c
2
satip.c
@ -27,7 +27,7 @@
|
|||||||
#define GITVERSION ""
|
#define GITVERSION ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char VERSION[] = "2.2.2" GITVERSION;
|
const char VERSION[] = "2.2.3" GITVERSION;
|
||||||
static const char DESCRIPTION[] = trNOOP("SAT>IP Devices");
|
static const char DESCRIPTION[] = trNOOP("SAT>IP Devices");
|
||||||
|
|
||||||
class cPluginSatip : public cPlugin {
|
class cPluginSatip : public cPlugin {
|
||||||
|
11
tuner.c
11
tuner.c
@ -29,6 +29,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
|
|||||||
nextServerM(NULL, deviceP.GetId(), 0),
|
nextServerM(NULL, deviceP.GetId(), 0),
|
||||||
mutexM(),
|
mutexM(),
|
||||||
reConnectM(),
|
reConnectM(),
|
||||||
|
idleReleaseM(),
|
||||||
keepAliveM(),
|
keepAliveM(),
|
||||||
statusUpdateM(),
|
statusUpdateM(),
|
||||||
pidUpdateCacheM(),
|
pidUpdateCacheM(),
|
||||||
@ -92,6 +93,7 @@ void cSatipTuner::Action(void)
|
|||||||
{
|
{
|
||||||
debug1("%s Entering [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
debug1("%s Entering [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
reConnectM.Set(eConnectTimeoutMs);
|
reConnectM.Set(eConnectTimeoutMs);
|
||||||
|
idleReleaseM.Set(eIdleTimeoutMs);
|
||||||
// Do the thread loop
|
// Do the thread loop
|
||||||
while (Running()) {
|
while (Running()) {
|
||||||
UpdateCurrentState();
|
UpdateCurrentState();
|
||||||
@ -116,6 +118,7 @@ void cSatipTuner::Action(void)
|
|||||||
case tsTuned:
|
case tsTuned:
|
||||||
debug4("%s: tsTuned [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
debug4("%s: tsTuned [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
reConnectM.Set(eConnectTimeoutMs);
|
reConnectM.Set(eConnectTimeoutMs);
|
||||||
|
idleReleaseM.Set(eIdleTimeoutMs);
|
||||||
// Read reception statistics via DESCRIBE and RTCP
|
// Read reception statistics via DESCRIBE and RTCP
|
||||||
if (hasLockM || ReadReceptionStatus()) {
|
if (hasLockM || ReadReceptionStatus()) {
|
||||||
// Quirk for devices without valid reception data
|
// Quirk for devices without valid reception data
|
||||||
@ -145,6 +148,14 @@ void cSatipTuner::Action(void)
|
|||||||
RequestState(tsSet, smInternal);
|
RequestState(tsSet, smInternal);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (idleReleaseM.TimedOut()) {
|
||||||
|
idleReleaseM.Set(eIdleTimeoutMs);
|
||||||
|
if (deviceM->IsIdle()) {
|
||||||
|
info("Idle timeout - releasing [device %d]", deviceIdM);
|
||||||
|
RequestState(tsRelease, smInternal);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error("Unknown tuner status %d [device %d]", currentStateM, deviceIdM);
|
error("Unknown tuner status %d [device %d]", currentStateM, deviceIdM);
|
||||||
|
2
tuner.h
2
tuner.h
@ -83,6 +83,7 @@ private:
|
|||||||
eStatusUpdateTimeoutMs = 1000, // in milliseconds
|
eStatusUpdateTimeoutMs = 1000, // in milliseconds
|
||||||
ePidUpdateIntervalMs = 250, // in milliseconds
|
ePidUpdateIntervalMs = 250, // in milliseconds
|
||||||
eConnectTimeoutMs = 5000, // in milliseconds
|
eConnectTimeoutMs = 5000, // in milliseconds
|
||||||
|
eIdleTimeoutMs = 30000, // in milliseconds
|
||||||
eMinKeepAliveIntervalMs = 30000 // in milliseconds
|
eMinKeepAliveIntervalMs = 30000 // in milliseconds
|
||||||
};
|
};
|
||||||
enum eTunerState { tsIdle, tsRelease, tsSet, tsTuned, tsLocked };
|
enum eTunerState { tsIdle, tsRelease, tsSet, tsTuned, tsLocked };
|
||||||
@ -100,6 +101,7 @@ private:
|
|||||||
cSatipTunerServer nextServerM;
|
cSatipTunerServer nextServerM;
|
||||||
cMutex mutexM;
|
cMutex mutexM;
|
||||||
cTimeMs reConnectM;
|
cTimeMs reConnectM;
|
||||||
|
cTimeMs idleReleaseM;
|
||||||
cTimeMs keepAliveM;
|
cTimeMs keepAliveM;
|
||||||
cTimeMs statusUpdateM;
|
cTimeMs statusUpdateM;
|
||||||
cTimeMs pidUpdateCacheM;
|
cTimeMs pidUpdateCacheM;
|
||||||
|
Loading…
Reference in New Issue
Block a user