From 85d561cad101c922a701fd9bebafada522ac766e Mon Sep 17 00:00:00 2001 From: derrod Date: Fri, 28 Oct 2022 00:51:59 +0200 Subject: [PATCH] obs-ffmpeg: Fix Ubuntu 20.04 detection --- plugins/obs-ffmpeg/obs-ffmpeg.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/plugins/obs-ffmpeg/obs-ffmpeg.c b/plugins/obs-ffmpeg/obs-ffmpeg.c index 90e105f09..e86649a22 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg.c @@ -242,43 +242,19 @@ static void do_nvenc_check_for_ubuntu_20_04(void) FILE *fp; char *line = NULL; size_t linecap = 0; - struct dstr distro; - struct dstr version; fp = fopen("/etc/os-release", "r"); if (!fp) { return; } - dstr_init_copy(&distro, "Unknown"); - dstr_init_copy(&version, "Unknown"); - while (getline(&line, &linecap, fp) != -1) { - if (!strncmp(line, "NAME", 4)) { - char *start = strchr(line, '='); - if (!start || *(++start) == '\0') - continue; - dstr_copy(&distro, start); - dstr_resize(&distro, distro.len - 1); + if (strncmp(line, "VERSION_CODENAME=focal", 22) == 0) { + ubuntu_20_04_nvenc_fallback = true; } - - if (!strncmp(line, "VERSION_ID", 10)) { - char *start = strchr(line, '='); - if (!start || *(++start) == '\0') - continue; - dstr_copy(&version, start); - dstr_resize(&version, version.len - 1); - } - } - - if (dstr_cmpi(&distro, "ubuntu") == 0 && - dstr_cmp(&version, "20.04") == 0) { - ubuntu_20_04_nvenc_fallback = true; } fclose(fp); - dstr_free(&version); - dstr_free(&distro); free(line); } #endif