Skip to content

server: realtime API: send complete after committed audio drains - #30994

Merged
ngxson merged 2 commits into
masterfrom
xsn/realtime_api_fix
Oct 22, 2026
Merged

ngxson merged 2 commits into
masterfrom
xsn/realtime_api_fix

Conversation

@ngxson

@ngxson ngxson commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Overview

Fix #30968

Requirements

Completion is triggered when the stream runs dry, which is a timing
proxy: audio appended while the tail drains leaks into the committed
item, a final commit before the drain merges both items, and back to
back commits collapse into one.

mtmd_audio_stream_flush() records the row count at the end of the
flushed audio (mtmd_audio_stream_get_n_rows_flushed), next to the rows
produced so far (mtmd_audio_stream_get_n_rows). The slot keeps a FIFO
of these end rows and completes each commit once every row up to it is
decoded.
@ServeurpersoCom
ServeurpersoCom requested a review from a team as a code owner October 22, 2026 20:19
@github-actions github-actions Bot added the mtmd Related to multimodal functionality (video/image/audio) label Oct 22, 2026
@ServeurpersoCom

Copy link
Copy Markdown
Contributor

Tested on Voxtral Realtime Q8_0 with jfk.wav split at the pause: the nominal case works, but n == 0 is a timing proxy rather than the commit boundary, so three cases go wrong: audio appended while the tail drains ("Ask what you can do for your" lands in the committed item), a final commit before the drain (both items merge into one completed), and two back to back commits (one item for two commits).

I pushed a fix on this branch that keeps the PR's architecture (the audio_commit_drained marker and the deferred completed in the route) and only changes what triggers the marker: the end row is recorded at flush time (two small getters in mtmd, n_samples / samples_per_tok once the padding is added) and a FIFO of targets in the slot fires it once every row up to it is decoded. This is T0mSIlver's option (a) inside your structure, all three cases are fixed, deterministic over 3 runs.

@ngxson
ngxson merged commit d814cbb into master Oct 22, 2026
13 checks passed
auRose94 pushed a commit to auRose94/llama.cpp that referenced this pull request Oct 28, 2026
…l-org#30994)

* server: realtime API: send complete after committed audio drains

* server: realtime API: complete a commit at its end row

Completion is triggered when the stream runs dry, which is a timing
proxy: audio appended while the tail drains leaks into the committed
item, a final commit before the drain merges both items, and back to
back commits collapse into one.

mtmd_audio_stream_flush() records the row count at the end of the
flushed audio (mtmd_audio_stream_get_n_rows_flushed), next to the rows
produced so far (mtmd_audio_stream_get_n_rows). The slot keeps a FIFO
of these end rows and completes each commit once every row up to it is
decoded.

---------

Co-authored-by: Pascal <admin@serveurperso.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mtmd Related to multimodal functionality (video/image/audio) server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misc. bug: server: realtime commit completes the item before the flushed words are decoded

2 participants