fix(player): normalize MSE timelines across buffering and discontinuities#588
Conversation
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-588.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-588.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-588.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-588.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-588.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-588.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-588.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-588.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-588.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-588.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-588.eastasia.1.azurestaticapps.net |
There was a problem hiding this comment.
Pull request overview
This PR updates the web-ui MPEG-TS/fMP4 playback pipeline to prevent stalls by (1) pausing/resyncing software-decoded (PCM/WebAudio) audio during video buffering and (2) making remuxed output timestamps continuous across loader discontinuities to avoid MSE buffered-range holes.
Changes:
- Remuxer now preserves lightweight per-track timing state across discontinuities and bridges forward timestamp gaps onto a continuous output timeline; silent AAC generation is aligned to corrected video timing.
- PCM/WebAudio scheduling is gated on video readiness (waiting/stalled/playing/canplay), with buffering-triggered cancel/resync and a buffer-backed refill window.
- Removes startup “stall jumper” and the public
maxBufferHoleMsconfig (and related small-forward-seek shortcut).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| web-ui/src/mpegts/worker/pipeline.ts | Adds fMP4 timestampOffset derivation (tfdt-based) and maps decoded PCM timestamps via remuxer timing state. |
| web-ui/src/mpegts/remux/mp4-remuxer.ts | Implements per-track timing state to bridge holes across discontinuities and keeps silent AAC aligned with corrected video samples. |
| web-ui/src/mpegts/remux/mp4-generator.ts | Switches trun to version 1 so composition time offsets are encoded as signed values. |
| web-ui/src/mpegts/player/mse.ts | Removes onBufferedChange hook from the MSE abstraction. |
| web-ui/src/mpegts/player/mpegts-player.ts | Removes startup stall-jumper wiring; continues to pass timestampOffset through to MSE append path. |
| web-ui/src/mpegts/player/live-sync.ts | Deletes the StallJumper implementation and related tag constant. |
| web-ui/src/mpegts/demux/ts-demuxer.ts | Adds continuity-counter based discontinuity detection plus “drop until keyframe” gating to avoid emitting video before a usable keyframe. |
| web-ui/src/mpegts/config.ts | Removes maxBufferHoleMs (and maxBufferHoleSec) from config defaults and API surface. |
| web-ui/src/mpegts/audio/pcm-audio-player.ts | Stops scheduling PCM while video is buffering; resyncs from current video time; refills pending scheduling from the internal buffer window. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5abe8be901
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-588.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-588.eastasia.1.azurestaticapps.net |
| 0x01, | ||
| 0x00, | ||
| 0x0f, | ||
| 0x01, // version(0) & flags | ||
| 0x01, // version(1) & flags |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-588.eastasia.1.azurestaticapps.net |
Summary
This PR makes the web player treat MSE video, browser-decoded audio, silent AAC, and MP2 WebAudio output as one continuous playback timeline. It fixes MP2 soft-decoded audio repeating during MSE waiting, removes the old startup stall jumper, and normalizes TS/HLS timestamp discontinuities so packet loss, upstream PTS jumps, fMP4 tfdt offsets, and segment transitions do not create buffered range holes.
What changed
Validation