Skip to content

fix(player): smooth mp2 audio sync correction#570

Merged
stackia merged 4 commits into
mainfrom
codex/mp2-soft-sync
Jun 24, 2026
Merged

fix(player): smooth mp2 audio sync correction#570
stackia merged 4 commits into
mainfrom
codex/mp2-soft-sync

Conversation

@stackia

@stackia stackia commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

Smooths initial MP2 software audio synchronization by preferring WSOLA ratio correction over rebuilding the WebAudio chain. Hard resync is now reserved for large discontinuities, while startup and larger-but-recoverable drift use a wider temporary correction window before returning to steady-state drift control.

Also fixes the fresh /player mount path after always enabling MP2 software decoding: the segments effect now lets handleLoadSegments() perform the lazy active-slot player creation instead of returning before any MediaSource/player exists.

It also ignores expected interrupted play() AbortErrors caused by superseded load requests, without swallowing autoplay NotAllowedErrors.

The old PCM passthrough stretcher fallback has been removed. If WSOLA cannot be created, software-decoded PCM now fails explicitly instead of entering a no-rate-matching mode that cannot converge soft sync drift.

This keeps channel switches fast because audio still starts immediately, but avoids clipping/rebuilding the chain for normal startup drift. The PR intentionally excludes src/embedded_web_data.h.

Validation

  • pnpm exec biome check web-ui/src/mpegts/audio/wasm-stretcher.ts web-ui/src/mpegts/audio/pcm-audio-player.ts web-ui/src/components/player/video-player.tsx
  • pnpm run type-check:tsc

Notes

I did not run pnpm run web-ui:build after this update because this PR should not include regenerated embedded web assets.

@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-570.eastasia.1.azurestaticapps.net

@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-570.eastasia.1.azurestaticapps.net

@stackia stackia marked this pull request as ready for review June 24, 2026 15:42

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c8f1b14e73

ℹ️ 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".

Comment thread web-ui/src/mpegts/audio/pcm-audio-player.ts
@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-570.eastasia.1.azurestaticapps.net

@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-570.eastasia.1.azurestaticapps.net

@stackia stackia merged commit b6b07cc into main Jun 24, 2026
10 checks passed
@stackia stackia deleted the codex/mp2-soft-sync branch June 24, 2026 15:55
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