Closed alba4k closed 1 month ago
I had this problem too, i had to use the xdg-desktop-portal-wlr instead until they fix this bug, screen sharing. It's been a pain to get screen sharing working reliably on Linux
@lennoxlotl suggested this on the discord:
I recently noticed some people having issues with XDPH and screensharing the entire screen (not an application) on Vesktop. I also recently switched back to Hyprland and noticed the same issue so I thought I will just try random bullshit to see if I can get a hacky fix working. (It might be worth noting that this only happens on certain resolution and fps combinations, for me anything thats low fps and low resolution works, 1440p@60fps doesn't though) It seems like the issue is an Out of buffers error which results in no future frame captures even being started afterwards. After a bit of trying around I just manually re-queued the next frame and it seems to work now. If anybody else has the same issue, I guess you can temporarily fix it by inserting 2 lines of code until someone smarter than me fixes it properly.
Yes I know this is not a real fix as it doesn't get rid of the Out of buffers error, it only works around it. I never worked with portals or pipewire or anything even related to that so the code below is just the first thing that came into my mind, it is located in Screencopy.cpp.
This is that code, starting at line 126 of the mentioned file:
if (!PSTREAM->currentPWBuffer) {
zwlr_screencopy_frame_v1_destroy(frame);
PSESSION->sharingData.frameCallback = nullptr;
Debug::log(LOG, "[screencopy/pipewire] Out of buffers");
PSESSION->sharingData.status = FRAME_NONE;
Debug::log(LOG, "[screencopy/pipewire] Queue next share frame");
g_pPortalManager->m_sPortals.screencopy->m_pPipewire->updateStreamParam(PSTREAM);
g_pPortalManager->m_sPortals.screencopy->queueNextShareFrame(PSESSION);
return;
}
I can confirm that this works, and that the screen share works even without the workaround when trying to share smaller windows.
@vaxerski as you required a bisect in https://github.com/hyprwm/xdg-desktop-portal-hyprland/issues/248#issuecomment-2286789306
The first commit that I managed to build (as the other fail because wlroots-hyprland is missing) is https://github.com/hyprwm/Hyprland/commit/016da234d0e852de3ef20eb2e89ac58d2a85f6e7, and the issue is there in that one too.
can you make a MR then so we can discuss in a real place with the code
i can make a pr with this in a 2-3 hours once im home
made a draft mr for further discussion
I was having this issue as described above before this merge, but with the merge the second window does not even pop up with the preview, instead it just breaks discord and will not attempt to stream again when the button is clicked until the client is restarted. Still works in OBS.
Can you send logs?
bitdepth,8 gets me sorted.
Interesting, might be a Vesktop only thing then /shrug.
Telegram desktop has that issue too
Telegram desktop has that issue too
The bitdepth one? If yes logs would still be good to see whats going on
@alba4k are you able to screenshare?
I broke my laptop by spilling on it a week ago.
Just got home, put the battery back in and it works now, but I will check tomorrow and let you know as I'm going to bed
While the preview sometimes is still black in vesktop (probably because it only asks for 1 frame, meaning that the retry is meaningless?) the screen share is working alright. Not sure if I should close?
Still not working for me even with https://github.com/hyprwm/xdg-desktop-portal-hyprland/commit/a08ecbbf33598924e93542f737fc6169a26b481e :/
Recompiled and reboot worked :/
@goldyfruit @alba4k I am able to screen share in small region but when i screenshare entire screen then nothing happens. You know the solution?
My logs
xdg-desktop-portal.service - Portal service
Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal.service; static)
Active: active (running) since Wed 2024-08-28 16:28:18 IST; 10min ago
Invocation: 3b4c3113ab0a4d598593c3502969f01d
Main PID: 10772 (xdg-desktop-por)
Tasks: 5 (limit: 7014)
Memory: 3.6M (peak: 4.4M)
CPU: 206ms
CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-desktop-portal.service
└─10772 /usr/lib/xdg-desktop-portal
Aug 28 16:28:18 laptop xdg-desktop-por[10772]: Choosing gtk.portal for org.freedesktop.impl.portal.Notification as a last-resort fallback
Aug 28 16:28:18 laptop xdg-desktop-por[10772]: Choosing gtk.portal for org.freedesktop.impl.portal.Inhibit as a last-resort fallback
Aug 28 16:28:18 laptop xdg-desktop-por[10772]: Choosing gtk.portal for org.freedesktop.impl.portal.Access as a last-resort fallback
Aug 28 16:28:18 laptop xdg-desktop-por[10772]: Choosing hyprland.portal for org.freedesktop.impl.portal.Screenshot via the deprecated UseIn key
Aug 28 16:28:18 laptop xdg-desktop-por[10772]: Choosing gtk.portal for org.freedesktop.impl.portal.Account as a last-resort fallback
Aug 28 16:28:18 laptop xdg-desktop-por[10772]: Choosing gtk.portal for org.freedesktop.impl.portal.Email as a last-resort fallback
Aug 28 16:28:18 laptop xdg-desktop-por[10772]: Choosing hyprland.portal for org.freedesktop.impl.portal.GlobalShortcuts via the deprecated UseIn key
Aug 28 16:28:18 laptop xdg-desktop-por[10772]: Choosing gtk.portal for org.freedesktop.impl.portal.DynamicLauncher as a last-resort fallback
Aug 28 16:28:18 laptop xdg-desktop-por[10772]: Choosing hyprland.portal for org.freedesktop.impl.portal.ScreenCast via the deprecated UseIn key
Aug 28 16:28:18 laptop systemd[652]: Started Portal service.
● xdg-desktop-portal-hyprland.service - Portal service (Hyprland implementation)
Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal-hyprland.service; static)
Active: active (running) since Wed 2024-08-28 16:28:18 IST; 10min ago
Invocation: 5b22c1dd7f6e4b35887d13d7a0a9a702
Main PID: 10755 (xdg-desktop-por)
Tasks: 9 (limit: 7014)
Memory: 8.6M (peak: 38.6M)
CPU: 7.470s
CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-desktop-portal-hyprland.service
└─10755 /usr/lib/xdg-desktop-portal-hyprland
Aug 28 16:36:01 laptop xdg-desktop-portal-hyprland[10755]: [LOG] [screencopy] | /org/freedesktop/portal/desktop/session/1_54/webrtc_session1091435865
Aug 28 16:36:01 laptop xdg-desktop-portal-hyprland[10755]: [LOG] [screencopy] | appid:
Aug 28 16:36:01 laptop xdg-desktop-portal-hyprland[10755]: [LOG] [screencopy] option persist_mode to 1
Aug 28 16:36:01 laptop xdg-desktop-portal-hyprland[10755]: [LOG] [screencopy] unused option multiple
Aug 28 16:36:01 laptop xdg-desktop-portal-hyprland[10755]: [LOG] [screencopy] unused option types
Aug 28 16:36:01 laptop xdg-desktop-portal-hyprland[10755]: [LOG] [screencopy] restore data invalid / missing, prompting
@piyushyadav0191 are you on git already?
When starting a screen share from firefox or from obs (recording), everything is fine. However, telegram desktop and discord (vesktop) both just get a black screen
xdph.txt
All I did here was start and stop a screenshare on vesktop (which, as you likely already know, requires the user to interact with the portal window 3 times for some reason, 1 for the preview and 2 for the screenshare)