Repository navigation
Conversation
A stream start failure switched capture to AVFoundation for the rest of the process. The failures seen in practice were transient (starting a stream on the lock screen), and AVFoundation couldn't capture that display either, so later sessions stayed black until Sunshine restarted. Let the failure expire after 30 s, so the next display creation tries ScreenCaptureKit again.
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
When an
SCStreamfails to start,backend_policy_tflips to AVFoundation for the rest of the process (sc_capture_loop.cpp#L14-L24). The failures I've hit were transient: starting a stream while the Mac was on the lock screen failed once. AVFoundation couldn't capture that display either, so every later session stayed black until Sunshine was restarted, long after the Mac was unlocked.This makes the failure expire after 30 s (
backend_policy_t::failure_backoff). Within that window the display is still rebuilt on AVFoundation exactly as today, so a persistent failure (no Screen Recording permission, etc) still falls back. Afterwards the next display creation tries ScreenCaptureKit again. The clock can be passed in so the expiry is testable.Screenshot
N/A
Issues Fixed or Closed
Roadmap Issues
Testing
SCCaptureLoop.BackendPolicyStreamStartFailureExpiresAfterBackoff: a failure is reported untilfailure_backoffhas passed, then not; a later failure restarts it. The existing policy and capture loop tests pass unchanged.test_sunshineon macOS 27.2.1 / M3 Pro with-DBUILD_WERROR=ON: 812 passed, 9 skipped. I excluded*AudioTest*, which waits on a microphone permission prompt for the test binary here and hangs (unrelated).-DCMAKE_EXE_LINKER_FLAGS=-L$(brew --prefix icu4c)/libhere (keg-only ICU, unrelated to this change).Type of Change
Checklist
AI Usage
See our AI usage policy.