Skip to content

fix(player): normalize TS timestamp continuity#676

Merged
stackia merged 1 commit into
mainfrom
codex/fix-ts-timestamp-continuity
Jul 14, 2026
Merged

fix(player): normalize TS timestamp continuity#676
stackia merged 1 commit into
mainfrom
codex/fix-ts-timestamp-continuity

Conversation

@stackia

@stackia stackia commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

Normalize MPEG-TS timestamps across HLS segments and continuous TS input boundaries so playback remains continuous when upstream segments contain timestamp gaps, small overlaps, or large backward jumps.

The player now:

  • removes timestamp gaps of any size and appends samples to the existing output timeline
  • skips duplicate samples for overlaps up to and including 10 seconds
  • retains samples after backward jumps larger than 10 seconds and rebases them onto the continuous output timeline
  • applies the same policy to remuxed audio/video and software-decoded MP2 PCM
  • ignores HLS playlist discontinuity metadata for TS timeline normalization while preserving explicit reset behavior for fMP4 periods

Root cause

TS timestamp continuity handling was split between segment-boundary orchestration, remuxing, and PCM scheduling. HLS segment resets could discard continuity state, while decoded PCM extrapolation could hide real source gaps and overlaps. This caused later HLS TS segments to stall or diverge from the media timeline even though the first segment played normally.

Implementation

The shared overlap decision and PCM range mapping live in a focused timeline module. Segment metadata now describes reset intent instead of directly commanding a remuxer reset, allowing the pipeline to distinguish TS and fMP4 behavior. MP2 raw frame typing and parser reset boundaries were also consolidated.

DevLab adds deterministic HLS and RTSP overlap, gap, restart, and packet-loss scenarios. Its README documents how browser automation must handle trusted user gestures for audible playback.

Validation

  • pnpm run type-check
  • pnpm run lint
  • pnpm run web-ui:build
  • cmake -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_AGGRESSIVE_OPT=ON
  • cmake --build build -j "$(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu)"
  • git diff --check

@stackia stackia force-pushed the codex/fix-ts-timestamp-continuity branch from 8c474eb to 4b4b174 Compare July 14, 2026 17:00
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Documentation preview

The documentation preview has been deployed for this pull request.

@stackia stackia marked this pull request as ready for review July 14, 2026 17:01
@stackia stackia merged commit c8a87f4 into main Jul 14, 2026
11 checks passed
@stackia stackia deleted the codex/fix-ts-timestamp-continuity branch July 14, 2026 17:11
stackia added a commit that referenced this pull request Jul 14, 2026
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