tsfile: fix problem with ts-resync on end of file

Actually this is a more general re-sync bug, it's possible that a loss of
sync could end up being terminal.
This commit is contained in:
Adam Sutton 2014-04-21 22:29:31 +01:00
parent a9e7d13cbf
commit a3b2ad5e5b
2 changed files with 3 additions and 3 deletions

View file

@ -448,7 +448,7 @@ mpegts_input_recv_packets
/* 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;

View file

@ -120,7 +120,7 @@ tsfile_input_thread ( void *aux )
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);
@ -129,7 +129,7 @@ tsfile_input_thread ( void *aux )
}
/* 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);