From e76da9d56c036d65f0554c51024526ff43475437 Mon Sep 17 00:00:00 2001 From: alaotach Date: Wed, 8 Jul 2026 20:02:13 +0530 Subject: [PATCH 1/3] Fix 40ms gap in rolling teletext subtitles --- src/lib_ccx/telxcc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib_ccx/telxcc.c b/src/lib_ccx/telxcc.c index 6e7251364..a45bbfda2 100644 --- a/src/lib_ccx/telxcc.c +++ b/src/lib_ccx/telxcc.c @@ -1054,8 +1054,11 @@ void process_telx_packet(struct TeletextCtx *ctx, data_unit_t data_unit_id, tele ctx->page_buffer.text[yt][it] = telx_to_ucs2(ctx->page_buffer.text[yt][it]); } } - // it would be nice, if subtitle hides on previous video frame, so we contract 40 ms (1 frame @25 fps) - ctx->page_buffer.hide_timestamp = timestamp - 40; + // Previously subtracted 40ms (1 frame @ 25fps) to hide subtitle "early". + // This is wrong for non-25fps content and causes a visible ~41ms blink gap + // in rolling teletext subs, because the WebVTT exporter already subtracts + // 1ms to prevent timestamp boundary collisions. That 1ms is sufficient. + ctx->page_buffer.hide_timestamp = timestamp; if (ctx->page_buffer.hide_timestamp > timestamp) { ctx->page_buffer.hide_timestamp = 0; From 80f04e7de5925d755e1e326b5a32ce93002e1aa6 Mon Sep 17 00:00:00 2001 From: alaotach Date: Mon, 10 Aug 2026 15:44:26 +0530 Subject: [PATCH 2/3] Update hide_timestamp to subtract 1ms --- src/lib_ccx/telxcc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib_ccx/telxcc.c b/src/lib_ccx/telxcc.c index a45bbfda2..575379874 100644 --- a/src/lib_ccx/telxcc.c +++ b/src/lib_ccx/telxcc.c @@ -1055,10 +1055,11 @@ void process_telx_packet(struct TeletextCtx *ctx, data_unit_t data_unit_id, tele } } // Previously subtracted 40ms (1 frame @ 25fps) to hide subtitle "early". - // This is wrong for non-25fps content and causes a visible ~41ms blink gap - // in rolling teletext subs, because the WebVTT exporter already subtracts - // 1ms to prevent timestamp boundary collisions. That 1ms is sufficient. - ctx->page_buffer.hide_timestamp = timestamp; + // This produced a visible ~40ms blink gap in rolling teletext subs. + // It also caused zero-length cues when a page was displayed for exactly 40ms. + // Subtracting 1ms provides sufficient separation between adjacent cues + // to prevent overlap without causing a perceptible blink. + ctx->page_buffer.hide_timestamp = timestamp - 1; if (ctx->page_buffer.hide_timestamp > timestamp) { ctx->page_buffer.hide_timestamp = 0; From e3c090eab356fd0f5fc2f9eff2b6574fea03adfb Mon Sep 17 00:00:00 2001 From: alaotach Date: Mon, 10 Aug 2026 15:53:30 +0530 Subject: [PATCH 3/3] Update hide_timestamp to use touching boundaries and remove dead guard --- src/lib_ccx/telxcc.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/lib_ccx/telxcc.c b/src/lib_ccx/telxcc.c index 575379874..dc326eda7 100644 --- a/src/lib_ccx/telxcc.c +++ b/src/lib_ccx/telxcc.c @@ -1054,16 +1054,12 @@ void process_telx_packet(struct TeletextCtx *ctx, data_unit_t data_unit_id, tele ctx->page_buffer.text[yt][it] = telx_to_ucs2(ctx->page_buffer.text[yt][it]); } } - // Previously subtracted 40ms (1 frame @ 25fps) to hide subtitle "early". - // This produced a visible ~40ms blink gap in rolling teletext subs. - // It also caused zero-length cues when a page was displayed for exactly 40ms. - // Subtracting 1ms provides sufficient separation between adjacent cues - // to prevent overlap without causing a perceptible blink. - ctx->page_buffer.hide_timestamp = timestamp - 1; - if (ctx->page_buffer.hide_timestamp > timestamp) - { - ctx->page_buffer.hide_timestamp = 0; - } + // Previously subtracted 40ms (1 frame @ 25fps) to hide subtitle "early", + // but this produced a visible ~40ms blink gap in rolling teletext subs + // and caused zero-length cues when a page was displayed for exactly 40ms. + // WebVTT allows touching cues (where the end time of one cue perfectly matches + // the start time of the next), which makes rolling look continuous. + ctx->page_buffer.hide_timestamp = timestamp; process_page(ctx, &ctx->page_buffer, sub); de_ctr = 0; }