Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
tsfix: Fix the decision boundary for ts_diff, handle reference for te…
…xt subtitles, too
  • Loading branch information
perexg committed Oct 24, 2014
1 parent 9c6b8c2 commit c23eca2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/plumbing/tsfix.c
Expand Up @@ -77,7 +77,7 @@ tsfix_ts_diff(int64_t ts1, int64_t ts2)
ts2 &= PTS_MASK;

r = abs(ts1 - ts2);
if (r > (PTS_MASK / 4)) {
if (r > (PTS_MASK / 2)) {
/* try to wrap the lowest value */
if (ts1 < ts2)
ts1 += PTS_MASK + 1;
Expand Down Expand Up @@ -354,8 +354,13 @@ tsfix_input_packet(tsfix_t *tf, streaming_message_t *sm)
tf->tf_tsref != PTS_UNSET) {
int64_t diff = tsfix_ts_diff(tf->tf_tsref, pkt->pkt_dts);
if (diff > 2 * 90000) {
tfstream_t *tfs2;
tvhwarn("parser", "The timediff for TELETEXT is big (%"PRId64"), using current dts", diff);
tfs->tfs_local_ref = pkt->pkt_dts;
/* Text subtitles extracted from teletext have same timebase */
LIST_FOREACH(tfs2, &tf->tf_streams, tfs_link)
if(tfs2->tfs_type == SCT_TEXTSUB)
tfs2->tfs_local_ref = pkt->pkt_dts;
} else {
tfs->tfs_local_ref = tf->tf_tsref;
}
Expand Down

0 comments on commit c23eca2

Please sign in to comment.