mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-11-22 06:35:57 +01:00
screencast: check if a valid format was received from wlr_screencopy
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
This commit is contained in:
parent
0bbd652c1c
commit
723934d0b0
1 changed files with 12 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include <drm_fourcc.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/mman.h>
|
||||
#include <spa/utils/result.h>
|
||||
|
@ -167,6 +168,13 @@ static int start_screencast(struct xdpw_screencast_instance *cast) {
|
|||
wl_display_dispatch(cast->ctx->state->wl_display);
|
||||
wl_display_roundtrip(cast->ctx->state->wl_display);
|
||||
|
||||
if (cast->screencopy_frame_info[WL_SHM].format == DRM_FORMAT_INVALID ||
|
||||
(cast->ctx->state->screencast_version >= 3 &&
|
||||
cast->screencopy_frame_info[DMABUF].format == DRM_FORMAT_INVALID)) {
|
||||
logprint(INFO, "wlroots: unable to receive a valid format from wlr_screencopy");
|
||||
return -1;
|
||||
}
|
||||
|
||||
xdpw_pwr_stream_create(cast);
|
||||
|
||||
cast->initialized = true;
|
||||
|
@ -443,7 +451,10 @@ static int method_screencast_start(sd_bus_message *msg, void *data,
|
|||
}
|
||||
|
||||
if (!cast->initialized) {
|
||||
start_screencast(cast);
|
||||
ret = start_screencast(cast);
|
||||
}
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
while (cast->node_id == SPA_ID_INVALID) {
|
||||
|
|
Loading…
Reference in a new issue