Actually this is a more general re-sync bug, it's possible that a loss of
sync could end up being terminal.
/* Check for sync */
// could be a bit more efficient
while ( (len >= (MIN_TS_SYN * 188)) &&
- ((p = ts_sync_count(tsb, len)) == 0) ) {
+ ((p = ts_sync_count(tsb, len)) < MIN_TS_SYN) ) {
--len;
++tsb;
++off;
len += c;
/* Reset */
- if (len == st.st_size) {
+ if (len >= st.st_size) {
len = 0;
c -= rem;
tvhtrace("tsfile", "adapter %d reached eof, resetting", mi->mi_instance);
}
/* Process */
- if (c >= 0) {
+ if (c > 0) {
pcr = PTS_UNSET;
mpegts_input_recv_packets((mpegts_input_t*)mi, mmi, &buf, 0,
&pcr, &tmi->mmi_tsfile_pcr_pid);