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

Fixed keep-alive and retuning.

This commit is contained in:
Rolf Ahrenberg 2014-11-22 14:56:20 +02:00
parent 4e2e6d0b9b
commit 6d64a8b0a7
3 changed files with 12 additions and 6 deletions

11
rtp.c
View File

@ -48,7 +48,7 @@ void cSatipRtp::Close(void)
}
}
int cSatipRtp::GetHeaderLenght(int lengthP)
int cSatipRtp::GetHeaderLenght(unsigned int lengthP)
{
//debug("cSatipRtp::%s() [device %d]", __FUNCTION__, tunerM.GetId());
unsigned int headerlen = 0;
@ -91,9 +91,14 @@ int cSatipRtp::GetHeaderLenght(int lengthP)
// Update header length
headerlen += (ehl + 1) * (unsigned int)sizeof(uint32_t);
}
// Check for empty payload
if (lengthP == headerlen) {
debug("cSatipRtp::%s(%d): Received empty RTP packet #%d [device %d]", __FUNCTION__, lengthP, seq, tunerM.GetId());
headerlen = -1;
}
// Check that rtp is version 2 and payload contains multiple of TS packet data
if ((v != 2) || (((lengthP - headerlen) % TS_SIZE) != 0) || (bufferM[headerlen] != TS_SYNC_BYTE)) {
debug("cSatipRtp::%s(%d): Received incorrect RTP packet [device %d]", __FUNCTION__, lengthP, tunerM.GetId());
else if ((v != 2) || (((lengthP - headerlen) % TS_SIZE) != 0) || (bufferM[headerlen] != TS_SYNC_BYTE)) {
debug("cSatipRtp::%s(%d): Received incorrect RTP packet #%d v=%d len=%d sync=0x%02X [device %d]", __FUNCTION__, lengthP, seq, v, headerlen, bufferM[headerlen], tunerM.GetId());
headerlen = -1;
}
}

2
rtp.h
View File

@ -23,7 +23,7 @@ private:
time_t lastErrorReportM;
int packetErrorsM;
int sequenceNumberM;
int GetHeaderLenght(int lengthP);
int GetHeaderLenght(unsigned int lengthP);
public:
cSatipRtp(cSatipTunerIf &tunerP, unsigned int bufferLenP);

View File

@ -207,6 +207,7 @@ bool cSatipTuner::Connect(void)
return true;
}
}
streamIdM = -1;
error("Connect failed [device %d]", deviceIdM);
}
@ -412,8 +413,8 @@ bool cSatipTuner::KeepAlive(bool forceP)
keepAliveM.Set(timeoutM);
forceP = true;
}
if (forceP && !isempty(*streamAddrM) && (streamIdM > 0)) {
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
if (forceP && !isempty(*streamAddrM)) {
cString uri = cString::sprintf("rtsp://%s/", *streamAddrM);
if (!rtspM.Options(*uri))
return false;
}