Recovering from a device outage reports a sync error and plays silence for the swallowed lookahead
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Active
- Tech stack
- cpp
- Domain
- audio-video-rtc, cli
Research direction
Start by reading the existing write() deadline and wait-slice behavior, then trace SyncTask::process_playback_progress during device recovery. Compare the four sink implementations and the mentioned sendspin-cpp alignment API before choosing an approach. Done requires an agreed recovery behavior that avoids the reported error and long silence, with scope confirmed for all affected sinks.
Written by the indexing model from the issue text.
Description
Split off from #55, which fixes the #54 playback-clock bug for ALSA. The recovery is correct and bounded now, but it still costs one sync error and a long silence.
What happens
Measured on #55's hardware test, a 14 s USB DAC replug at 48 kHz:
- While the device is absent,
write()swallows audio immediately. Nothing back-pressures the sync task, so it drains its decode pipeline and keeps feeding whatever arrives. The stream pointer ends up ahead of real time by the server's send-ahead. - At reopen, the retired outage gap resets the playtime estimate to the device's finish timestamp (
SyncTask::process_playback_progress). The playhead is correct from here on. - The next chunk is not due for about 10.8 s, far past the 5 ms
HARD_SYNC_THRESHOLD_US, so the sync task reports ERROR once (Lost sync (10840302us off)) and inserts silence until the timeline catches up. Sync is regained roughly 11 s later.
So it is one bounded event rather than the loop #54 reported, but an operator still sees an ERROR state and about 11 s of silence after every recovery.
Two ways to avoid it
1. Pace the discard (this repo). While the device is absent, consume audio at roughly real time — waiting out write()'s existing deadline rather than returning at once — so the pipeline keeps its lookahead and the stream pointer stays near real time. The correction at reopen then lands inside the soft-sync range and nothing reports an error. write() already has a deadline and waits in slices, so the shape is there. The risks are a sink that blocks longer than the player expects during an outage, and that it should apply to all four sinks (#58).
2. Signal the outage to the library (needs sendspin-cpp). The sync task already suppresses the ERROR state while aligning, for initial sync and post-seek alignment. A sink that reported "I lost the device and have retired the gap" could get one silent realignment instead of an ERROR/SYNCHRONIZED pair. That needs an upstream API, so it would carry Requires-Upstream.
Option 1 shortens the silence as well as removing the error; option 2 only relabels it. Worth deciding which behaviour is wanted before implementing either.
- Dominant language
- C++
- Stars
- 3
- Forks
- 3
- Avg merge
- 5h 26m
- Merged PRs (30d)
- 35
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Sendspin/sendspin-cpp-cli
-
Difficulty 3/5 1-2 days Newbie friendliness 78/100
Sendspin/sendspin-cpp-cli#70 ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Sendspin/sendspin-cpp-cli#32 · 1 comment ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 38/100
Sendspin/sendspin-cpp-cli#30 · 3 comments ·
All issues in Sendspin/sendspin-cpp-cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
gazebosim/gz-sensors#662 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
LadybirdBrowser/ladybird#12123 ·