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

Fixed a locking bug with section filters.

This commit is contained in:
Rolf Ahrenberg 2009-03-17 17:37:05 +02:00
parent b221a9a406
commit 74761da04a
2 changed files with 8 additions and 0 deletions

View File

@ -98,3 +98,4 @@ VDR Plugin 'iptv' Revision History
2009-xx-xx: Version 0.2.6 2009-xx-xx: Version 0.2.6
- Added a note about recommended frequencies into README. - Added a note about recommended frequencies into README.
- Fixed a locking bug with section filters.

View File

@ -329,6 +329,8 @@ int cIptvDevice::OpenFilter(u_short Pid, u_char Tid, u_char Mask)
// Blacklist check, refuse certain filters // Blacklist check, refuse certain filters
if (IsBlackListed(Pid, Tid, Mask)) if (IsBlackListed(Pid, Tid, Mask))
return -1; return -1;
// Lock
cMutexLock MutexLock(&mutex);
// Search the next free filter slot // Search the next free filter slot
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
if (!secfilters[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) void cIptvDevice::CloseFilter(int Handle)
{ {
// Lock
cMutexLock MutexLock(&mutex);
// Search the filter for deletion
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
if (secfilters[i] && (Handle == secfilters[i]->GetReadDesc())) { if (secfilters[i] && (Handle == secfilters[i]->GetReadDesc())) {
//debug("cIptvDevice::CloseFilter(%d): %d\n", deviceIndex, Handle); //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 // Analyze incomplete streams with built-in pid analyzer
if (pidScanEnabled && pPidScanner) if (pidScanEnabled && pPidScanner)
pPidScanner->Process(p); pPidScanner->Process(p);
// Lock
cMutexLock MutexLock(&mutex);
// Run the data through all filters // Run the data through all filters
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
if (secfilters[i]) if (secfilters[i])