Skip to content

bug: obs-transitions: Fade to Color with a switch point of 0% or 100% produces NaN audio #488

Closed

Description

@chriscoveries

Summary

The Fade to Color transition's "Peak Color Point" slider allows 0 and 100, but at either end the audio gain computes 0/0 and returns NaN. The NaN is multiplied into the program audio mix, so program audio can drop out or distort at the start (0%) or end (100%) of the transition. Severity: medium. It only affects those two slider values, but a NaN in the audio mix spoils everything downstream of it.

Steps / trigger

  1. Add a Fade to Color transition and set "Peak Color Point" to 0 (or to 100).
  2. Switch scenes with that transition while audio is playing.
  3. The first samples of the transition (at 0%) or the last samples (at 100%) are mixed with a NaN gain. Anything downstream of the mix, such as meters, filters and encoders, sees NaN samples.

Cause

Line numbers are against current master.

  • plugins/obs-transitions/transition-fade-to-color.c:172: the slider range is 0, 100, and :52-59 turns it into switch_point in [0, 1].
  • plugins/obs-transitions/transition-fade-to-color.c:36-40: smoothstep(min, max, x) computes (x - min) / (max - min) with no check for min == max. At a switch point of 0 it is smoothstep(0, 0, t), and at 100 it is smoothstep(1, 1, t). At x == min this is 0/0 = NaN, and clamp passes NaN through because both comparisons are false.
  • plugins/obs-transitions/transition-fade-to-color.c:143-149, :151-157: mix_a is NaN at t == 0 for a 0% switch point, and mix_b is NaN at t == 1 for 100%.
  • libobs/obs-source-transition.c:869: out[i] += in[i] * mix(...) adds in[i] * NaN into the mix. Even a silent input (0 * NaN) gives NaN.
  • libobs/obs-source-transition.c:446-462: calc_time returns exactly 0.0f before the transition starts and 1.0f once it has ended, so those exact values occur on real audio samples.

The plugin is C only, so ON and OFF behave the same. The test I wrote does not measure how long the audible dropout lasts. It checks the gain and the summed sample values.

Proposed fix

Guard the equal-edge case in smoothstep: when min == max, return x >= max ? 1.0f : 0.0f. That is a finite step at the collapsed edge. The unequal-edge arithmetic is unchanged. The regression test configures the real plugin through its update callback and checks both gain callbacks at switch points 0, 50 and 100 for finite values, the expected curve at times 0, 0.25, 0.5, 0.75 and 1, and a finite, non-silent sum.

I'd like to work on this; a fix with a regression test is ready.

Activity

  1. zackees commented on Oct 13, 2026

    @zackees
    Member

    @chriscoveries go ahead: please open the PR with the RED test commit first, then the fix (one PR per issue, targeting master). Marking it claimed for you so nobody duplicates it.

  2. added
    claimed
    on Oct 13, 2026
  3. chriscoveries commented on Oct 14, 2026

    @chriscoveries
    ContributorAuthor

    Releasing this one. We're backed up on CI and won't get it landed soon, so anyone who wants it is welcome to take it.

    If it helps, our RED test and fix are on the fork branch fix/fade-to-color-switch-point-edges. They passed review on our side but haven't been through CI, so reuse them or start fresh, whichever you prefer.

  4. zackees commented on Oct 14, 2026

    @zackees
    Member

    Claiming.

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