hyprwm / xdg-desktop-portal-hyprland

xdg-desktop-portal backend for Hyprland
BSD 3-Clause "New" or "Revised" License
273 stars 47 forks source link

Pipewire Streaming Issue #17

Closed 5ysk3y closed 1 year ago

5ysk3y commented 1 year ago

Hey,

Excuse the piss poor title, I wasnt sure how else to label this as I'm piecing together some stuff-- I moved over to XDPH recently and have not had any luck getting the screensharing function to work on my multi-monitor setup. At all. For example, if I add a pipewire capture via OBS I get the picker tool, and I select a monitor:

via xdg-desktop-portal-hyprland -l DEBUG:

2023/01/19 19:07:17 [INFO] - xdpw: screencast instance 0x55cf0ce85de0 has 1 references
2023/01/19 19:07:17 [INFO] - xdpw: 1 active screencast instances
2023/01/19 19:07:17 [INFO] - hyprland: window handle 215068032
2023/01/19 19:07:17 [INFO] - dbus: start method invoked
2023/01/19 19:07:17 [INFO] - dbus: request_handle: /org/freedesktop/portal/desktop/request/1_71/obs9
2023/01/19 19:07:17 [INFO] - dbus: session_handle: /org/freedesktop/portal/desktop/session/1_71/obs3
2023/01/19 19:07:17 [INFO] - dbus: app_id:
2023/01/19 19:07:17 [INFO] - dbus: parent_window:
2023/01/19 19:07:17 [DEBUG] - dbus: start: found matching session /org/freedesktop/portal/desktop/session/1_71/obs3
2023/01/19 19:07:17 [INFO] - wlroots: no modifiers available for format 0
2023/01/19 19:07:17 [INFO] - pipewire: stream state changed to "connecting"
2023/01/19 19:07:17 [INFO] - pipewire: node id is -1
2023/01/19 19:07:17 [INFO] - pipewire: stream state changed to "paused"
2023/01/19 19:07:17 [INFO] - pipewire: node id is 73
2023/01/19 19:07:17 [DEBUG] - dbus: start: returning node 73

Removing it:

2023/01/19 19:07:55 [INFO] - dbus: session closed
2023/01/19 19:07:55 [DEBUG] - dbus: destroying session 0x55cf0ce89bf0
2023/01/19 19:07:55 [DEBUG] - xdpw: screencast instance 0x55cf0ce85de0 now has 0 references
2023/01/19 19:07:55 [DEBUG] - xdpw: destroying cast instance
2023/01/19 19:07:55 [DEBUG] - pipewire: destroying stream
2023/01/19 19:07:55 [INFO] - pipewire: stream state changed to "unconnected"
2023/01/19 19:07:55 [INFO] - pipewire: node id is -1

From Wireplumber journal:

Jan 19 19:07:17 skynet wireplumber[1516]: <WpPortalPermissionStorePlugin:0x55933e42b080> Failed to call Lookup: GDBus.Error:org.freedesktop.portal.Error.NotFound: No entry for camera

From Pipewire (tailed) journal:

ct:Param:Format:mediaType (1), flags 00000000
Jan 19 19:07:17 skynet pipewire[1515]: pw.context:     Id 2        (Spa:Enum:MediaType:video)
Jan 19 19:07:17 skynet pipewire[1515]: pw.context:   Prop: key Spa:Pod:Object:Param:Format:mediaSubtype (2), flags 00000000
Jan 19 19:07:17 skynet pipewire[1515]: pw.context:     Id 1        (Spa:Enum:MediaSubtype:raw)
Jan 19 19:07:17 skynet pipewire[1515]: pw.context:   Prop: key Spa:Pod:Object:Param:Format:Video:format (131073), flags 00000000
Jan 19 19:07:17 skynet pipewire[1515]: pw.context:     Id 81       (Spa:Enum:VideoFormat:xBGR_210LE)
Jan 19 19:07:17 skynet pipewire[1515]: pw.context:   Prop: key Spa:Pod:Object:Param:Format:Video:size (131075), flags 00000000
Jan 19 19:07:17 skynet pipewire[1515]: pw.context:     Rectangle 1263x687
Jan 19 19:07:17 skynet pipewire[1515]: pw.context:   Prop: key Spa:Pod:Object:Param:Format:Video:framerate (131076), flags 00000000
Jan 19 19:07:17 skynet pipewire[1515]: pw.context:     Fraction 0/1
Jan 19 19:07:17 skynet pipewire[1515]: pw.context:   Prop: key Spa:Pod:Object:Param:Format:Video:maxFramerate (131077), flags 00000000
Jan 19 19:07:17 skynet pipewire[1515]: pw.context:     Choice: type Spa:Enum:Choice:Range, flags 00000000 40 8
Jan 19 19:07:17 skynet pipewire[1515]: pw.context:       Fraction 60/1
Jan 19 19:07:17 skynet pipewire[1515]: pw.context:       Fraction 1/1
Jan 19 19:07:17 skynet pipewire[1515]: pw.context:       Fraction 60/1
Jan 19 19:07:17 skynet pipewire[1515]: pw.link: (73.0 -> 83.0) negotiating -> error (no more input formats)

Whilst searching around I stumbled across this issue from Wireplumber repo, which references pretty much the same things I've outlined above:

https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/87

And that, in turn, ended back with XDPW here:

https://github.com/emersion/xdg-desktop-portal-wlr/issues/168

There is seemingly a reference to another similar problem in XDPW here (where the OP reverted to pipewire-media-session):

https://github.com/emersion/xdg-desktop-portal-wlr/issues/97


I cannot, for the life of me, what is causing this to not function correctly. For whatever reason Pipewire never hits "streaming" state in the XDPH debug log. Feel free to tell me if you think this is an issue with my setup (that may well be the case tbh), I figured it was worth logging either way. I also feel its worth stating I've been over the wiki to ensure I'm not shooting myself in the foot; I'm not running other XDP implementations etc. Happy to supply full logs if you think it'll help.

Thank you for your work on this.

vaxerski commented 1 year ago

I can see you're trying to screenshare a window. What about a monitor?

Also, what GPU are you using?

The hyprland log would be nice too.

Also, I do not recommend reverting to pw-media-session from wireplumber.

5ysk3y commented 1 year ago

Thanks for getting back to me sir!

So I've dumped some logs for you when adding (via a Pipewire source in OBS) a monitor specifically-- not sure why I said I'd captured that initially when I clearly didnt. To my eye its no different but feel free to take a look at these:

xdph_debug.log pipewire.log wireplumber.log

The wireplumber log is pretty bare bones but I've included it.

I can also dump the output from pw-mon if that'd be useful in some fashion. My card is an AMD 6700XT with 3 monitors connected (2 via DP and 1 via HDMI). I would also heed your recommendation RE wireplumber, absolutely. I'm also not ruling out that this is something odd/specific with my setup, thus far I've just been unsuccessful in diagnosing that.

Appreciate the response!

vaxerski commented 1 year ago

no clue what's happening there and I am afraid I may not be of much help, as the problem seems on the pipewire side.

I have very little knowledge of pw and stuff. Everything seems just fine on the xdph / hl side as far as my eyes can tell.

5ysk3y commented 1 year ago

No problem at all, I very much appreciate you taking the time to look. I'll continue to dig as its most likely something local to my system borking things. Just wanted to check. I'll have a poke around - if I manage to figure it out, I'll add something here for posterity.

Thanks again - for this and your work on Hyprland in general.

vaxerski commented 1 year ago

it should be fixable as my desktop has a 6700xt and 2 dp monitors and it just works fine.