fix(tui): honor realtime audio backpressure before draining queued chunks (#2122) - #2574
Open
turkonthelurk wants to merge 1 commit into
Open
turkonthelurk wants to merge 1 commit into
turkonthelurk wants to merge 1 commit into
Conversation
…unks Stop flush from writing again while stdin is waiting for drain so the 512 KiB playback queue stays under application control. Resume only from the drain handler, drop oldest queued frames when the cap is exceeded, and detach the listener on error, close, and format change. Co-authored-by: turk <turkonthelurk@users.noreply.github.com>
|
This was referenced Sep 18, 2026
turkonthelurk
marked this pull request as ready for review
September 18, 2026 10:49
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.



Closes #2122
Draft for review only. Not to be merged by automation; a maintainer decides when and whether it lands. Opened from fork
turkonthelurk/agenc-core. Nothing pushed tomainon either repo. Based on upstreammainonly. Independent of #2113 / draft #2573 and #2123. Does not enable production realtime admission.Problem
createProcessRealtimeAudioPlayerrecorded stdin backpressure (waitingForDrain) butflush()did not return while that flag was set. Every laterenqueueBuffer()calledflush()again, sostdin.writekept going after afalsereturn and bypassed the managed 512 KiB queue.Verified on upstream
mainat6a2a92d: a fake stdin that always returnsfalseaccepted all twenty 64 KiB chunks (1,310,720 bytes) before anydrain.Change
flush()returns immediately whilewaitingForDrainis true.drainhandler (and ignore a stale child after reset).Tests
Hermetic Vitest, fail-before / pass-after:
draindrain; afterdrain, only the newest 512 KiB is flushedtests/tui/realtime: 7 files, 57 passedThis does not merge and does not enable production realtime admission.
Opened from fork
turkonthelurk/agenc-core. Companion fork PR (to close): turkonthelurk#17