fix(cea708): use dynamic current_fps instead of hardcoded 29.97 in SCC frame delays (#2173)

Replace all 6 hardcoded 1000/29.97 frame delay calculations in
dtvcc_write_scc() with 1000/current_fps so that CEA-708 SCC output
uses the actual stream framerate instead of assuming NTSC 29.97.

Fixes #2172
This commit is contained in:
Atul Chahar
2026-03-18 08:50:17 +05:30
committed by GitHub
parent 0b1a967b73
commit 9f250b144d
2 changed files with 7 additions and 6 deletions

View File

@@ -4,6 +4,7 @@
- Fix: Remove strdup() memory leaks in WebVTT styling encoder, fix invalid CSS rgba(0,256,0) green value, fix missing free(unescaped) on write-error path (#2154)
- Fix: Prevent crash in Rust timing module when logging out-of-range PTS/FTS timestamps from malformed streams.
- Fix: Resolve Windows MSVC debug build crash caused by cross-CRT invalid free on Rust-allocated output_filename (#2126)
- Fix: Use dynamic current_fps instead of hardcoded 29.97 in CEA-708 SCC frame delay calculations (#2172)
0.96.6 (2026-02-19)
-------------------

View File

@@ -550,11 +550,11 @@ void dtvcc_write_scc(dtvcc_writer_ctx *writer, dtvcc_service_decoder *decoder, s
if (tv->old_cc_time_end > time_show.time_in_ms)
{
// Correct the frame delay
time_show.time_in_ms -= 1000 / 29.97;
time_show.time_in_ms -= 1000 / current_fps;
print_scc_time(time_show, buf);
buf_len = strlen(buf);
SCC_SNPRINTF("\t942c 942c");
time_show.time_in_ms += 1000 / 29.97;
time_show.time_in_ms += 1000 / current_fps;
// Clear the buffer and start pop on caption
SCC_SNPRINTF("94ae 94ae 9420 9420");
}
@@ -566,20 +566,20 @@ void dtvcc_write_scc(dtvcc_writer_ctx *writer, dtvcc_service_decoder *decoder, s
buf_len = strlen(buf);
SCC_SNPRINTF("\t942c 942c \n\n");
// Correct the frame delay
time_show.time_in_ms -= 1000 / 29.97;
time_show.time_in_ms -= 1000 / current_fps;
// Clear the buffer and start pop on caption in new time
print_scc_time(time_show, buf + buf_len);
buf_len = strlen(buf);
SCC_SNPRINTF("\t94ae 94ae 9420 9420");
time_show.time_in_ms += 1000 / 29.97;
time_show.time_in_ms += 1000 / current_fps;
}
else
{
time_show.time_in_ms -= 1000 / 29.97;
time_show.time_in_ms -= 1000 / current_fps;
print_scc_time(time_show, buf);
buf_len = strlen(buf);
SCC_SNPRINTF("\t942c 942c 94ae 94ae 9420 9420");
time_show.time_in_ms += 1000 / 29.97;
time_show.time_in_ms += 1000 / current_fps;
}
int total_subtitle_count = count_captions_lines_scc(tv);