Skip to content

bug: libobs: audio monitoring leaves the chosen device when the default output changes (upstream #10342) #274

Closed

Description

@rdoupe

Upstream OBS bug, reported by gentoo-root in obsproject/obs-studio#10342. Code unchanged in this fork.

Location

  • libobs/audio-monitoring/pulse/pulseaudio-output.c:438: the monitoring playback stream is connected to the chosen sink by name, but without PA_STREAM_DONT_MOVE, so the sound server is free to move it when the system's default output changes. The capture side already asks it not to for non-default devices (linux-pulseaudio).

Class

Wrong output device: monitored audio leaves the device chosen in Settings → Audio → Advanced → Monitoring Device.

How it is reached

On Linux with PulseAudio or PipeWire (pipewire-pulse), choose a specific monitoring device, then change the system's default output (for example plugging in headphones or switching in the desktop's sound settings). OBS's monitoring stream follows the new default although the setting still names the other device, and stays there until the setting is touched.

Reproduced end to end with libobs against a private PipeWire 1.6.8 + pipewire-pulse + WirePlumber 0.5.17 server with two null sinks: monitoring on sink A, default changed to sink B, the monitoring stream moves to sink B.

Proposed fix and failing test

Fix: connect the stream with PA_STREAM_DONT_MOVE unless the monitoring device is "default". An unmovable stream no longer follows its sink away on unplug either, so OBS takes that over: on sink events it reopens the stream on the default sink when the chosen one is removed, and back on the chosen sink when it returns. Sink events are handled on their own task queue, never on the pulse mainloop thread.

RED tests:

  • test_pulse_monitor_device (end to end, private PipeWire server; skipped where PipeWire, WirePlumber or pipewire-pulse are missing): the chosen device must stay when the default changes (fails today), "default" must follow the default, and an unplugged device must fall back and return.
  • test_pulse_monitor_flags: the flag and reset decisions in isolation (3 of 5 fail today).

Activity

  1. rdoupe commented on Oct 11, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: this issue.

    1. RED: test_pulse_monitor_device (end to end on a private PipeWire server; the chosen device does not survive a default change today) and test_pulse_monitor_flags (3 of 5 failing).
    2. GREEN: PA_STREAM_DONT_MOVE for a chosen device, plus fallback to the default sink on unplug and return on replug, handled from sink events.
      PR today.
  2. added a commit that references this issue on Oct 11, 2026
    9295370
  3. rdoupe commented on Oct 11, 2026

    @rdoupe
    CollaboratorAuthor

    @gentoo-root you reported this in obsproject/obs-studio#10342, so a heads-up: it's fixed here in obs-rust by #275, merged today with a regression test.

    Cause: OBS connected the monitoring stream to the device you chose, but without asking the sound server not to move it, so PulseAudio (and PipeWire's pipewire-pulse) moved it along with every other stream whenever the default output changed. Now the stream is pinned to the chosen device, and "Default" still follows the default. Pinning also stops the server from rescuing the stream on unplug, so OBS now does that itself: if the chosen device disappears it plays on the default device, and it switches back when the device returns. The test runs OBS's monitoring against a private PipeWire server with two sinks: before, changing the default moved monitoring to the other sink; now it stays, and unplug and replug fall back and return.

    Workaround on stock OBS: re-select the monitoring device in Settings → Audio → Advanced after the default output changes.

    obs-rust is an AI-assisted fork of OBS; on Arch it's obs-studio-rust-git in the AUR.

    If you try it, a short reply here on whether monitoring stays on your device would really help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions