From 74761da04aaef2ad186b2ef29f0bffc13683334c Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Tue, 17 Mar 2009 17:37:05 +0200 Subject: [PATCH] Fixed a locking bug with section filters. --- HISTORY | 1 + device.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/HISTORY b/HISTORY index 18fbac5..7a68504 100644 --- a/HISTORY +++ b/HISTORY @@ -98,3 +98,4 @@ VDR Plugin 'iptv' Revision History 2009-xx-xx: Version 0.2.6 - Added a note about recommended frequencies into README. +- Fixed a locking bug with section filters. diff --git a/device.c b/device.c index e8d67cd..5960edb 100644 --- a/device.c +++ b/device.c @@ -329,6 +329,8 @@ int cIptvDevice::OpenFilter(u_short Pid, u_char Tid, u_char Mask) // Blacklist check, refuse certain filters if (IsBlackListed(Pid, Tid, Mask)) return -1; + // Lock + cMutexLock MutexLock(&mutex); // Search the next free filter slot for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { if (!secfilters[i]) { @@ -343,6 +345,9 @@ int cIptvDevice::OpenFilter(u_short Pid, u_char Tid, u_char Mask) void cIptvDevice::CloseFilter(int Handle) { + // Lock + cMutexLock MutexLock(&mutex); + // Search the filter for deletion for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { if (secfilters[i] && (Handle == secfilters[i]->GetReadDesc())) { //debug("cIptvDevice::CloseFilter(%d): %d\n", deviceIndex, Handle); @@ -435,6 +440,8 @@ bool cIptvDevice::GetTSPacket(uchar *&Data) // Analyze incomplete streams with built-in pid analyzer if (pidScanEnabled && pPidScanner) pPidScanner->Process(p); + // Lock + cMutexLock MutexLock(&mutex); // Run the data through all filters for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { if (secfilters[i])