Repository navigation
Description
Follow-up of our #194 (#190, upstream obsproject/obs-studio#10808 and #12835). #194 fixed how PulseAudio packets that arrive in bursts are timed, and two Audio Input Capture sources on one device are clean at the default graph quantum. The release check found what's left: when the PipeWire graph runs at a quantum of 2048 or more (any app that asks for a large latency can raise it), the second source on the same device is mostly silent in recordings, with dozens of Audio timestamp for '...' exceeded TS_SMOOTHING_THRESHOLD lines. The first source is clean.
Location
plugins/linux-pulseaudio/pulse-wrapper.cpulse_stream_new()creates every source's record stream on the plugin's one sharedpa_context, so all captures go over a single connection to the sound server.- pipewire-pulse delivers the second record stream of a connection unevenly at such quanta: nothing for seconds at a time (measured up to 6.9 s), then everything it held at once. OBS can buffer at most about a second of audio, so most of what arrives after a hold is too late and the track goes silent. The audio isn't lost: OBS's log shows nearly every frame arriving (
pulse-input: Got N packets). - The same two streams on two connections are delivered evenly. This was checked outside OBS with a small libpulse client that reads like pulse-input (25 ms fragments, one peek per callback): one connection with two streams gave the second stream 4 to 9 holds over 0.3 s in 20 s (up to 5.8 s), and two connections gave 0 at quanta 2048, 4096 and 8192.
parectwice gave the same result.
Class
Audio missing from recordings and streams (no crash).
How it is reached
Two Audio Input Capture sources on the same PulseAudio/PipeWire device (for example a microphone captured twice with different filters, or two captures of a monitor), while the graph quantum is 2048 or more.
Reproduced in the current release
AppImage 33.0.0-beta6-799-gd711a972c, headless: private PipeWire 1.6.8 + WirePlumber + pipewire-pulse, a null sink dev, pw-metadata -n settings 0 clock.force-quantum 2048, a 48 kHz sample-counter ramp played into dev, two Audio Input Capture sources on dev.monitor on tracks 1 and 2, 30 s recording, both tracks checked for silence and breaks in the ramp:
- track 1 (first source): 0 % silent, 0 breaks;
- track 2 (second source): 80 %, 69 % and 44 % silent in 3 runs, with 26 to 41 breaks and 63 to 94
TS_SMOOTHING_THRESHOLDlines.
The second track also breaks at quantum 4096 and 8192: in single runs with the same plugin code rebuilt from master it was 6 % and 35 % silent, with 17 and 78 TS_SMOOTHING_THRESHOLD lines, and the release check measured 69 % to 79 %. At quantum 1024 both tracks are clean.
Proposed fix and failing test
Fix: pulse_stream_new() connects a context of its own for each stream, on the same mainloop, and a new pulse_stream_free() ends the stream and its connection together. The shared connection keeps serving device lists, server info, events and reconnects.
RED test (cmocka, test_pulse_two_sources): the capture code runs against a private PipeWire + WirePlumber + pipewire-pulse stack (test_pulse_monitor_device.sh), with two captures on the monitor of a null sink. It checks that the two record streams belong to different clients, and that at quantum 2048 neither capture goes 500 ms without a packet over 10 s. Today both fail: the captures share one client, and the second capture waits 2.1 to 4.4 s for packets (5 of 5 runs) while the first never waits more than 47 ms.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 13, 2026
Claiming: this issue.
test_pulse_two_sourcesruns two captures on one device against a private PipeWire stack. It checks that they record over separate connections, and that at quantum 2048 neither goes 500 ms without audio. Today they share one connection, and the second capture waits 2 to 4 s for packets.PR today.
test/cmocka: Add a failing test for two captures on one device
linux-pulseaudio: Give each capture stream a connection of its own
linux-pulseaudio: Give each capture stream a connection of its own (o…