Fixed keepalive heartbeat.

This commit is contained in:
Rolf Ahrenberg 2014-03-27 23:27:38 +02:00
parent e7a74f3ad4
commit b5ec84fd91
5 changed files with 22 additions and 17 deletions

View File

@ -20,7 +20,8 @@ VDR Plugin 'satip' Revision History
- Fixed EIT scan functionality.
- Updated for vdr-2.1.6.
2014-xx-xx: Version 0.2.0
2014-03-28: Version 0.2.0
- Added support for cDevice::Ready().
- Fixed pid leaking while disabling section filters.
- Fixed keepalive heartbeat.

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-satip 0.2.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-03-16 03:16+0200\n"
"PO-Revision-Date: 2014-03-16 03:16+0200\n"
"POT-Creation-Date: 2014-03-28 03:28+0200\n"
"PO-Revision-Date: 2014-03-28 03:28+0200\n"
"Last-Translator: Frank Neumann <fnu@yavdr.org>\n"
"Language-Team: German <vdr@linuxtv.org>\n"
"Language: de\n"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-satip 0.2.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-03-16 03:16+0200\n"
"PO-Revision-Date: 2014-03-16 03:16+0200\n"
"POT-Creation-Date: 2014-03-28 03:28+0200\n"
"PO-Revision-Date: 2014-03-28 03:28+0200\n"
"Last-Translator: Rolf Ahrenberg\n"
"Language-Team: Finnish <vdr@linuxtv.org>\n"
"Language: fi\n"

19
tuner.c
View File

@ -27,7 +27,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
keepAliveM(),
pidUpdateCacheM(),
sessionM(),
timeoutM(eKeepAliveIntervalMs),
timeoutM(eDefKeepAliveIntervalMs),
openedM(false),
tunedM(false),
hasLockM(false),
@ -183,7 +183,6 @@ bool cSatipTuner::Connect(void)
// Flush any old content
if (rtpSocketM)
rtpSocketM->Flush();
keepAliveM.Set(eKeepAliveIntervalMs);
return true;
}
@ -229,6 +228,7 @@ bool cSatipTuner::Connect(void)
}
// Request server options: "&pids=all" for the whole mux
keepAliveM.Set(timeoutM);
uri = cString::sprintf("rtsp://%s/?%s&pids=0", *streamAddrM, *streamParamM);
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_OPTIONS);
@ -253,7 +253,6 @@ bool cSatipTuner::Connect(void)
if (!ValidateLatestResponse())
return false;
keepAliveM.Set(eKeepAliveIntervalMs);
tunedM = true;
if (nextServerM) {
cSatipDiscover::GetInstance()->UseServer(nextServerM, true);
@ -305,6 +304,7 @@ bool cSatipTuner::Disconnect(void)
if (currentServerM)
cSatipDiscover::GetInstance()->UseServer(currentServerM, false);
tunedM = false;
timeoutM = eDefKeepAliveIntervalMs;
return true;
}
@ -383,7 +383,12 @@ void cSatipTuner::SetSessionTimeout(const char *sessionP, int timeoutP)
cMutexLock MutexLock(&mutexM);
debug("cSatipTuner::%s(%s, %d)", __FUNCTION__, sessionP, timeoutP);
sessionM = sessionP;
timeoutM = timeoutP > 0 ? timeoutP * 1000L : eKeepAliveIntervalMs;
if (timeoutP > 30)
timeoutM = timeoutP * 1000L;
else if (timeoutP > 0)
timeoutM = eMinKeepAliveIntervalMs;
else
timeoutM = eDefKeepAliveIntervalMs;
}
bool cSatipTuner::SetSource(cSatipServer *serverP, const char *parameterP, const int indexP)
@ -439,10 +444,8 @@ bool cSatipTuner::UpdatePids(void)
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_PLAY);
SATIP_CURL_EASY_PERFORM(handleM);
if (ValidateLatestResponse()) {
keepAliveM.Set(eKeepAliveIntervalMs);
if (ValidateLatestResponse())
pidUpdatedM = false;
}
else
Disconnect();
@ -464,7 +467,7 @@ bool cSatipTuner::KeepAlive(void)
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_OPTIONS);
SATIP_CURL_EASY_PERFORM(handleM);
if (ValidateLatestResponse())
keepAliveM.Set(eKeepAliveIntervalMs);
keepAliveM.Set(timeoutM);
else
Disconnect();

View File

@ -26,10 +26,11 @@
class cSatipTuner : public cThread, public cSatipTunerStatistics {
private:
enum {
eConnectTimeoutMs = 1500, // in milliseconds
ePidUpdateIntervalMs = 100, // in milliseconds
eReConnectTimeoutMs = 5000, // in milliseconds
eKeepAliveIntervalMs = 600000 // in milliseconds
eConnectTimeoutMs = 1500, // in milliseconds
ePidUpdateIntervalMs = 100, // in milliseconds
eReConnectTimeoutMs = 5000, // in milliseconds
eMinKeepAliveIntervalMs = 300000, // in milliseconds
eDefKeepAliveIntervalMs = 600000 // in milliseconds
};
static size_t HeaderCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP);