diff --git a/src/dvr/dvr_rec.c b/src/dvr/dvr_rec.c index d933c195..5129e7e8 100755 --- a/src/dvr/dvr_rec.c +++ b/src/dvr/dvr_rec.c @@ -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; diff --git a/src/plumbing/tsfix.c b/src/plumbing/tsfix.c index 4fea8751..a811e67c 100644 --- a/src/plumbing/tsfix.c +++ b/src/plumbing/tsfix.c @@ -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; -} - - /** * */ diff --git a/src/plumbing/tsfix.h b/src/plumbing/tsfix.h index 210bc88c..156284fe 100644 --- a/src/plumbing/tsfix.h +++ b/src/plumbing/tsfix.h @@ -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);