Skip to content

Reduce scheduling horizon on Cast - #83

Merged
maximmaxim345 merged 2 commits into
mainfrom
fix/cast-runtime-scheduling
Apr 13, 2026
Merged

maximmaxim345 merged 2 commits into
mainfrom
fix/cast-runtime-scheduling

Conversation

@maximmaxim345

Copy link
Copy Markdown
Member

When running on Cast receivers, AudioProcessor now uses a much shorter scheduling horizon.
This seams to reduce stuttering and disconnects, especially on the Nest Hub.
Total buffer size stays the same; the scheduling horizon just limits how much in advance audio is passed to the browser’s playback pipeline.

Copilot AI 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.

Pull request overview

Adjusts AudioProcessor scheduling behavior specifically for Google Cast receiver runtimes to reduce stuttering/disconnects by limiting how far ahead audio is scheduled into the browser playback pipeline.

Changes:

  • Added Cast runtime detection (CrKey user agent) in SendspinPlayer.
  • Threaded an isCastRuntime flag into AudioProcessor.
  • Introduced much shorter Cast-specific scheduling horizon constants and applied them in horizon selection logic.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/index.ts Detects Cast runtime and passes the flag into AudioProcessor construction.
src/audio-processor.ts Adds Cast-specific horizon constants and selects shorter scheduling horizons when running on Cast.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/index.ts Resolved
Comment thread src/audio-processor.ts Resolved
@maximmaxim345
maximmaxim345 merged commit 22211e2 into main Apr 13, 2026
2 checks passed
@maximmaxim345
maximmaxim345 deleted the fix/cast-runtime-scheduling branch April 13, 2026 07:18
balloob pushed a commit that referenced this pull request Apr 13, 2026
Port two upstream bug fixes into the modular Core/Scheduler architecture:

- #83 Reduce scheduling horizon on Cast: Add CAST_SCHEDULE_HORIZON_*
  constants and isCastRuntime parameter to AudioScheduler. Cast
  receivers now use shorter horizons (1.5s/1s/0.5s) to reduce
  stuttering.

- #84 Reduce playback gaps after disconnects: Add
  measureBufferedPlaybackRunwaySec() and refill scheduling to
  AudioScheduler. SendspinPlayer defers playback reset on disconnect
  until buffered audio is exhausted, using new onConnectionOpen/
  onConnectionClose events from Core.

https://claude.ai/code/session_018UYYEXUZVuQ2Z4Texa7W6m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants