mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-26 23:12:44 +02:00
spark: make cDemux more robust
* workaround hanging Read() if frontend loses and regains lock
* set DMX_ONESHOT for TDT and TOT sections
Origin commit data
------------------
Branch: master
Commit: fe7b385660
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2012-09-22 (Sat, 22 Sep 2012)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -291,17 +291,31 @@ int cDemux::Read(unsigned char *buff, int len, int timeout)
|
||||
return -1;
|
||||
}
|
||||
int rc;
|
||||
int to = timeout;
|
||||
struct pollfd ufds;
|
||||
ufds.fd = fd;
|
||||
ufds.events = POLLIN|POLLPRI|POLLERR;
|
||||
ufds.revents = 0;
|
||||
|
||||
if (timeout > 0)
|
||||
/* hack: if the frontend loses and regains lock, the demuxer often will not
|
||||
* return from read(), so as a "emergency exit" for e.g. NIT scan, set a (long)
|
||||
* timeout here */
|
||||
if (dmx_type == DMX_PSI_CHANNEL && timeout <= 0)
|
||||
to = 60 * 1000;
|
||||
|
||||
if (to > 0)
|
||||
{
|
||||
retry:
|
||||
rc = ::poll(&ufds, 1, timeout);
|
||||
rc = ::poll(&ufds, 1, to);
|
||||
if (!rc)
|
||||
{
|
||||
if (timeout == 0) /* we took the emergency exit */
|
||||
{
|
||||
dmx_err("timed out for timeout=0!, %s", "", 0);
|
||||
return -1; /* this timeout is an error */
|
||||
}
|
||||
return 0; // timeout
|
||||
}
|
||||
else if (rc < 0)
|
||||
{
|
||||
dmx_err("poll: %s,", strerror(errno), 0)
|
||||
@@ -405,6 +419,7 @@ bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filte
|
||||
/* 0x60 - 0x6F: event_information_section - other_transport_stream, schedule */
|
||||
case 0x70: /* time_date_section */
|
||||
s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */
|
||||
s_flt.flags |= DMX_ONESHOT;
|
||||
//s_flt.pid = 0x0014;
|
||||
to = 30000;
|
||||
break;
|
||||
@@ -417,6 +432,7 @@ bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filte
|
||||
to = 0;
|
||||
break;
|
||||
case 0x73: /* time_offset_section */
|
||||
s_flt.flags |= DMX_ONESHOT;
|
||||
//s_flt.pid = 0x0014;
|
||||
to = 30000;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user