]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
tsfile: fix problem with ts-resync on end of file
authorAdam Sutton <dev@adamsutton.me.uk>
Mon, 21 Apr 2014 21:29:31 +0000 (22:29 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Mon, 21 Apr 2014 21:29:31 +0000 (22:29 +0100)
Actually this is a more general re-sync bug, it's possible that a loss of
sync could end up being terminal.

src/input/mpegts/mpegts_input.c
src/input/mpegts/tsfile/tsfile_input.c

index 1b1d7243c05ed3b50b283303be886d8c484b431a..e60ff43d1a8320ac9ea53a0ec9a67c5c0fe1193b 100644 (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;
index aa56186c958b75f6a155d4bfe80fd01747337b83..32bdca5cd33a94a8534aca6113cc08b9e4ea7b5d 100644 (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);