Skip to content

[IMPROVEMENT] Document why store_hdcc overwrites the slot - #2392

Merged
cfsmp3 merged 1 commit into
masterfrom
docs/store-hdcc-overwrite
Oct 18, 2026
Merged

cfsmp3 merged 1 commit into
masterfrom
docs/store-hdcc-overwrite

Conversation

@cfsmp3

@cfsmp3 cfsmp3 commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

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

Reason for this PR:

  • This PR adds new functionality.
  • This PR fixes a bug that I have personally experienced or that a real user has reported and for which a sample exists.
  • This PR is porting code from C to Rust.

Sanity check:

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • If the PR adds new functionality, I've added it to the changelog. If it's just a bug fix, I have NOT added it to the changelog.
  • I am NOT adding new C code unless it's to fix an existing, reproducible bug.

Repro instructions:

Comment-only change, no behaviour change. To see why the reset matters: remove dec_ctx->cc_data_count[seq_index] = 0; in store_hdcc() (so same-picture blocks append) and run sample 9a496d38… (ATSC MPEG-2 TS) with --out=srt. Every 608 character is doubled: ♪ S Standtandining g init instead of ♪ Standing in front.


Re #2350. The comments around the unconditional reset in store_hdcc() ("Changed by CFS to concat… TODO", plus a commented-out stream_mode guard) make it look like a bug, and #2350 and #2351 set out to "restore" concatenation.

Instrumenting store_hdcc() across all 41 local samples with 608/708 captions: 40 never store twice into one slot with the same timestamp. The one that does, an ATSC MPEG-2 stream, carries each picture's 608 pairs twice, as SCTE-20 user data followed by GA94, and in all 455 such calls the overwritten block's 608 pairs are identical to the GA94 block's. The overwrite is what de-duplicates them; appending doubles every character. The decoder side would handle several envelopes per slot fine, so it's the content, not the format, that makes concatenation wrong.

This replaces the stale comments with that reason and drops the dead stream_mode lines. Output is byte-identical to master.

The comments around the reset in store_hdcc() say it was "changed to
concat" with a TODO, next to a commented-out stream_mode guard, which
reads as if the unconditional reset were a bug (issue #2350, PR #2351).

It is load-bearing. On a real ATSC MPEG-2 stream each picture carries
its 608 pairs twice, as SCTE-20 user data followed by GA94: every
same-slot store_hdcc() call in that file overwrites a block whose 608
pairs are identical to the GA94 block's. Appending instead duplicates
every character ("♪ S Standtandining g" for "♪ Standing"). None of the
other 40 local 608/708 samples ever stores twice into one slot.

Replace the stale comments with the reason and drop the dead
stream_mode lines. No code change.
@cfsmp3
cfsmp3 merged commit 8980687 into master Oct 18, 2026
46 of 48 checks passed
@cfsmp3
cfsmp3 deleted the docs/store-hdcc-overwrite branch October 18, 2026 04:02
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.

1 participant