Skip to content

fix(subtitles): preserve secondary track identity across rebuilds - #824

Open
orut34iop wants to merge 1 commit into
superuser404notfound:mainfrom
orut34iop:codex/fix-secondary-subtitle-lifecycle
Open

orut34iop wants to merge 1 commit into
superuser404notfound:mainfrom
orut34iop:codex/fix-secondary-subtitle-lifecycle

Conversation

@orut34iop

Copy link
Copy Markdown
Contributor

Summary

The audio-switch rebuild restores a primary registered subtitle through its registry id, but restores its secondary companion through only the URL. This loses the external identity, explicit headers and selected stream inside a subtitle container. Restore the secondary companion through its existing registry entry too, with coherent teardown and load ownership.

What changed

  • Snapshot the secondary external id before internal teardown and re-select that id after rebuilding. One-shot sidecars retain the URL fallback, embedded tracks retain their source-time anchor.
  • Clear a stale sidecar URL when selecting embedded subtitles, and clear active external identity on internal teardown while preserving the rebuild registry.
  • Guard late secondary decode success and failure publication with the captured load generation, in addition to task cancellation.
  • No new public API, bitmap/ASS capability, prepare/commit transaction, or restriction on using one track in both channels.

Test plan

Host: Apple Silicon Mac17,3, macOS 26.7.1, Swift 6.4. Existing synthetic multi-subtitle container fixture; tests verify the selected Spanish stream and registry identity after restoration, teardown, removal, stale-generation publication, embedded selection and same-track dual-channel behavior. Tests exercise the restoration routine called by the audio rebuild, not a physical audio-track switch or an AVPlayer media session. No new device acceptance is claimed for this isolated PR.

  • Regression proof on untouched upstream production code: three tests failed with four assertions covering retained external id, stale sidecar URL, and stale decode publication into the next load generation.
  • With the fix, 30 focused Swift Testing regressions across six suites passed under LIBDISPATCH_COOPERATIVE_POOL_STRICT=1, including multi-stream restoration and same-track dual-channel compatibility.
  • Full default-traits run passed: 795 XCTest cases (one existing skip), 4,619 Swift Testing tests in 633 suites, zero failures.
  • Native host build passed. Test bundle and CLI were signed and verified with an Apple Development identity; linker ad-hoc signing was disabled.
  • Documentation links and git diff --check passed. Platform builds and all-traits coverage remain for upstream CI.

Checklist

  • CHANGELOG and API behavior documentation updated
  • Conventional Commit
  • Engine fix, reuses existing registry
  • No new public API or dependencies

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