Fix audio buffer handling to reduce playback stalls and desync - #13
Conversation
A 2.5 hour field log at the 120ms default: 287 underruns, max_gap 1711ms, and repeated cycles of buffer runs dry -> concealment -> backlog burst -> drain. Each cycle inflated the audio->OBS offset by about a second, which holds video back by the same amount to keep lip sync: paced went from its usual 2-3 frames to 29 (86MB, ~1s of video) at the spike, then unwound over ~17s at +5%. So a 1.7s uplink stall turned into roughly twenty seconds of disturbed playback, on top of the frames the sender's ABR had already dropped. Riding the stall out instead of concealing it is the only thing that stops that chain, and the cushion could not be set high enough to do it: the setting stopped at 500ms. Raising it alone would have broken the source outright. The read loop's bleed ceiling is min(buffer_max*3, 1000ms) and priming waits for target plus the OBS output lead, so above a ~920ms target the ceiling sits below the prime threshold: the read loop stops before the buffer can ever reach it and playback never starts. Nothing hit it because the setting stopped at 500ms. Floor the ceiling at buffer_max + 100 so it always clears priming, which changes nothing at any target up to ~700ms and makes the rest reachable. Also raise the pacing byte ceiling to 512MB. Pacing holds one buffer's worth of decoded video, so the two settings are coupled: a 2s target at 1080p60 is 120 frames, ~372MB. Past the ceiling frames go out early, which is the desync this branch spent its time removing. Default settings are unaffected — the same log shows 8MB steady. None of this fixes the sender dropping frames under ABR, which is where the freezes in that log start: video arrivals fell to 711 frames per 30s against 900 nominal. It stops the plugin from adding a second of held video and twenty seconds of catch-up on top of every one of them.
|
Warning Review limit reached
Next review available in: 24 minutes Limit details: You’ve used all 1 included review currently available under your plan. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
No description provided.