mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 13:37:42 +02:00
Cleanup section filter code.
This commit is contained in:
parent
3cc63dadac
commit
0a9bb96dd4
@ -129,7 +129,7 @@ int cSatipSectionFilter::CopyDump(const uint8_t *bufP, uint8_t lenP)
|
||||
if (tsFeedpM + lenP > eDmxMaxSectionFeedSize)
|
||||
lenP = (uint8_t)(eDmxMaxSectionFeedSize - tsFeedpM);
|
||||
|
||||
if (lenP <= 0)
|
||||
if (lenP == 0)
|
||||
return 0;
|
||||
|
||||
memcpy(secBufBaseM + tsFeedpM, bufP, lenP);
|
||||
@ -144,7 +144,7 @@ int cSatipSectionFilter::CopyDump(const uint8_t *bufP, uint8_t lenP)
|
||||
|
||||
for (n = 0; secBufpM + 2 < limit; ++n) {
|
||||
uint16_t seclen = GetLength(secBufM);
|
||||
if ((seclen <= 0) || (seclen > eDmxMaxSectionSize) || ((seclen + secBufpM) > limit))
|
||||
if ((seclen > eDmxMaxSectionSize) || ((seclen + secBufpM) > limit))
|
||||
return 0;
|
||||
secLenM = seclen;
|
||||
if (pusiSeenM)
|
||||
@ -273,7 +273,11 @@ cSatipSectionFilterHandler::~cSatipSectionFilterHandler()
|
||||
|
||||
void cSatipSectionFilterHandler::SendAll(void)
|
||||
{
|
||||
while (true) {
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
bool retry;
|
||||
do {
|
||||
retry = false;
|
||||
|
||||
// zero polling structures
|
||||
memset(pollFdsM, 0, sizeof(pollFdsM));
|
||||
|
||||
@ -293,16 +297,19 @@ void cSatipSectionFilterHandler::SendAll(void)
|
||||
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
|
||||
if (pollFdsM[i].revents & POLLOUT)
|
||||
filtersM[i]->Send();
|
||||
|
||||
if (!retry && filtersM[i] && filtersM[i]->Available() != 0)
|
||||
retry = true;
|
||||
}
|
||||
}
|
||||
} while (retry);
|
||||
}
|
||||
|
||||
void cSatipSectionFilterHandler::Action(void)
|
||||
{
|
||||
debug1("%s Entering [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
// Do the thread loop
|
||||
uchar *p = NULL;
|
||||
while (Running()) {
|
||||
uchar *p = NULL;
|
||||
int len = 0;
|
||||
// Process all pending TS packets
|
||||
while ((p = ringBufferM->Get(len)) != NULL) {
|
||||
@ -330,9 +337,7 @@ void cSatipSectionFilterHandler::Action(void)
|
||||
}
|
||||
|
||||
// Send demuxed section packets through all filters
|
||||
mutexM.Lock();
|
||||
SendAll();
|
||||
mutexM.Unlock();
|
||||
}
|
||||
debug1("%s Exiting [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user