diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c b/plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c index 7de37b1e4..74e1f5b87 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c @@ -202,6 +202,9 @@ static bool nvenc_reconfigure(void *data, obs_data_t *settings) enc->ffve.context->bit_rate = rate; enc->ffve.context->rc_max_rate = rate; } +#else + UNUSED_PARAMETER(data); + UNUSED_PARAMETER(settings); #endif return true; } diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c index ee2f46e32..52e860b9c 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c @@ -600,8 +600,16 @@ static obs_properties_t *vaapi_properties(void *unused) strcmp(file_name, "..") == 0) continue; - char path[64] = "\0"; - sprintf(path, "/dev/dri/by-path/%s", file_name); + char path[64] = {0}; + + // Use the return value of snprintf to prevent truncation warning. + int written = snprintf(path, 64, "/dev/dri/by-path/%s", + file_name); + if (written >= 64) + blog(LOG_DEBUG, + "obs-ffmpeg-vaapi: A format truncation may have occurred." + " This can be ignored since it is quite improbable."); + type = strrchr(file_name, '-'); if (type == NULL) continue;