Skip to content

test: Check the samples PulseAudio monitoring plays at each sink format - #1728

Merged
zackees merged 1 commit into
obs-rust:masterfrom
rdoupe:test/pulse-monitor-samples
Oct 22, 2026
Merged

zackees merged 1 commit into
obs-rust:masterfrom
rdoupe:test/pulse-monitor-samples

Conversation

@rdoupe

@rdoupe rdoupe commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Refs #1697

What and why

The deliberate-break check of #1721 (the Rust port of the PulseAudio monitor format and volume code) found that no PulseAudio test looks at sample values. With the s16 saturation from #1709 replaced by a wrap in the Rust conversion, all 14 test_pulse* tests still passed in hybrid. This adds the missing end-to-end check. Test only: no libobs or Rust change.

  • test_pulse_monitor_samples runs libobs audio monitoring against the private PipeWire + WirePlumber + pipewire-pulse server that test_pulse_monitor_device.sh starts (own runtime dir, config and D-Bus, no hardware). It is registered the same way (tests.d, OS_LINUX AND ENABLE_PULSEAUDIO, skip 77).
  • For each of s16le, s32le, u8 and float32le it loads a null sink in that format and checks that the sink really has it. It records the sink's monitor with parec, in the same format, and plays a constant +0.75 (left) / -0.75 (right) at source volumes 0.5, 1 and 2, 0.3 s each.
  • Each expected level must show up in the recording for at least 0.1 s, within half an LSB or so (1.5 steps for u8). The test doesn't assume where a level starts, so start-up silence and latency don't matter. At volume 2 the integer formats must sit on their rail (+32767/-32768, INT32_MAX/INT32_MIN, 255/0). Float isn't clamped, so it must read +1.5/-1.5. If a level is missing, the test prints the recording's most common frames.
  • Skips (77) when PipeWire, WirePlumber, pipewire-pulse, pactl or dbus-run-session are missing (the wrapper), or when parec is (the test). About 7 s per run.

On master the test covers the C code. Once #1721 lands it also covers the Rust code in hybrid.

Headless (private Xvfb, private D-Bus, fresh HOME, private PipeWire), RelWithDebInfo:

Build libobs Case Result
master + this test, C backend libobs clean 5/5 pass
master + this test, hybrid libobs clean 5/5 pass
master + this test, hybrid libobs-c-reference clean 5/5 pass
master + this test, C backend libobs C process_s16 wraps ((int16_t)(int32_t)v) 1/1 FAIL: monitor_samples_s16le
#1721 head 8c01349 + this test, hybrid libobs clean 5/5 pass
#1721 head 8c01349 + this test, hybrid libobs-c-reference clean 5/5 pass
#1721 head 8c01349 + this test, hybrid libobs Rust scale_s16 wraps ((v as i32) as i16) 5/5 FAIL: monitor_samples_s16le
#1721 head 8c01349 + this test, hybrid libobs-c-reference same Rust mutant (C unaffected) 5/5 pass

With either wrap mutant the s16le recording holds L -0.5 / R +0.5 at volume 2 (-16384/+16384) instead of +32767/-32768. The 0.5 and 1 plateaus are exact (0.375 and 0.75).

RED → GREEN

Checklist

  • Base is master (or the description starts with a Stacked: note)
  • I claimed the issue, or no one else has an open PR for it
  • Characterization test (if the unit had none), then RED, then GREEN commits (N/A for docs-only; a focused CI fix may push RED and GREEN together)
  • User-visible change: its line in docs/features.md is added or updated (not applicable: no user-visible change)
  • (Optional) Local gate passed and the pushed head is stamped; otherwise PR CI runs the full suite
  • Warning or flag changes (-W..., ratchets): built with scripting ON (PR CI builds no OBS app: run gh workflow run ci.yml --ref <branch> for the full builds) and cross-checked with clang and MSVC
  • Intentional differences from C listed in the parity test header and rust/README.md (ports)

None of the PulseAudio tests looked at sample values: with the s16
saturation (obs-rust#1709) replaced by a wrap in the Rust port of obs-rust#1721, all 14
test_pulse* tests still passed in hybrid.

test_pulse_monitor_samples runs libobs monitoring against the private
PipeWire server of test_pulse_monitor_device.sh. For null sinks in s16le,
s32le, u8 and float32le it plays a constant +0.75 / -0.75 at source
volumes 0.5, 1 and 2 and records the sink's monitor with parec. Each
expected level must be in the recording for at least 0.1 s, wherever it
starts: the integer formats at their rail at volume 2, float at 1.5. It
skips (77) without PipeWire, the pulse tools or parec.

Refs obs-rust#1697
@rdoupe
rdoupe requested a review from zackees as a code owner October 22, 2026 05:51
@zackees
zackees added this pull request to the merge queue Oct 22, 2026
Merged via the queue into obs-rust:master with commit 5d0f6a7 Oct 22, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants