Reduce initial playback stutter#69
Merged
Merged
Conversation
…low keepalive Two changes give the decode pipeline more slack at stream start: - Insert extra silence after the first playback notification, before the first decoded chunk reaches the sink, so the decoder has time to stay ahead. The amount is configurable via PlayerRoleConfig::extra_startup_silence_ms (default 50 ms; 0 disables). - On encoded ring-buffer underflow, feed silence to keep the DAC fed instead of letting it run dry. Gated on `aligning` so it only runs during startup/post-seek alignment, not in steady state where stuffing silence at stream end would pile up in the sink and delay a rapid restart. Adds the frame_aligned_silence_bytes() helper and fill_underflow_silence() to keep the sync task readable, and documents the behavior in the integration guide and internals docs.
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR reduces initial playback stutter by adding configurable extra startup silence and by bridging encoded-chunk underflows with short silence writes during alignment (startup/post-seek), keeping the DAC fed until data arrives.
Changes:
- Add
extra_startup_silence_mstoPlayerRoleConfigand document it in integration docs. - Introduce frame-aligned silence sizing and queue/drain extra startup silence after the first playback-progress callback.
- During alignment, feed short “keepalive” silence slices on ring-buffer underflow to avoid DAC underruns.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/sync_task.h | Declares fill_underflow_silence() and documents the new underflow-bridging behavior. |
| src/sync_task.cpp | Implements frame-aligned silence calculation, extra startup silence draining, and alignment-only underflow silence fill. |
| include/sendspin/config.h | Adds new public config knob extra_startup_silence_ms with a default. |
| docs/internals.md | Updates state-machine docs to describe extra startup silence and alignment-only underflow fill. |
| docs/integration-guide.md | Documents the new configuration option and shows it in example config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two changes give the decode pipeline more slack at stream start:
PlayerRoleConfig::extra_startup_silence_ms(default 50 ms; 0 disables).aligningso it only runs during startup/post-seek alignment, not in steady state where stuffing silence at stream end would pile up in the sink and delay a rapid restart.Adds the frame_aligned_silence_bytes() helper and fill_underflow_silence() to keep the sync task readable, and documents the behavior in the integration guide and internals docs.
Breaking change: the
PlayerRoleConfighas been modified with a new field inserted in the middle.