Skip to content

libobs: Transition audio can take its timestamp from a removed child after the audio stop #2185

Closed

Description

@rdoupe

Bug

obs_transition_audio_render() (libobs/obs-source-transition.c.h) drops removed children only on its first pass:

sources[0] = transition->transition_sources[0];
sources[1] = transition->transition_sources[1];
if (sources[0] && obs_source_removed(sources[0])) sources[0] = NULL;
if (sources[1] && obs_source_removed(sources[1])) sources[1] = NULL;
min_ts = transition_calc_min_ts(sources);
if (min_ts) {
	...
	sources[0] = transition->transition_sources[0];   /* re-read, removed check not repeated */
	sources[1] = transition->transition_sources[1];
	min_ts = transition_calc_min_ts(sources);

The second read, after a possible audio stop, doesn't repeat the removed check from ea9e4ca. So a removed child can count toward min_ts and go into the copied state. If its audio timestamp is older, it sets *ts_out, which can delay or drop the other child's audio for that tick.

Found by reading the code while porting the transition steps (#2184). It hasn't been reproduced. Upstream has the same code.

Plan

  1. RED: a real-libobs test with a transition between two audio sources.
    • Mark one source removed (obs_source_remove) while it still has an older audio timestamp.
    • Render the transition's audio, with and without the audio stop on that tick.
    • Check that *ts_out and the mixed audio come only from the live child.
    • If the state can't be reached through the public API, show why and close this issue.
  2. GREEN: repeat the removed check after the re-read, or factor both reads into one helper. Transitions without removed children behave exactly as before.

Activity

  1. zackees commented on Oct 24, 2026

    @zackees
    Member

    Claiming: #2185. Now unblocked, since #2184 has merged.

    Plan: RED is a real-libobs Tier 2 test with a transition between two audio sources. One child is removed and has an older timestamp, and the audio stop happens on that tick; the test checks that ts_out comes only from the live child. GREEN repeats the removed check after the re-read, in both the C code and the Rust transition step if that one mirrors it. PR expected today.

  2. added
    claimed
    on Oct 24, 2026
  3. zackees commented on Oct 24, 2026

    @zackees
    Member

    Fixed by #2256. obs_transition_audio_render now leaves out a removed child source on both reads, including the re-read after the audio thread stops the transition. Test: test_transition_removed_child_audio (Tier 2, Linux). It skips when the video thread stops the transition first, a race the test can't control. Nothing left. Related local-build problem: #2244.

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