Skip to content

test(moq-gst): moqsrc plays every channel of surround Opus - #7228

Merged
kixelated merged 5 commits into
mainfrom
quest/m2/moqsrc-opus-surround
Nov 2, 2026
Merged

kixelated merged 5 commits into
mainfrom
quest/m2/moqsrc-opus-surround

Conversation

@kixelated

@kixelated kixelated commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m2/moqsrc-opus-surround.md and deletes it.

Summary

moq-dev/moq#6284 taught moqsrc to carry surround Opus caps but tested only mono and stereo. This PR adds the tests that prove surround playback. No library code changes.

  • surround_opus_caps_carry_the_family_1_mapping (unit): for every channel count from 3 to 8, audio_caps turns a family-1 OpusHead into channel-mapping-family, stream-count, coupled-count, and channel-mapping matching RFC 7845's Vorbis-order table. It also checks that the head is the first streamheader buffer.
  • surround_opus_plays_every_channel_through_a_relay (end to end): 5.1 S16 audio goes through appsrc ! identity sync=true ! opusenc ! moqsink, a loopback relay, moqsrc ! opusdec ! appsink. Each channel carries its own tone (440, 660, 880, 60 for the LFE, 1100, 1320 Hz). A Goertzel measurement checks that each decoded channel carries its own tone at more than half amplitude and every other tone at less than a twentieth. So a mapping that drops, duplicates, or swaps a channel fails the test, not just one that silences a channel.
  • The session tests' element registration moves into a register() helper that also registers moqsink.

The 2026-10-29 session's checkpoint fed one shared audiotestsrc tone to every channel. That version can't tell a correct mapping from a permuted one, so I replaced it with the per-channel tones above.

Verification

  • just check passes (moq-gst: 228 tests passed). The end-to-end test passed 8 runs in a row on a loaded host (~1 s each).
  • Mutation checks, both reverted:
    • Swapping two channel-mapping entries in opus_caps fails the unit test. The end-to-end test still passes, because opusdec reads the mapping from the streamheader OpusHead when one is present.
    • Making that same swap and also dropping the streamheader (so opusdec falls back to the caps) fails the end-to-end test: channel 0 lost its 440 Hz tone: [0.0, 0.0, 7985.0, 0.0, 1.0, 0.0].

Choices made without asking

  • I used distinct per-channel tones through appsrc, not the checkpoint's shared audiotestsrc tone, and needed no new dependencies (appsrc and identity come from core/base plugins).
  • opusenc bitrate=256000 keeps libopus from using intensity stereo, which would leak a tone between the channels of a coupled pair.

Review

  • Reviewer: Codex (quest review), gpt-6.1-sol, medium effort
  • Head: 3122c4a, base origin/main 24b0463
  • Round 1: no findings

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

@kixelated

Copy link
Copy Markdown
Collaborator Author

Closing this stale claim at the maintainer's request: it has held only the empty claim commit since 2026-10-29, with no work pushed. Closing it and deleting the branch frees the quest for a later /quest-start or /quest-spawn. The quest file itself is unchanged on main.

(Written by Claude Opus 5.5)

@kixelated kixelated closed this Nov 2, 2026
The session that claimed this quest stopped before committing. This
preserves its uncommitted changes as found on 2026-11-02; they are
unfinished and unreviewed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated reopened this Nov 2, 2026
@kixelated

Copy link
Copy Markdown
Collaborator Author

Reopened: the claim looked empty on GitHub, but its local worktree held uncommitted work from the 2026-10-29 session. That work is now pushed as checkpoint 6bf9df1 and marked unfinished under ## Decisions needed.

(Written by Claude Opus 5.5)

kixelated and others added 3 commits November 2, 2026 09:37
# Conflicts:
#	quest/m2/moqsrc-opus-surround.md
#	rs/moq-gst/src/source/imp.rs
A tone shared by every channel can't tell a dropped, duplicated, or swapped
channel from a correct mapping. Feed six distinct tones through appsrc and
check each decoded channel carries only its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title moqsrc plays surround Opus, under test test(moq-gst): moqsrc plays every channel of surround Opus Nov 2, 2026
@kixelated
kixelated marked this pull request as ready for review November 2, 2026 18:28
@coderabbitai

coderabbitai Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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 10 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9ac373a2-2b08-4dab-9b3d-fd0c09e42c18
Commits

Reviewing files that changed from the base of the PR and between 96244dd and 3122c4a.

Files selected for processing: 3
  • quest/m2/README.md
  • quest/m2/moqsrc-opus-surround.md
  • rs/moq-gst/src/source/imp.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)

Reviewed commit: 3122c4a

No actionable bugs found. The test-only direction is appropriate: table-driven 3–8-channel caps checks cover mapping metadata, while distinct per-channel tones through the existing relay harness detect dropped, duplicated, or permuted 5.1 channels. This adds useful coverage without changing library behavior or introducing dependencies. No public API or wire changes.

Verification limits: static source review only. I did not run builds, GStreamer playback tests, or the reported mutation/repeatability checks.

(Written by OpenAI)

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Surround caps unit test: surround_opus_caps_carry_the_family_1_mapping builds a family-1 OpusHead for channel counts 3 through 8 (RFC 7845 Vorbis order), runs audio_caps, and asserts channels, channel-mapping-family, stream-count, coupled-count, channel-mapping, and that the first streamheader buffer is the encoded head. This fills the previously untested Some(mapping) branch of opus_caps, since the existing caps test only covered family 0.
  • End-to-end surround playback test: surround_opus_plays_every_channel_through_a_relay pushes per-channel tones through appsrc ! identity sync=true ! opusenc ! moqsink, a loopback relay, moqsrc ! opusdec ! appsink, then uses a Goertzel measure per channel to require its own tone above half amplitude and every other tone below a twentieth. That catches a dropped, duplicated, or swapped channel, not just silence.
  • Session test harness: register() is extracted and now also registers moqsink, and pipeline() routes through it. No other test registers moqsink, so there is no double registration.
  • Quest housekeeping: deletes quest/m2/moqsrc-opus-surround.md and removes its m2/README.md entry.

The mapping tables in the unit test match both moq_mux::codec::opus::mapping::VORBIS and RFC 7845 §5.1.1, and the Goertzel normalization (2*sqrt(power)/N) yields the peak amplitude, so the A/2 and A/20 thresholds are the intended margins. The 30s deadline reads kio::clock::now(), and the test runs on real GStreamer threads, consistent with the other relay tests. opusdec's src template in the pinned GStreamer is S16LE only, so the AudioFormat::S16le assertion holds.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit d5cf115 Nov 2, 2026
11 checks passed
@kixelated
kixelated deleted the quest/m2/moqsrc-opus-surround branch November 2, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant