mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
spark: make cDemux more robust
* workaround hanging Read() if frontend loses and regains lock * set DMX_ONESHOT for TDT and TOT sections
This commit is contained in:
@@ -291,17 +291,31 @@ int cDemux::Read(unsigned char *buff, int len, int timeout)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
int rc;
|
int rc;
|
||||||
|
int to = timeout;
|
||||||
struct pollfd ufds;
|
struct pollfd ufds;
|
||||||
ufds.fd = fd;
|
ufds.fd = fd;
|
||||||
ufds.events = POLLIN|POLLPRI|POLLERR;
|
ufds.events = POLLIN|POLLPRI|POLLERR;
|
||||||
ufds.revents = 0;
|
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:
|
retry:
|
||||||
rc = ::poll(&ufds, 1, timeout);
|
rc = ::poll(&ufds, 1, to);
|
||||||
if (!rc)
|
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
|
return 0; // timeout
|
||||||
|
}
|
||||||
else if (rc < 0)
|
else if (rc < 0)
|
||||||
{
|
{
|
||||||
dmx_err("poll: %s,", strerror(errno), 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 */
|
/* 0x60 - 0x6F: event_information_section - other_transport_stream, schedule */
|
||||||
case 0x70: /* time_date_section */
|
case 0x70: /* time_date_section */
|
||||||
s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */
|
s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */
|
||||||
|
s_flt.flags |= DMX_ONESHOT;
|
||||||
//s_flt.pid = 0x0014;
|
//s_flt.pid = 0x0014;
|
||||||
to = 30000;
|
to = 30000;
|
||||||
break;
|
break;
|
||||||
@@ -417,6 +432,7 @@ bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filte
|
|||||||
to = 0;
|
to = 0;
|
||||||
break;
|
break;
|
||||||
case 0x73: /* time_offset_section */
|
case 0x73: /* time_offset_section */
|
||||||
|
s_flt.flags |= DMX_ONESHOT;
|
||||||
//s_flt.pid = 0x0014;
|
//s_flt.pid = 0x0014;
|
||||||
to = 30000;
|
to = 30000;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user