emersion / xdg-desktop-portal-wlr

xdg-desktop-portal backend for wlroots
MIT License
590 stars 57 forks source link

screencast: check if a valid format was received from wlr_screencopy #215

Closed columbarius closed 2 years ago

columbarius commented 2 years ago

When a screencast is started we do a roundtrip on get the offered formats from wlr_screencopy. This roundtrip can fail [1]. In this case the formats won't be initialized and we will just error out of the screencast session.

[1] https://github.com/emersion/xdg-desktop-portal-wlr/issues/214

emersion commented 2 years ago

Maybe it would be easier to set a bool field when receiving the buffer_done event, and check that field after the roundtrip?

columbarius commented 2 years ago

I'd rather not use a flag for each state of setup we reached. Since we use drm_format internally for shm, the 0 shouldn't be an issue. I thought about making it possible for compositors to drop shm buffer screencopy in the future (signaled with an invalid shm_format, if there is one) and this could work with checking the format, but I saw no reason to make a more detailed check here. I assume that failing screencopy, because the compositor can't find a usable format (while we are fine with any at that point) should not be common on released swas/wlroot versions.