Skip to content

fix(video): wait for a configured output to appear before falling back#1514

Open
ryancatlin wants to merge 1 commit into
ClassicOldSong:masterfrom
ryancatlin:fix/pinned-output-grace-wait
Open

fix(video): wait for a configured output to appear before falling back#1514
ryancatlin wants to merge 1 commit into
ClassicOldSong:masterfrom
ryancatlin:fix/pinned-output-grace-wait

Conversation

@ryancatlin

Copy link
Copy Markdown
Contributor

Problem

When output_name points at a display that is momentarily absent from the
enumeration at stream-bind time, refresh_displays() resets to the first
display and returns immediately. The capture then opens that fallback monitor,
caches its name in proc::proc.display_name, and never re-evaluates — so the
entire session streams the wrong output with no recovery.

This reliably bites on-demand virtual displays (a headless connector brought up
only for a stream), which can still be settling in the compositor at the instant
the encoder binds. It can also surface with displays returning from DPMS or
ordinary hotplug timing.

Fix

When the missing display is the explicitly configured output_name, give it a
short grace window (~2s, 10 × 200ms) — re-enumerating platf::display_names()
each attempt — before falling back.

  • Bounded: a genuinely-absent output still degrades to the previous fallback
    rather than hanging.
  • Zero cost when the output is already present (matches on the first pass).
  • Only the pinned output waits; auto-selected displays keep the original
    single-pass behaviour.
  • Re-enumerates Apollo's own output list, which is the capture source of truth
    and can lag the compositor's view.

refresh_displays() reset to the first display and returned immediately
when the configured output_name was absent from the freshly enumerated
list. With an on-demand virtual display (a headless connector brought up
only for a stream) that connector can still be settling in the compositor
at the instant the encoder binds, so Apollo would latch onto the wrong
physical monitor for the entire session and never recover (the wrong name
gets cached in proc::proc.display_name).

When the missing display is the explicitly pinned output_name, re-poll
Apollo's own display_names() up to ~2s (10 x 200ms) before falling back.
Bounded, so a genuinely-absent output still degrades to the old behaviour
rather than hanging; zero cost when the output is already present.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant