Skip to content

Commit cf74762

Browse files
cfsmp3claude
andcommitted
fix(rust): remove double-increment of cb_708 counter
The cb_708 counter was being incremented twice for each CEA-708 data block: 1. In do_cb_dtvcc_rust() in Rust (src/rust/src/lib.rs) 2. In do_cb() in C (src/lib_ccx/ccx_decoders_common.c) Since FTS calculation uses cb_708 (fts = fts_now + fts_global + cb_708 * 1001 / 30), the double-increment caused timestamps to advance ~2x as fast as expected, resulting in incorrect milliseconds in start timestamps. This fix removes the increment from the Rust code since the C code already handles it in do_cb(). Fixes timestamp issues reported in PR #1782 tests where start times like 00:00:20,688 were incorrectly output as 00:00:20,737. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a6dd763 commit cf74762

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/rust/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,9 @@ pub fn do_cb_dtvcc_rust(ctx: &mut lib_cc_decode, dtvcc: &mut DtvccRust, cc_block
529529
if timeok && ctx.write_format != ccx_output_format::CCX_OF_RAW {
530530
dtvcc.process_cc_data(cc_valid, cc_type, cc_block[1], cc_block[2]);
531531
}
532-
unsafe { cb_708 += 1 }
532+
// Note: cb_708 is incremented by the C code in do_cb(), not here.
533+
// Previously incrementing here caused a double-increment bug that
534+
// resulted in incorrect start timestamps.
533535
}
534536
_ => warn!("Invalid cc_type"),
535537
}

0 commit comments

Comments
 (0)