Bug 487300

Summary: sharing minimized (non-rendering?) window results in random parts of screen being casted
Product: [Plasma] kwin Reporter: Martin Bednar <martin+kde>
Component: screencastingAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: ahiemstra, akselmo, kde, martin+kde, nate
Priority: NOR    
Version: 6.0.4   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: showcasing bug. Only terminal window shared, panel & firefox can be discerned
log
screencast

Description Martin Bednar 2024-05-20 21:39:47 UTC
Created attachment 169668 [details]
showcasing bug.  Only terminal window shared, panel & firefox can be discerned

SUMMARY
Sharing a window, which isn't currently rendering, results in garbled cast video, while possibly sharing parts of other windows.
Marking as grave as this can create privacy issues (if the part of the random data contains parts of another window)

STEPS TO REPRODUCE
1. Minimize a maximized window, wait a while (unsure how long. Maybe screensaver required to activate...)
2. Share only window using firefox (to https://onlinescreenshare.com )
3. Pick a window to share. Getting the "Share" button to enable is sometimes a bit finicky, but randomly selecting/deselecting windows usually does the trick. Move cursor over last location of window. ( related bug : https://bugs.kde.org/show_bug.cgi?id=486081 )

OBSERVED RESULT
Garbled casted result. Possibly containing fragments of other windows.
Raising the shared window fixes it.

EXPECTED RESULT
Unsure. Either don't allow sharing such a window, or enable the window, possibly raising it?


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: linux-6.6.30, Gentoo
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.0.0
Qt Version: 6.7.0

ADDITIONAL INFORMATION
I have 2 screens. Firefox with cast on left screen, last location of minimized window on right screen: Moving cursor anywhere on right screen causes cast stream corruption.
I have reproduced it a few times, twice using the process described, but I don't know how to force the exact conditions which allow reproducing.
Comment 1 Vlad Zahorodnii 2024-06-19 13:38:33 UTC
I cannot reproduce it
Comment 2 Vlad Zahorodnii 2024-06-19 13:42:25 UTC
If you're able to reproduce it, can you attach kwin logs to the bug report? `journalctl --follow --user-unit plasma-kwin_wayland > log.txt`
Comment 3 Vlad Zahorodnii 2024-06-19 13:42:42 UTC
sorry, wrong command

journalctl --boot --user-unit plasma-kwin_wayland > log.txt
Comment 4 Martin Bednar 2024-06-19 16:11:08 UTC
Created attachment 170640 [details]
log

Sharing started around 18:02 . tbh I don't see anything special at that time.
I'll try making a video of it. It happens every time I try. (6.1 beta, currently upgrading to release)
Comment 5 Martin Bednar 2024-06-19 16:35:46 UTC
Also, if you're trying to reproduce with the fix for https://bugs.kde.org/show_bug.cgi?id=487294 in place, I don't think you'll be able to. It should work around it. Not sure if setting this one as fixed by the same logic is correct.
Comment 6 Martin Bednar 2024-06-19 21:22:01 UTC
Created attachment 170650 [details]
screencast

Note the cursor moving over the area where the minimized konsole window appears when raised.
just tried applying https://invent.kde.org/plasma/kwin/-/merge_requests/5945/ , and it indeed does prevent it from happening.
Comment 7 Vlad Zahorodnii 2024-06-20 10:34:29 UTC
Okay, I can reproduce it now. Weird.
Comment 8 Vlad Zahorodnii 2024-06-20 11:00:40 UTC
I believe it's either a webrtc or a firefox bug. It looks like it doesn't handle well pw_buffer's that contain only cursor metadata. Things work fine in obs and chromium. Can you report this issue to firefox developers please?
Comment 9 Martin Bednar 2024-06-25 15:30:58 UTC
reported here. https://bugzilla.mozilla.org/show_bug.cgi?id=1904615