Repository navigation
perf(audio,mux): the bus skips comfort measurement, parameter sets adopt in linear time - #8349
Conversation
Quest-Claim: afa08bbd2b1d0b80
… sets in linear time Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 11 minutes. View limit details
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. |
There was a problem hiding this comment.
ℹ️ No critical issues — one stale doc line worth a look.
Reviewed changes
- Bus and AEC stop measuring comfort noise —
ring::Configgains a crate-privatecomfortflag; only the playback sink (and the test helpers that model it) enables it, so the bus and AEC reference rings skip the per-sample sum of squares. - Parameter sets adopt in linear time —
adopt_parameter_setsreplaces the per-set layer scan with a 64-bit mask plusBTreeMap::append, andreconcile_keyframe_paramsreuses the same mask. - Quest finished — deletes
quest/m0/nightly/bench-regressions.mdand its row in the parent README.
ℹ️ Read::Comfort's doc no longer matches the unmeasured case
rs/moq-audio/src/ring.rs:73-75 still says the rest of the buffer is "filled with comfort noise", and the module doc at rs/moq-audio/src/ring.rs:9-10 says a declared silence "fills it with comfort noise". With comfort: false the reader still returns Read::Comfort but fills plain silence, which the new an_unmeasured_declared_silence_is_silent test asserts. A short caveat on both ("when the queue measures") keeps the docs truthful for the configuration this PR adds.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed 450d86f. No actionable findings. Comfort measurement remains enabled for playback and is disabled for the bus/AEC rings; an unmeasured ring retains a zero comfort level. The parameter-set layer mask matches the six-bit H.265 layer domain (H.264 uses layer zero), preserving replacement within defined layers and retention of other layers.
Verification limits: GitHub-only static review. No builds, audio tests, codec tests or benchmarks executed; performance claims were not independently measured.

Explains and fixes the two Nightly benchmark regressions from quest/m0/nightly/bench-regressions.md, and finishes the quest.
Attribution
Paired measurement: each revision built in its own worktree and target directory, three alternating rounds, pinned to one P-core (Intel Core Ultra 7 270K), with Criterion at the BASE comparison's settings (1 s warmup, 2 s measurement, 30 samples). The numbers are the median of the paired deltas.
Bus: moq-dev/moq#8010 against its parent. All 22
bus_*cases are slower, and every round agrees in sign: +4% to +12% here (Nightly's aarch64 runner saw +16% to +29%). moq-dev/moq#8121 touches onlyencode/producer.rs, which the bus never runs (it borrows theInputtype), so it is not a candidate. The cause: every ring read now runsComfort::playedover each sample, a serial f64 sum of squares. That measurement exists to set comfort noise for a silence the writer declares, but only the playback sink's rings ever receiveend(). The bus and AEC reference rings never declare a silence, so they paid for it on every block. A build whereplayedreturns immediately recovers the whole regression, so the rest of #8010's ring changes cost nothing measurable.Parameter sets: moq-dev/moq#8199 against its parent.
h264-split-pps/distinctis +11% / +16% / +18% / +40% at n = 1 / 16 / 256 / 4096. moq-dev/moq#8140 changes only H.265 SPS parsing and is outside the H.264 split path. The cause:adopt_parameter_setsbecameretainplusextend, which inserts each set one at a time, where the old code made a single structuralclone_from. That is where the cost that grows with n comes from. Its layer test (sets.keys().any(...)for each retained set, and the same nesting inreconcile_keyframe_params'smissingcheck) is also O(retained × sets) once layers differ, which a hostile H.265 stream could drive.Changes
ring::Configgainscomfort: bool. Only the playback sink (and the test helpers that model it) sets it. A ring without it never measures what plays, and a silence declared on it fills with plain silence. The bus and AEC reference setfalse.adopt_parameter_setsusesBTreeMap::append, which moves the map in when the retained sets are emptied and merges in linear time otherwise. Both layer checks use a 64-bit mask (nuh_layer_idis 6 bits) instead of nested scans.Results (paired, this branch against main at 6724807)
bus_sources/48000hz/1, 4, 16, 64bus_sources/44100hz/1, 4, 16, 64bus_mixes/full/1, 4, 16, 64bus_mixes/sparse/1, 4, 16, 64bus_minus/*h264-split-pps/distinct/1, 16, 256, 4096h264-split-pps/repeated/*The bus returns to its pre-#8010 cost. That matches the bound from the build where
playeddoes nothing.distinctno longer grows with n. Compared across runs with #8199's parent, about +5% to +8% remains at every n. That remainder is the(layer, id)key #8199 introduced so an enhancement layer's sets never replace the base layer's. It is a correctness trade, accepted here and below the paired 10% threshold.Choices made without asking
u64, which would trade readability for a few percent.Caused by
Impact
Public API: none (
ring::Configis crate-private). Wire: none.Checks
just checkpassed (6312 tests), including the newan_unmeasured_declared_silence_is_silenttest.quest check --base origin/mainpassed.Follow-ups
None.
Models
Size: M
Implementer: Claude Code, Opus 5.5, medium effort
(Written by Opus 5.5 with medium)
🤖 Generated with Claude Code
Review
Rewritten by
quest reviewafter each round.01a1bf79-d64c-7482-8df8-9d0170620337, round 1The changes appear sound: the layer bitmask preserves parameter-set handling and comfort measurement remains enabled for playback, though builds and tests were not run as instructed.