X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fdvb%2Fesection.h;h=6efe8c38b54f6774aa42605341b76a01551cfe3d;hp=833cc93b2ded9216b264350ddccd9e4895038d3a;hb=0da688aba6cca5cc5b0b4406e384fa9e3345859c;hpb=33e4aeedec7bde0b0f853396f7b308412bd85496 diff --git a/lib/dvb/esection.h b/lib/dvb/esection.h index 833cc93..6efe8c3 100644 --- a/lib/dvb/esection.h +++ b/lib/dvb/esection.h @@ -40,6 +40,7 @@ class eTable: public eGTable private: std::vector sections; std::set avail; + unsigned char m_section_data[4096]; protected: int createTable(unsigned int nr, const __u8 *data, unsigned int max) { @@ -53,6 +54,9 @@ protected: if (avail.find(nr) != avail.end()) delete sections[nr]; + memset(m_section_data, 0, 4096); + memcpy(m_section_data, data, 4096); + sections.resize(max); sections[nr] = new Section(data); avail.insert(nr); @@ -74,6 +78,7 @@ protected: } public: std::vector &getSections() { return sections; } + unsigned char* getBufferData() { return m_section_data; } eTable(bool debug=true): eGTable(debug) { } @@ -100,6 +105,10 @@ class eAUTable: public eAUGTable int first; ePtr m_demux; eMainloop *ml; + + /* needed to detect broken table version handling (seen on some m2ts files) */ + struct timespec m_prev_table_update; + int m_table_cnt; public: eAUTable() @@ -119,6 +128,7 @@ public: int begin(eMainloop *m, const eDVBTableSpec &spec, ePtr demux) { + m_table_cnt = 0; ml = m; m_demux = demux; first= 1; @@ -197,6 +207,24 @@ public: if (current && (!current->getSpec(spec))) { + /* detect broken table version handling (seen on some m2ts files) */ + if (m_table_cnt) + { + if (abs(timeout_usec(m_prev_table_update)) > 500000) + m_table_cnt = -1; + else if (m_table_cnt > 1) // two pmt update within one second + { + eDebug("Seen two consecutive table version changes within 500ms. " + "This seems broken, so auto update for pid %04x, table %02x is now disabled!!", + spec.pid, spec.tid); + m_table_cnt = 0; + return; + } + } + + ++m_table_cnt; + clock_gettime(CLOCK_MONOTONIC, &m_prev_table_update); + next = new Table(); CONNECT(next->tableReady, eAUTable::slotTableReady); spec.flags &= ~(eDVBTableSpec::tfAnyVersion|eDVBTableSpec::tfThisVersion|eDVBTableSpec::tfHaveTimeout);