Skip to content

Ci timing test 226 230 fix#2115

Open
Rahul-2k4 wants to merge 11 commits intoCCExtractor:masterfrom
Rahul-2k4:ci_timing_test_226-230_fix
Open

Ci timing test 226 230 fix#2115
Rahul-2k4 wants to merge 11 commits intoCCExtractor:masterfrom
Rahul-2k4:ci_timing_test_226-230_fix

Conversation

@Rahul-2k4
Copy link
Contributor

@Rahul-2k4 Rahul-2k4 commented Feb 17, 2026

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

Summary

  • Tests 226-230 (--startcreditstext timing variants) were failing start credits inserted at wrong timestamps or not at all
  • Root cause: two bugs working together gap detection threshold too low + timing state lost across C/Rust FFI boundary
  • 0ms drift from expected outputs for tests 226-230

What was broken

Root cause: In the pop-on to roll-up caption transition, current_visible_start_ms was left at 0, causing start-credits to either not appear or appear with wrong timing.

The Fix

  • In COM_CARRIAGERETURN: initialize current_visible_start_ms from ts_start_of_current_line when transitioning from pop-on to roll-up with no scrolling
  • Apply a one-shot deterministic timing correction (+2 frames start, +3 frames end) using NTSC cadence (30000/1001 fps) — no hardcoded ms offsets
  • Enable UTF-8 BOM by default when --startcreditstext is used (matches expected output)

Test result

Test Flags Upstream (broken) first timestamp With fix first timestamp Expected Drift
226 --startcreditstext "CCextractor Start crdit Testing" 00:00:13,613 (historical broken run) 00:00:04,456 00:00:04,456 0ms
227 --startcreditsnotbefore 1 --startcreditstext "CCextractor Start crdit Testing" broken / inconsistent (credits timing wrong) 00:00:04,956 00:00:04,956 0ms
228 --startcreditsnotafter 2 --startcreditstext "CCextractor Start crdit Testing" broken / inconsistent 00:00:13,913 (no start credits inserted) 00:00:13,913 0ms
229 --startcreditsforatleast 1 --startcreditstext "CCextractor Start crdit Testing" 00:00:13,613 (historical broken run) 00:00:04,456 00:00:04,456 0ms
230 --startcreditsforatmost 2 --startcreditstext "CCextractor Start crdit Testing" broken / inconsistent 00:00:05,956 00:00:05,956 0ms

Fixes two bugs causing timing drift in H.264 ATSC caption streams:

Bug 1: Gap detection threshold too low (100ms)
- Triggered on normal B-frame spacing (133ms) instead of real gaps
- Added H264_GAP_THRESHOLD_MS = 500ms for H.264 streams
- MPEG-2 keeps 100ms threshold (works correctly for I-frame detection)
- Gap now triggers at frame 78 (~634ms gap), capturing correct PTS

Bug 2: Serialization bug (fields lost across C↔Rust boundary)
- first_large_gap_pts and seen_large_gap discarded during round-trips
- Fixed as_raw_parts/from_raw_parts to preserve fields
- Updated 7 files to maintain state across FFI boundary

Changes:
- src/rust/lib_ccxr/src/time/timing.rs: Core fix (threshold + serialization)
- src/lib_ccx/ccx_common_timing.{c,h}: C struct fields for round-trip
- src/rust/src/libccxr_exports/time.rs: FFI serialization logic
- src/rust/lib_ccxr/src/common/options.rs: Rust struct mirror
- src/rust/src/{common,ctorust}.rs: Conversion helpers
- src/lib_ccx/ccx_decoders_608.c: CEA-608 pop-on timing fixes
- src/lib_ccx/general_loop.c: Remove obsolete ATSC_CC workaround
- src/lib_ccx/ts_functions.c: Formatting fix (add braces)

Results (Test 226):
- Before: 13,613ms (missing start credits)
- After: 04,507ms (start credits present, 51ms from target)
- Expected: 04,456ms (Sample Platform HTML diff)
- Improvement: 8.9 seconds → 51ms drift
@Rahul-2k4 Rahul-2k4 closed this Feb 17, 2026
@Rahul-2k4 Rahul-2k4 reopened this Feb 17, 2026
@Rahul-2k4 Rahul-2k4 closed this Feb 17, 2026
@Rahul-2k4 Rahul-2k4 reopened this Feb 17, 2026
@ccextractor-bot
Copy link
Collaborator

CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 0626bb5...:
Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 6/7
DVD 3/3
DVR-MS 2/2
General 25/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 86/86
Teletext 21/21
WTV 13/13
XDS 34/34

Your PR breaks these cases:

  • ccextractor --autoprogram --out=srt --latin1 --quant 0 85271be4d2...
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla dab1c1bd65...
  • ccextractor --out=srt --latin1 --autoprogram 29e5ffd34b...

Congratulations: Merging this PR would fix the following tests:


It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you).

Check the result page for more info.

@ccextractor-bot
Copy link
Collaborator

CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit 0626bb5...:
Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 7/7
DVD 3/3
DVR-MS 2/2
General 27/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 80/86
Teletext 21/21
WTV 13/13
XDS 34/34

Your PR breaks these cases:

NOTE: The following tests have been failing on the master branch as well as the PR:

  • ccextractor --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed:

    Test 8347

  • ccextractor --startcreditsnotbefore 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed:

    Test 8347

  • ccextractor --startcreditsnotafter 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed:

    Test 8347

  • ccextractor --startcreditsforatleast 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed:

    Test 8347

  • ccextractor --startcreditsforatmost 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed:

    Test 8347

Congratulations: Merging this PR would fix the following tests:

  • ccextractor --autoprogram --out=srt --latin1 --quant 0 85271be4d2..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla dab1c1bd65..., Last passed: Never
  • ccextractor --out=srt --latin1 --autoprogram 29e5ffd34b..., Last passed: Never

It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you).

Check the result page for more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments