]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
tsfix: sometimes, commersial skipping caused the audio/video to get out off sync...
authorJohn Törnblom <john.tornblom@gmail.com>
Tue, 8 Jan 2013 14:41:12 +0000 (15:41 +0100)
committerJohn Törnblom <john.tornblom@gmail.com>
Tue, 8 Jan 2013 21:33:04 +0000 (22:33 +0100)
src/dvr/dvr_rec.c
src/plumbing/tsfix.c
src/plumbing/tsfix.h

index d933c19581e89c1baa249cbc2aa82612a5981ab1..5129e7e81452a157f9245c801772999decff2a68 100755 (executable)
@@ -423,14 +423,13 @@ dvr_thread(void *aux)
 
     case SMT_PACKET:
       pkt = sm->sm_data;
-      if(pkt->pkt_commercial == COMMERCIAL_YES) {
+      if(pkt->pkt_commercial == COMMERCIAL_YES)
        dvr_rec_set_state(de, DVR_RS_COMMERCIAL, 0);
-       tsfix_set_comm_skip(de->de_tsfix, comm_skip);
-      } else {
+      else
        dvr_rec_set_state(de, DVR_RS_RUNNING, 0);
-       tsfix_set_comm_skip(de->de_tsfix, 0);
-      }
 
+      if(pkt->pkt_commercial == COMMERCIAL_YES && comm_skip)
+       break;
       if(started) {
        muxer_write_pkt(de->de_mux, sm->sm_type, sm->sm_data);
        sm->sm_data = NULL;
index 4fea875173823c35e8bce65a71e6f9a27fd36514..a811e67c4d5c33edb7cd67907f9e11fbc5d58593 100644 (file)
@@ -40,7 +40,6 @@ typedef struct tfstream {
   int64_t tfs_dts_epoch;
 
   int64_t tfs_last_dts_in;
-  int64_t tfs_drops;
 
 } tfstream_t;
 
@@ -57,7 +56,6 @@ typedef struct tsfix {
   int tf_hasvideo;
   int64_t tf_tsref;
   time_t tf_start_time;
-  int tf_comm_skip;
 
   struct th_pktref_queue tf_ptsq;
 
@@ -162,9 +160,6 @@ normalize_ts(tsfix_t *tf, tfstream_t *tfs, th_pkt_t *pkt)
   /* Subtract the transport wide start offset */
   dts = pkt->pkt_dts - tf->tf_tsref;
 
-  /* Subtract dropped packets due to commercial breaks */
-  dts -= tfs->tfs_drops;
-
   if(tfs->tfs_last_dts_norm == PTS_UNSET) {
     if(dts < 0) {
       /* Early packet with negative time stamp, drop those */
@@ -331,7 +326,6 @@ tsfix_input_packet(tsfix_t *tf, streaming_message_t *sm)
 
   if(pkt->pkt_dts == PTS_UNSET) {
     if(tfs->tfs_last_dts_in == PTS_UNSET) {
-      tfs->tfs_drops += pdur;
       pkt_ref_dec(pkt);
       return;
     }
@@ -343,12 +337,6 @@ tsfix_input_packet(tsfix_t *tf, streaming_message_t *sm)
                tfs->tfs_last_dts_in, pdur, pkt->pkt_dts);
   }
 
-  if(tf->tf_comm_skip && pkt->pkt_commercial == COMMERCIAL_YES) {
-    tfs->tfs_drops += pdur;
-    pkt_ref_dec(pkt);
-    return;
-  }
-
   tfs->tfs_last_dts_in = pkt->pkt_dts;
 
   compute_pts(tf, tfs, pkt);
@@ -416,17 +404,6 @@ void tsfix_set_start_time(streaming_target_t *pad, time_t start)
 }
 
 
-/**
- *
- */
-void
-tsfix_set_comm_skip(streaming_target_t *pad, int bool) {
-  tsfix_t *tf = (tsfix_t *)pad;
-
-  tf->tf_comm_skip = !!bool;
-}
-
-
 /**
  *
  */
index 210bc88cd67c6754ccaeea4234cc61c623d4d385..156284fe8a799c9d7f03f5c9bdd067918b58f425 100644 (file)
@@ -25,8 +25,6 @@ streaming_target_t *tsfix_create(streaming_target_t *output);
 
 void tsfix_set_start_time(streaming_target_t *pad, time_t start);
 
-void tsfix_set_comm_skip(streaming_target_t *pad, int bool);
-
 void tsfix_destroy(streaming_target_t *gh);