Skip to content

bug: libobs: push-to-talk delays can wrap and the audio balance isn't range-checked #2051

Closed

Description

@rdoupe

Bug

Two per-source audio values aren't range-checked, so a scene collection (or a plugin or script calling the API) can set values that break them.

  1. Push-to-mute / push-to-talk delay. The delays are kept in milliseconds as uint64_t. Scene collections store them as signed integers, so a negative value turns into a huge delay. source_output_audio_data then computes os_time + delay * 1000000, which wraps for large delays. The stop time can then land in the past or far in the future: push-to-talk stays open forever, or closes at once.
  2. Audio balance. obs_source_set_balance_value() and the scene-collection load accept any float. The balance laws assume 0–1. Outside that range the gains go negative, above 1, or NaN (for example, the sine law at a balance of 2 inverts a channel). obs-websocket's SetInputAudioBalance already checks 0–1, and the UI slider can't leave that range.

Found while scoping the audio ports (#1994/#2021). Upstream has the same code.

Plan

  1. RED: tests through the public API and a loaded scene collection.

    • A negative delay and a delay of UINT64_MAX / 1000000 + 1; the stop time must stay ordered.
    • Balances of -1, 2, NaN and ±inf, through the setter and through load.
  2. GREEN:

    • Saturate the delay-to-nanoseconds conversion and the stop-time sum.
    • Read a negative delay from a scene collection as 0.
    • Clamp the balance to 0–1 in the setter. NaN becomes the default of 0.5.

    Every value that is valid today keeps its behaviour. If the Rust audio input port (obs-source: Port the source audio input steps #2021) depends on the old out-of-range behaviour, update its characterization and parity together with this fix. obs-source: Port the source audio input steps #2021 pins out-of-range balances as "characterized, not endorsed".

Activity

  1. rdoupe commented on Oct 24, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: #2051.

  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