aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-11-24 22:52:12 +0100
committerdec05eba <dec05eba@protonmail.com>2024-11-24 22:52:12 +0100
commitd472d8d41eacd512bfc4693e212c6c17846857ef (patch)
tree2a69f173e8fb5ef58a5017fadd56ffedd0508915
parent8644c72ac916d708b5f8b0e4dd248ddd3c55dd00 (diff)
Dont allow running the program as the root user
-rw-r--r--meson_options.txt4
-rw-r--r--src/main.cpp12
2 files changed, 11 insertions, 5 deletions
diff --git a/meson_options.txt b/meson_options.txt
index 5936927..da3f999 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,5 @@
option('systemd', type : 'boolean', value : true, description : 'Install systemd service file')
-option('capabilities', type : 'boolean', value : true, description : 'Set binary admin capability to remove password prompt when recording monitor (without desktop portal option) on amd/intel or nvidia wayland')
+option('capabilities', type : 'boolean', value : true, description : 'Set binary admin capability on gsr-kms-server binary to remove password prompt when recording monitor (without desktop portal option) on amd/intel or nvidia wayland')
option('nvidia_suspend_fix', type : 'boolean', value : true, description : 'Install nvidia modprobe config file to tell nvidia driver to preserve video memory on suspend. This is a workaround for an nvidia driver bug that breaks cuda (and gpu screen recorder) on suspend')
option('portal', type : 'boolean', value : true, description : 'Build with support for xdg desktop portal ScreenCast capture (wayland only) (-w portal option)')
-option('app_audio', type : 'boolean', value : true, description : 'Build with support for recording a single audio source (-aa option). Requires pipewire') \ No newline at end of file
+option('app_audio', type : 'boolean', value : true, description : 'Build with support for recording a single audio source (-aa option). Requires pipewire')
diff --git a/src/main.cpp b/src/main.cpp
index 583d9e5..f415dd8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1123,9 +1123,10 @@ static void usage_full() {
fprintf(stderr, " Optional when using '-bm qp' or '-bm vbr' options, set to 'very_high' be default.\n");
fprintf(stderr, " Required when using '-bm cbr' option.\n");
fprintf(stderr, "\n");
- fprintf(stderr, " -r Replay buffer size in seconds. If this is set, then only the last seconds as set by this option will be stored\n");
- fprintf(stderr, " and the video will only be saved when the gpu-screen-recorder is closed. This feature is similar to Nvidia's instant replay feature.\n");
- fprintf(stderr, " This option has be between 5 and 1200. Note that the replay buffer size will not always be precise, because of keyframes. Optional, disabled by default.\n");
+ fprintf(stderr, " -r Replay buffer time in seconds. If this is set, then only the last seconds as set by this option will be stored\n");
+ fprintf(stderr, " and the video will only be saved when the gpu-screen-recorder is closed. This feature is similar to Nvidia's instant replay feature This option has be between 5 and 1200.\n");
+ fprintf(stderr, " Note that the video data is stored in RAM, so don't use too long replay buffer time and use constant bitrate option (-bm cbr) to prevent RAM usage from going too high in busy scenes.\n");
+ fprintf(stderr, " Optional, disabled by default.\n");
fprintf(stderr, "\n");
fprintf(stderr, " -k Video codec to use. Should be either 'auto', 'h264', 'hevc', 'av1', 'vp8', 'vp9', 'hevc_hdr', 'av1_hdr', 'hevc_10bit' or 'av1_10bit'.\n");
fprintf(stderr, " Optional, set to 'auto' by default which defaults to 'h264'. Forcefully set to 'h264' if the file container type is 'flv'.\n");
@@ -2981,6 +2982,11 @@ int main(int argc, char **argv) {
// Same as above, but for amd/intel
unsetenv("vblank_mode");
+ if(geteuid() == 0) {
+ fprintf(stderr, "Error: don't run gpu-screen-recorder as the root user\n");
+ _exit(1);
+ }
+
if(argc <= 1)
usage_full();