3. try ;) : copy from TangoCash sectiond

Origin commit data
------------------
Branch: ni/coolstream
Commit: 7eed63f12e
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2018-02-17 (Sat, 17 Feb 2018)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2018-02-17 13:23:27 +01:00
committed by vanhofen
parent c0bb3a6911
commit bd13170528

View File

@@ -56,7 +56,9 @@
#include "debug.h"
#include <compatibility.h>
#if ! HAVE_COOL_HARDWARE
#include <poll.h>
#endif
//#define ENABLE_SDT //FIXME
//#define DEBUG_SDT_THREAD
@@ -1489,15 +1491,27 @@ void CTimeThread::run()
rc = dmx->Read(static_buf, MAX_SECTION_LENGTH, timeoutInMSeconds);
#else
int64_t start = time_monotonic_ms();
int timeouts = 0;
/* speed up shutdown by looping around Read() */
struct pollfd ufds;
ufds.events = POLLIN|POLLPRI|POLLERR;
DMX::lock();
ufds.fd = dmx->getFD();
DMX::unlock();
do {
rc = getSection(static_buf, timeoutInMSeconds /6,timeouts);
} while (running && rc < 1 && (time_monotonic_ms() - start) < (int64_t)timeoutInMSeconds*2);
ufds.revents = 0;
rc = ::poll(&ufds, 1, timeoutInMSeconds / 36);
if (running && rc == 1) {
DMX::lock();
if (ufds.fd == dmx->getFD()){
rc = dmx->Read(static_buf, MAX_SECTION_LENGTH, 10);
}
DMX::unlock();
}
} while (running && rc == 0 && (time_monotonic_ms() < (int64_t)timeoutInMSeconds + start));
#endif
xprintf("%s: get DVB time ch 0x%012" PRIx64 " rc: %d neutrino_sets_time %d\n",
name.c_str(), current_service, rc, messaging_neutrino_sets_time);
if (rc > 0) {
if (rc > 3) {
SIsectionTIME st(static_buf);
if (st.is_parsed()) {
dvb_time = st.getTime();