fix(screensharing): prevent the "hall of mirrors" when sharing a screen - #1826
Open
vladopol wants to merge 1 commit into
Open
fix(screensharing): prevent the "hall of mirrors" when sharing a screen#1826vladopol wants to merge 1 commit into
vladopol wants to merge 1 commit into
Conversation
When a user shares their whole screen on the desktop client, the Talk window is itself on the shared screen and renders the live screen-share, so the capture recurses into an infinite "hall of mirrors" (#7792) - especially when sharing the entire desktop. Unlike the browser, the desktop client knows what is being shared (getDesktopMediaSource returns the source id), so it can solve this natively: while a whole screen is being shared, the Talk window is excluded from OS screen capture via BrowserWindow.setContentProtection. The window then does not appear in the shared stream at all - no recursion, and remote participants see a clean desktop instead of the call window. Detection wraps getUserMedia: when a screen (not a single window) capture starts, the window is protected; when the capture track ends or is stopped, protection is released. Talk (spreed) is not modified and the media stream is not touched. Only screen / entire-desktop captures are protected - sharing a single window is unaffected. setContentProtection maps to WDA_EXCLUDEFROMCAPTURE on Windows and NSWindowSharingNone on macOS; it is a no-op on Linux, where the spreed overlay (#18690) covers the case. Refs #7792 Signed-off-by: Vladimir Poluliashenko <vladopol@gmail.com>
2 tasks
Contributor
|
Hi @vladopol Thank you for your contribution here. We'll discuss with the team if it still makes sense to block entire windows and not only the screensharing preview. But if we do want to block the entire window from the screensharing, overriding |
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.
When a user shares their whole screen on the desktop client, the Talk window is itself on the shared screen and renders the live screen-share, so the capture recurses into an infinite "hall of mirrors" (#7792) — especially when sharing the entire desktop.
Unlike the browser, the desktop client knows what is being shared (
getDesktopMediaSourcereturns the source id), so it can solve this natively: while a whole screen is being shared, the Talk window is excluded from OS screen capture viaBrowserWindow.setContentProtection. The window then doesn't appear in the shared stream at all — no recursion, and remote participants see a clean desktop instead of the call window.How
getUserMedia: when a screen (not a single window) capture starts, the window is protected; when the capture track ends or is stopped, protection is released. On page (re)load the state is reset to a known baseline. Talk (spreed) is not modified and the media stream is not touched.WDA_EXCLUDEFROMCAPTURE(the window is excluded; the desktop behind it shows through). macOS:NSWindowSharingNone. Linux:setContentProtectionis a no‑op there, so the window stays in the stream — the spreed‑side overlay (#18690) covers that case.Performance
Measured on low‑end hardware — enabling content protection adds no measurable CPU/GPU cost; the capture path is unchanged.
Testing
Verified on Windows and macOS with a second participant — sharing a whole screen no longer mirrors, the Talk window is absent from the shared stream, and sharing a single window is unchanged.
Refs #7792. Complements the cross‑platform overlay in #18690 (which remains the fallback on Linux and in browsers).