From 40d280af10565794e0233bb55d800acdbf526814 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Tue, 25 Mar 2014 21:29:57 +0200 Subject: [PATCH] Fixed pid leaking while disabling section filters, EIT filter defition and RTP sequence overflow detection. --- HISTORY | 1 + common.c | 14 ++++++-------- common.h | 2 +- device.c | 7 ++++--- po/de_DE.po | 10 ++-------- po/fi_FI.po | 10 ++-------- socket.c | 9 +++++++-- 7 files changed, 23 insertions(+), 30 deletions(-) diff --git a/HISTORY b/HISTORY index cd203eb..2a72cea 100644 --- a/HISTORY +++ b/HISTORY @@ -23,3 +23,4 @@ VDR Plugin 'satip' Revision History 2014-xx-xx: Version 0.2.0 - Added support for cDevice::Ready(). +- Fixed pid leaking while disabling section filters. diff --git a/common.c b/common.c index 9c5ce3f..41dc4c2 100644 --- a/common.c +++ b/common.c @@ -70,12 +70,10 @@ cString ChangeCase(const cString &strP, bool upperP) const section_filter_table_type section_filter_table[SECTION_FILTER_TABLE_SIZE] = { - /* description tag pid tid mask */ - {trNOOP("PAT (0x00)"), "PAT", 0x00, 0x00, 0xFF}, - {trNOOP("NIT (0x40)"), "NIT", 0x10, 0x40, 0xFF}, - {trNOOP("SDT (0x42)"), "SDT", 0x11, 0x42, 0xFF}, - {trNOOP("EIT (0x4E/0x4F)"), "EIT", 0x12, 0x4E, 0xFE}, - {trNOOP("EIT (0x5X)"), "EIT", 0x12, 0x50, 0xF0}, - {trNOOP("EIT (0x6X)"), "EIT", 0x12, 0x60, 0xF0}, - {trNOOP("TDT (0x70)"), "TDT", 0x14, 0x70, 0xFF}, + /* description tag pid tid mask */ + {trNOOP("PAT (0x00)"), "PAT", 0x00, 0x00, 0xFF}, + {trNOOP("NIT (0x40)"), "NIT", 0x10, 0x40, 0xFF}, + {trNOOP("SDT (0x42)"), "SDT", 0x11, 0x42, 0xFF}, + {trNOOP("EIT (0x4E/0x4F/0x5X/0x6X)"), "EIT", 0x12, 0x40, 0xC0}, + {trNOOP("TDT (0x70)"), "TDT", 0x14, 0x70, 0xFF}, }; diff --git a/common.h b/common.h index 06a98bb..7c51e91 100644 --- a/common.h +++ b/common.h @@ -36,7 +36,7 @@ #define SATIP_STATS_ACTIVE_PIDS_COUNT 10 #define SATIP_STATS_ACTIVE_FILTERS_COUNT 10 -#define SECTION_FILTER_TABLE_SIZE 7 +#define SECTION_FILTER_TABLE_SIZE 5 #define SATIP_CURL_EASY_GETINFO(X, Y, Z) \ if ((res = curl_easy_getinfo((X), (Y), (Z))) != CURLE_OK) { \ diff --git a/device.c b/device.c index b24f699..09055ab 100644 --- a/device.c +++ b/device.c @@ -306,11 +306,12 @@ bool cSatipDevice::SetPid(cPidHandle *handleP, int typeP, bool onP) int cSatipDevice::OpenFilter(u_short pidP, u_char tidP, u_char maskP) { - //debug("cSatipDevice::%s(%u): pid=%d tid=%d mask=%d", __FUNCTION__, deviceIndexM, pidP, tidP, maskP); + //debug("cSatipDevice::%s(%u): pid=%d tid=%d mask=%d", __FUNCTION__, deviceIndexM, pidP, tidP, maskP); if (pSectionFilterHandlerM) { - if (pTunerM) + int handle = pSectionFilterHandlerM->Open(pidP, tidP, maskP); + if (pTunerM && (handle >= 0)) pTunerM->SetPid(pidP, ptOther, true); - return pSectionFilterHandlerM->Open(pidP, tidP, maskP); + return handle; } return -1; } diff --git a/po/de_DE.po b/po/de_DE.po index a3dbb6e..68fdea6 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -25,14 +25,8 @@ msgstr "NIT (0x40)" msgid "SDT (0x42)" msgstr "SDT (0x42)" -msgid "EIT (0x4E/0x4F)" -msgstr "EIT (0x4E/0x4F)" - -msgid "EIT (0x5X)" -msgstr "EIT (0x5X)" - -msgid "EIT (0x6X)" -msgstr "EIT (0x6X)" +msgid "EIT (0x4E/0x4F/0x5X/0x6X)" +msgstr "EIT (0x4E/0x4F/0x5X/0x6X)" msgid "TDT (0x70)" msgstr "TDT (0x70)" diff --git a/po/fi_FI.po b/po/fi_FI.po index b3c7b95..83d90ed 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -25,14 +25,8 @@ msgstr "NIT (0x40)" msgid "SDT (0x42)" msgstr "SDT (0x42)" -msgid "EIT (0x4E/0x4F)" -msgstr "EIT (0x4E/0x4F)" - -msgid "EIT (0x5X)" -msgstr "EIT (0x5X)" - -msgid "EIT (0x6X)" -msgstr "EIT (0x6X)" +msgid "EIT (0x4E/0x4F/0x5X/0x6X)" +msgstr "EIT (0x4E/0x4F/0x5X/0x6X)" msgid "TDT (0x70)" msgstr "TDT (0x70)" diff --git a/socket.c b/socket.c index bd79e58..d3f5e35 100644 --- a/socket.c +++ b/socket.c @@ -154,9 +154,14 @@ int cSatipSocket::ReadVideo(unsigned char *bufferAddrP, unsigned int bufferLenP) //unsigned int pt = bufferAddrP[1] & 0x7F; // Sequence number int seq = ((bufferAddrP[2] & 0xFF) << 8) | (bufferAddrP[3] & 0xFF); - if ((sequenceNumberM >= 0) && (((sequenceNumberM + 1) % 0xFFFF) != seq)) + if ((((sequenceNumberM + 1) % 0xFFFF) == 0) && (seq == 0xFFFF)) + sequenceNumberM = -1; + else if ((sequenceNumberM >= 0) && (((sequenceNumberM + 1) % 0xFFFF) != seq)) { error("missed %d RTP packets", seq - sequenceNumberM - 1); - sequenceNumberM = seq; + sequenceNumberM = seq; + } + else + sequenceNumberM = seq; // Header lenght unsigned int headerlen = (3 + cc) * (unsigned int)sizeof(uint32_t); // Check if extension