diff --git a/tuner.c b/tuner.c index cd8366b..be7b392 100644 --- a/tuner.c +++ b/tuner.c @@ -41,7 +41,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP) currentStateM(tsIdle), internalStateM(), externalStateM(), - timeoutM(eMinKeepAliveIntervalMs), + timeoutM(eMinKeepAliveIntervalMs - eKeepAlivePreBufferMs), hasLockM(false), signalStrengthDBmM(0.0), signalStrengthM(-1), @@ -284,7 +284,7 @@ bool cSatipTuner::Disconnect(void) currentServerM.Detach(); statusUpdateM.Set(0); - timeoutM = eMinKeepAliveIntervalMs; + timeoutM = eMinKeepAliveIntervalMs - eKeepAlivePreBufferMs; pmtPidM = -1; addPidsM.Clear(); delPidsM.Clear(); @@ -393,6 +393,7 @@ void cSatipTuner::SetSessionTimeout(const char *sessionP, int timeoutP) if (nextServerM.IsQuirk(cSatipServer::eSatipQuirkSessionId) && !isempty(*sessionM) && startswith(*sessionM, "0")) rtspM.SetSession(SkipZeroes(*sessionM)); timeoutM = (timeoutP > eMinKeepAliveIntervalMs) ? timeoutP : eMinKeepAliveIntervalMs; + timeoutM -= eKeepAlivePreBufferMs; } void cSatipTuner::SetupTransport(int rtpPortP, int rtcpPortP, const char *streamAddrP, const char *sourceAddrP) diff --git a/tuner.h b/tuner.h index c0232df..c728b89 100644 --- a/tuner.h +++ b/tuner.h @@ -89,6 +89,7 @@ private: eIdleCheckTimeoutMs = 15000, // in milliseconds eTuningTimeoutMs = 20000, // in milliseconds eMinKeepAliveIntervalMs = 30000, // in milliseconds + eKeepAlivePreBufferMs = 2000, // in milliseconds eSetupTimeoutMs = 2000 // in milliseconds }; enum eTunerState { tsIdle, tsRelease, tsSet, tsTuned, tsLocked };