aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-07-22 23:12:08 +0200
committerdec05eba <dec05eba@protonmail.com>2023-07-22 23:22:51 +0200
commitd45597e104fa3bd80a6f1922f2fdeaa6a0eff724 (patch)
tree55a291bb46ebd7061cbffb1f0fca2a75a6b39776
parent9ca5b8ec3a818454ebb139ae9007184584aa2f5e (diff)
Exit with exit code 10 if pkexec fails
-rw-r--r--README.md4
-rw-r--r--kms/client/kms_client.c12
-rw-r--r--kms/server/kms_server.c2
-rw-r--r--src/capture/kms_cuda.c5
-rw-r--r--src/capture/kms_vaapi.c5
-rw-r--r--src/egl.c2
-rw-r--r--src/main.cpp5
7 files changed, 24 insertions, 11 deletions
diff --git a/README.md b/README.md
index d2a7666..8742b93 100644
--- a/README.md
+++ b/README.md
@@ -6,8 +6,8 @@ This screen recorder can be used for recording your desktop offline, for live st
where only the last few seconds are saved.
## Note
-This software works with x11 and wayland, but when using wayland only monitors can be recorded and root access is needed.\
-If you are using a variable refresh rate monitor then choose to record "screen-direct-force". This will allow variable refresh rate to work when recording fullscreen applications. Note that some applications such as mpv will not work in fullscreen mode. A fix is being developed for this.\
+This software works with x11 and wayland, but when using wayland only monitors can be recorded and root access is required.\
+If you are using a variable refresh rate monitor on nvidia on x11 then choose to record "screen-direct-force". This will allow variable refresh rate to work when recording fullscreen applications. Note that some applications such as mpv will not work in fullscreen mode. A fix is being developed for this.\
GPU Screen Recorder only supports h264 and hevc codecs at the moment which means that webm files are not supported.
### TEMPORARY ISSUES
1) screen-direct capture has been temporary disabled as it causes issues with stuttering. This might be a nvfbc bug.
diff --git a/kms/client/kms_client.c b/kms/client/kms_client.c
index ff8a3d5..aab5b01 100644
--- a/kms/client/kms_client.c
+++ b/kms/client/kms_client.c
@@ -140,6 +140,7 @@ static bool find_program_in_path(const char *program_name, char *filepath, int f
}
int gsr_kms_client_init(gsr_kms_client *self, const char *card_path) {
+ int result = -1;
self->kms_server_pid = -1;
self->socket_fd = -1;
self->client_fd = -1;
@@ -248,12 +249,19 @@ int gsr_kms_client_init(gsr_kms_client *self, const char *card_path) {
}
break;
} else {
- int status;
+ int status = 0;
int wait_result = waitpid(self->kms_server_pid, &status, WNOHANG);
if(wait_result != 0) {
fprintf(stderr, "gsr error: gsr_kms_client_init: kms server died or never started, error: %s\n", strerror(errno));
self->kms_server_pid = -1;
goto err;
+ } else if(WIFEXITED(status)) {
+ int exit_code = WEXITSTATUS(status);
+ fprintf(stderr, "gsr error: gsr_kms_client_init: kms server died or never started, exit code: %d\n", exit_code);
+ self->kms_server_pid = -1;
+ if(exit_code != 0)
+ result = exit_code;
+ goto err;
}
}
}
@@ -263,7 +271,7 @@ int gsr_kms_client_init(gsr_kms_client *self, const char *card_path) {
err:
gsr_kms_client_deinit(self);
- return -1;
+ return result;
}
void gsr_kms_client_deinit(gsr_kms_client *self) {
diff --git a/kms/server/kms_server.c b/kms/server/kms_server.c
index d2eb4e8..0ff0b03 100644
--- a/kms/server/kms_server.c
+++ b/kms/server/kms_server.c
@@ -338,7 +338,7 @@ int main(int argc, char **argv) {
if(drmSetClientCap(drm.drmfd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1) != 0) {
fprintf(stderr, "kms server error: drmSetClientCap DRM_CLIENT_CAP_UNIVERSAL_PLANES failed, error: %s\n", strerror(errno));
close(drm.drmfd);
- return 2;
+ return 10;
}
if(drmSetClientCap(drm.drmfd, DRM_CLIENT_CAP_ATOMIC, 1) != 0) {
diff --git a/src/capture/kms_cuda.c b/src/capture/kms_cuda.c
index e6fa42f..d6d8774 100644
--- a/src/capture/kms_cuda.c
+++ b/src/capture/kms_cuda.c
@@ -139,9 +139,10 @@ static int gsr_capture_kms_cuda_start(gsr_capture *cap, AVCodecContext *video_co
}
cap_kms->using_wayland_capture = true;
} else {
- if(gsr_kms_client_init(&cap_kms->kms_client, cap_kms->params.card_path) != 0) {
+ int kms_init_res = gsr_kms_client_init(&cap_kms->kms_client, cap_kms->params.card_path);
+ if(kms_init_res != 0) {
gsr_capture_kms_cuda_stop(cap, video_codec_context);
- return -1;
+ return kms_init_res;
}
MonitorCallbackUserdata monitor_callback_userdata = {
diff --git a/src/capture/kms_vaapi.c b/src/capture/kms_vaapi.c
index cc9aad9..04e9658 100644
--- a/src/capture/kms_vaapi.c
+++ b/src/capture/kms_vaapi.c
@@ -142,9 +142,10 @@ static int gsr_capture_kms_vaapi_start(gsr_capture *cap, AVCodecContext *video_c
}
cap_kms->using_wayland_capture = true;
} else {
- if(gsr_kms_client_init(&cap_kms->kms_client, cap_kms->params.card_path) != 0) {
+ int kms_init_res = gsr_kms_client_init(&cap_kms->kms_client, cap_kms->params.card_path);
+ if(kms_init_res != 0) {
gsr_capture_kms_vaapi_stop(cap, video_codec_context);
- return -1;
+ return kms_init_res;
}
MonitorCallbackUserdata monitor_callback_userdata = {
diff --git a/src/egl.c b/src/egl.c
index 3bcb6fe..9fd5925 100644
--- a/src/egl.c
+++ b/src/egl.c
@@ -536,6 +536,8 @@ void gsr_egl_unload(gsr_egl *self) {
}
bool gsr_egl_supports_wayland_capture(gsr_egl *self) {
+ // TODO: wlroots capture is broken right now (black screen) on amd and multiple monitors
+ // so it has to be disabled right now. Find out why it happens and fix it.
(void)self;
return false;
//return !!self->wayland.export_manager && self->wayland.num_outputs > 0;
diff --git a/src/main.cpp b/src/main.cpp
index c5dd33f..22f929e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1687,9 +1687,10 @@ int main(int argc, char **argv) {
if(replay_buffer_size_secs == -1)
video_stream = create_stream(av_format_context, video_codec_context);
- if(gsr_capture_start(capture, video_codec_context) != 0) {
+ int capture_result = gsr_capture_start(capture, video_codec_context);
+ if(capture_result != 0) {
fprintf(stderr, "gsr error: gsr_capture_start failed\n");
- _exit(1);
+ _exit(capture_result);
}
open_video(video_codec_context, quality, very_old_gpu, gpu_inf.vendor, pixel_format);