Skip to content

bug: libobs: a NaN or negative source volume isn't rejected and breaks every mix the source is in #2108

Closed

Description

@rdoupe

Bug

A source's volume is never range-checked. obs_source_set_volume() stores any float, and so does the scene-collection load in obs_load_source() (libobs/obs.c.h, "volume").

  • NaN: a NaN volume passes the snap in get_source_volume(), so every sample of that source becomes NaN. NaN spreads through addition, so every mix the source is in becomes NaN too: the whole track goes silent or turns to noise, depending on the output.
  • Negative: a negative volume inverts the phase.
  • Infinite: ±inf gives inf or NaN samples, the same as NaN.

The Mixer UI and obs-websocket's SetInputVolume only produce valid values, so this needs an edited scene collection, a plugin or a script. Upstream has the same code. Found while scoping round 6 of the Rust port (R6-1). It's the volume counterpart of #2051, which clamped the balance.

Plan

  1. RED: tests through the setter and a loaded scene collection, with volumes of NaN, -1, ±inf, 0, 1 and a large finite value. They check the getter and that the source's mixed audio stays finite. test_source_audio_ranges (libobs: Saturate push-to-talk stop times and clamp the audio balance #2058) is a model.
  2. GREEN: in the setter and on load, turn NaN into the default 1.0 and clamp negative values to 0, matching libobs: Saturate push-to-talk stop times and clamp the audio balance #2058's balance clamp. Pick and document a sane upper bound for infinity: the largest value the UI or websocket allows, or no clamp for finite values. Every value that is valid today must behave exactly as before.

Activity

  1. rdoupe commented on Oct 24, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: #2108.

  2. added
    claimed
    on Oct 24, 2026
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

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions