Add opt-in tracing for audio voice submissions and completions #1046

Open
github-bot wants to merge 3 commits from github-bot/gh-1046 into main AGit
Owner

@⁠superboynick on GitHub · 2026-11-25 17:26 UTC · original
superboynick:feat/audio-trace → main · +144 −0 · 1 files · 3 commits · open

Listening tells you something is wrong with audio but not which of three states you are in: a fragment being replayed, a feed that stopped, or completions reported too early. This adds an opt-in trace that separates them.

Per voice and per submission it records the submitted byte count, the pending compressed bytes and active buffer count on the submission path, the read and write positions, a hash over the first 64 bytes of the submission, and whether completion was reported immediately or deferred. Two submissions with the same byte count and hash point at a replay; a submission counter that stops while the queue drains points at a starved feed.

The first version of this reported the per-voice playback counters, which are only advanced by the write-ring path and read zero on the coprocessor command path this title uses. The trace now reports the queue state that path actually maintains.

Rate limited to four lines per voice per second, with a dropped-line count every five seconds. Off by default: with VICTORY_TRACE_AUDIO unset nothing is timed, hashed or printed, and the audio code path is unchanged.

Verified on local runs with audio active: several thousand trace lines, none containing buffer contents (the hash covers 64 bytes only), with non-zero queue depth visible in the output. A run without the switch emits no trace lines.

**@⁠superboynick** on GitHub · 2026-11-25 17:26 UTC · [original](https://github.com/fxceless/victory-fork/pull/1046) `superboynick:feat/audio-trace` → `main` · +144 −0 · 1 files · 3 commits · open Listening tells you something is wrong with audio but not which of three states you are in: a fragment being replayed, a feed that stopped, or completions reported too early. This adds an opt-in trace that separates them. Per voice and per submission it records the submitted byte count, the pending compressed bytes and active buffer count on the submission path, the read and write positions, a hash over the first 64 bytes of the submission, and whether completion was reported immediately or deferred. Two submissions with the same byte count and hash point at a replay; a submission counter that stops while the queue drains points at a starved feed. The first version of this reported the per-voice playback counters, which are only advanced by the write-ring path and read zero on the coprocessor command path this title uses. The trace now reports the queue state that path actually maintains. Rate limited to four lines per voice per second, with a dropped-line count every five seconds. Off by default: with `VICTORY_TRACE_AUDIO` unset nothing is timed, hashed or printed, and the audio code path is unchanged. Verified on local runs with audio active: several thousand trace lines, none containing buffer contents (the hash covers 64 bytes only), with non-zero queue depth visible in the output. A run without the switch emits no trace lines.
Audio problems are hard to describe from listening alone: a repeated
fragment, a dropout and a stalled feed all sound similar. This records,
per voice and per submission, the submitted byte count, cumulative
samples produced and command blocks taken, the read and write positions,
a hash of the first 64 bytes of the submission, and whether completion
was reported immediately or deferred.

Rate limited to four lines per voice per second; overflow is counted and
reported every five seconds. Nothing is computed or printed unless
VICTORY_TRACE_AUDIO=1 is set, and the audio path itself is untouched.
The per-voice playback counters are only advanced by the write-ring path,
so on the coprocessor command path they read zero and the trace said
nothing useful. Report the pending compressed bytes and the active buffer
count for that path instead, which are updated where the submission is
made.
The trace uses the hash to decide whether two submissions carry the same
audio, so the hash has to be a known function: the published FNV-1a 64
vectors for the empty string, 'a' and 'foobar' are checked, along with the
two properties the trace relies on - bytes past the window cannot change
the answer, and a difference inside it must.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:56:35 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1046/head:github-bot/gh-1046'
git switch 'github-bot/gh-1046'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1046'
git switch 'github-bot/gh-1046'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1046'
git switch 'github-bot/gh-1046'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1046'
git switch 'main'
git merge --squash 'github-bot/gh-1046'
git switch 'main'
git merge --ff-only 'github-bot/gh-1046'
git switch 'main'
git merge 'github-bot/gh-1046'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.