From 2edc836c24fe683c071ff1b608930da98fff9eb7 Mon Sep 17 00:00:00 2001 From: Kaiyang Wu Date: Sun, 8 Dec 2024 02:45:00 -0800 Subject: [PATCH] obs-studio: update to 31.0.0 Signed-off-by: Kaiyang Wu --- app-multimedia/obs-studio/autobuild/defines | 4 +- ...able-permission-to-CEF-binary-and-li.patch | 48 ++++++++++ ...001-keep-CEF-binary-file-permissions.patch | 33 ------- .../patches/0002-cef-122.0-api.patch | 43 --------- ...peg-Fix-deprecation-with-FFmpeg-7.1.patch} | 45 ++++----- ...oid-trying-to-allocate-0-byte-on-Lin.patch | 93 +++++++++++++++++++ app-multimedia/obs-studio/spec | 14 +-- 7 files changed, 171 insertions(+), 109 deletions(-) create mode 100644 app-multimedia/obs-studio/autobuild/patches/0001-cmake-Add-executable-permission-to-CEF-binary-and-li.patch delete mode 100644 app-multimedia/obs-studio/autobuild/patches/0001-keep-CEF-binary-file-permissions.patch delete mode 100644 app-multimedia/obs-studio/autobuild/patches/0002-cef-122.0-api.patch rename app-multimedia/obs-studio/autobuild/patches/{0003-obs-ffmpeg-Fix-deprecation-with-FFmpeg-7.1.patch => 0002-obs-ffmpeg-Fix-deprecation-with-FFmpeg-7.1.patch} (79%) create mode 100644 app-multimedia/obs-studio/autobuild/patches/0003-libobs-opengl-Avoid-trying-to-allocate-0-byte-on-Lin.patch diff --git a/app-multimedia/obs-studio/autobuild/defines b/app-multimedia/obs-studio/autobuild/defines index c736bec3216..1aeae2a17c4 100644 --- a/app-multimedia/obs-studio/autobuild/defines +++ b/app-multimedia/obs-studio/autobuild/defines @@ -24,11 +24,11 @@ CMAKE_AFTER=( -DENABLE_AJA=OFF -DENABLE_NEW_MPEGTS_OUTPUT=OFF -DENABLE_SCRIPTING_LUA=OFF - -DBUILD_BROWSER=OFF + -DENABLE_BROWSER=OFF -DENABLE_QSV11=OFF ) CMAKE_AFTER__WEB_PLUGIN=( - -DBUILD_BROWSER=ON + -DENABLE_BROWSER=ON -DCEF_ROOT_DIR="${SRCDIR}/cef" ) CMAKE_AFTER__INTEL_QSV=( diff --git a/app-multimedia/obs-studio/autobuild/patches/0001-cmake-Add-executable-permission-to-CEF-binary-and-li.patch b/app-multimedia/obs-studio/autobuild/patches/0001-cmake-Add-executable-permission-to-CEF-binary-and-li.patch new file mode 100644 index 00000000000..e5b17364433 --- /dev/null +++ b/app-multimedia/obs-studio/autobuild/patches/0001-cmake-Add-executable-permission-to-CEF-binary-and-li.patch @@ -0,0 +1,48 @@ +From 5d6d29d1ace3b4e89fdf0bd3a4d80b9edb5c8cd2 Mon Sep 17 00:00:00 2001 +From: Kaiyang Wu +Date: Wed, 18 Dec 2024 19:26:23 -0800 +Subject: [PATCH 1/3] cmake: Add executable permission to CEF binary and + libraries + +Signed-off-by: Kaiyang Wu +--- + cmake/linux/helpers.cmake | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +diff --git a/cmake/linux/helpers.cmake b/cmake/linux/helpers.cmake +index fe4249685..1e8b28d0c 100644 +--- a/cmake/linux/helpers.cmake ++++ b/cmake/linux/helpers.cmake +@@ -190,11 +190,6 @@ function(set_target_properties_obs target) + install( + FILES + "${imported_location}" +- "${cef_location}/chrome-sandbox" +- "${cef_location}/libEGL.so" +- "${cef_location}/libGLESv2.so" +- "${cef_location}/libvk_swiftshader.so" +- "${cef_location}/libvulkan.so.1" + "${cef_location}/snapshot_blob.bin" + "${cef_location}/v8_context_snapshot.bin" + "${cef_location}/vk_swiftshader_icd.json" +@@ -206,6 +201,17 @@ function(set_target_properties_obs target) + COMPONENT Runtime + ) + ++ install( ++ PROGRAMS ++ "${cef_location}/chrome-sandbox" ++ "${cef_location}/libEGL.so" ++ "${cef_location}/libGLESv2.so" ++ "${cef_location}/libvk_swiftshader.so" ++ "${cef_location}/libvulkan.so.1" ++ DESTINATION "${OBS_PLUGIN_DESTINATION}" ++ COMPONENT Runtime ++ ) ++ + install( + DIRECTORY "${cef_root_location}/Resources/locales" + DESTINATION "${OBS_PLUGIN_DESTINATION}" +-- +2.47.1 + diff --git a/app-multimedia/obs-studio/autobuild/patches/0001-keep-CEF-binary-file-permissions.patch b/app-multimedia/obs-studio/autobuild/patches/0001-keep-CEF-binary-file-permissions.patch deleted file mode 100644 index 1a9116f23fa..00000000000 --- a/app-multimedia/obs-studio/autobuild/patches/0001-keep-CEF-binary-file-permissions.patch +++ /dev/null @@ -1,33 +0,0 @@ -From f4e7d2a6f7120b63e4be959910699ac841c60df6 Mon Sep 17 00:00:00 2001 -From: Kaiyang Wu -Date: Fri, 24 May 2024 18:06:22 -0700 -Subject: [PATCH] keep CEF binary file permissions - -Signed-off-by: Kaiyang Wu ---- - cmake/Modules/ObsHelpers.cmake | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/cmake/Modules/ObsHelpers.cmake b/cmake/Modules/ObsHelpers.cmake -index b4620ab56..1db7e9aa2 100644 ---- a/cmake/Modules/ObsHelpers.cmake -+++ b/cmake/Modules/ObsHelpers.cmake -@@ -207,6 +207,7 @@ function(setup_target_browser target) - install( - DIRECTORY ${CEF_ROOT_DIR}/Release/ - DESTINATION ${OBS_PLUGIN_DESTINATION} -+ USE_SOURCE_PERMISSIONS - COMPONENT ${target}_Runtime) - - install( -@@ -218,6 +219,7 @@ function(setup_target_browser target) - install( - DIRECTORY ${CEF_ROOT_DIR}/Release/ - DESTINATION ${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION} -+ USE_SOURCE_PERMISSIONS - COMPONENT obs_rundir - EXCLUDE_FROM_ALL) - endfunction() --- -2.45.1 - diff --git a/app-multimedia/obs-studio/autobuild/patches/0002-cef-122.0-api.patch b/app-multimedia/obs-studio/autobuild/patches/0002-cef-122.0-api.patch deleted file mode 100644 index 88d1bef6cd4..00000000000 --- a/app-multimedia/obs-studio/autobuild/patches/0002-cef-122.0-api.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 8728c9d9691c407308fcbe602722e6e1e26a380d Mon Sep 17 00:00:00 2001 -From: Tianhao Chai -Date: Wed, 10 Jul 2024 23:14:00 -0400 -Subject: [PATCH] cef 122.0 api - ---- - plugins/obs-browser/browser-app.cpp | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/plugins/obs-browser/browser-app.cpp b/plugins/obs-browser/browser-app.cpp -index 582b1c6..0df0c78 100644 ---- a/plugins/obs-browser/browser-app.cpp -+++ b/plugins/obs-browser/browser-app.cpp -@@ -147,7 +147,7 @@ void BrowserApp::ExecuteJSFunction(CefRefPtr browser, - std::vector names; - browser->GetFrameNames(names); - for (auto &name : names) { -- CefRefPtr frame = browser->GetFrame(name); -+ CefRefPtr frame = browser->GetFrameByName(name); - CefRefPtr context = frame->GetV8Context(); - - context->Enter(); -@@ -244,7 +244,7 @@ void BrowserApp::SetDocumentVisibility(CefRefPtr browser, - browser->GetFrameIdentifiers(frameIdentifiers); - - for (int64 frameId : frameIdentifiers) { -- CefRefPtr frame = browser->GetFrame(frameId); -+ CefRefPtr frame = browser->GetFrameByIdentifier(frameId); - - SetFrameDocumentVisibility(browser, frame, isVisible); - } -@@ -346,7 +346,7 @@ bool BrowserApp::OnProcessMessageReceived(CefRefPtr browser, - std::vector names; - browser->GetFrameNames(names); - for (auto &name : names) { -- CefRefPtr frame = browser->GetFrame(name); -+ CefRefPtr frame = browser->GetFrameByName(name); - CefRefPtr context = frame->GetV8Context(); - - context->Enter(); --- -2.45.2 - diff --git a/app-multimedia/obs-studio/autobuild/patches/0003-obs-ffmpeg-Fix-deprecation-with-FFmpeg-7.1.patch b/app-multimedia/obs-studio/autobuild/patches/0002-obs-ffmpeg-Fix-deprecation-with-FFmpeg-7.1.patch similarity index 79% rename from app-multimedia/obs-studio/autobuild/patches/0003-obs-ffmpeg-Fix-deprecation-with-FFmpeg-7.1.patch rename to app-multimedia/obs-studio/autobuild/patches/0002-obs-ffmpeg-Fix-deprecation-with-FFmpeg-7.1.patch index ad1d2d66707..65c2396c967 100644 --- a/app-multimedia/obs-studio/autobuild/patches/0003-obs-ffmpeg-Fix-deprecation-with-FFmpeg-7.1.patch +++ b/app-multimedia/obs-studio/autobuild/patches/0002-obs-ffmpeg-Fix-deprecation-with-FFmpeg-7.1.patch @@ -1,18 +1,18 @@ -From 463fabeda1ef8cc31e7c6f2cd25d6194bc717dca Mon Sep 17 00:00:00 2001 +From 28d9509dea76e271a5dc1b58c310f4d6c45a9cfc Mon Sep 17 00:00:00 2001 From: tytan652 Date: Mon, 11 Nov 2024 19:47:03 +0100 -Subject: [PATCH] obs-ffmpeg: Fix deprecation with FFmpeg 7.1 +Subject: [PATCH 2/3] obs-ffmpeg: Fix deprecation with FFmpeg 7.1 --- - .../obs-ffmpeg/obs-ffmpeg-audio-encoders.c | 23 ++++++++--- - plugins/obs-ffmpeg/obs-ffmpeg-output.c | 41 ++++++++++++------- - 2 files changed, 45 insertions(+), 19 deletions(-) + .../obs-ffmpeg/obs-ffmpeg-audio-encoders.c | 23 +++++++++--- + plugins/obs-ffmpeg/obs-ffmpeg-output.c | 36 +++++++++++++------ + 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c b/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c -index 49ee82dae..0cb0e9113 100644 +index baa39072b..4258be19d 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c -@@ -290,11 +290,24 @@ static void *enc_create(obs_data_t *settings, obs_encoder_t *encoder, +@@ -236,11 +236,24 @@ static void *enc_create(obs_data_t *settings, obs_encoder_t *encoder, const char enc->context->sample_rate = audio_output_get_sample_rate(audio); @@ -39,7 +39,7 @@ index 49ee82dae..0cb0e9113 100644 while (*fmt != AV_SAMPLE_FMT_NONE) { if (*fmt == sample_format) { enc->context->sample_fmt = *fmt; -@@ -305,15 +318,15 @@ static void *enc_create(obs_data_t *settings, obs_encoder_t *encoder, +@@ -251,15 +264,15 @@ static void *enc_create(obs_data_t *settings, obs_encoder_t *encoder, const char /* Fall back to default if requested format was not found. */ if (enc->context->sample_fmt == AV_SAMPLE_FMT_NONE) @@ -59,10 +59,10 @@ index 49ee82dae..0cb0e9113 100644 int closest = 0; diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-output.c b/plugins/obs-ffmpeg/obs-ffmpeg-output.c -index 899f5e2d0..94eb66141 100644 +index 28a0dda03..9615abee7 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-output.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg-output.c -@@ -189,6 +189,7 @@ static bool create_video_stream(struct ffmpeg_data *data) +@@ -170,6 +170,7 @@ static bool create_video_stream(struct ffmpeg_data *data) enum AVPixelFormat closest_format; AVCodecContext *context; struct obs_video_info ovi; @@ -70,22 +70,21 @@ index 899f5e2d0..94eb66141 100644 if (!obs_get_video_info(&ovi)) { ffmpeg_log_error(LOG_WARNING, data, "No active video"); -@@ -200,14 +201,6 @@ static bool create_video_stream(struct ffmpeg_data *data) +@@ -180,13 +181,6 @@ static bool create_video_stream(struct ffmpeg_data *data) data->config.video_encoder)) return false; - closest_format = data->config.format; - if (data->vcodec->pix_fmts) { - const int has_alpha = closest_format == AV_PIX_FMT_BGRA; -- closest_format = avcodec_find_best_pix_fmt_of_list( -- data->vcodec->pix_fmts, closest_format, has_alpha, -- NULL); +- closest_format = +- avcodec_find_best_pix_fmt_of_list(data->vcodec->pix_fmts, closest_format, has_alpha, NULL); - } - context = avcodec_alloc_context3(data->vcodec); context->bit_rate = (int64_t)data->config.video_bitrate * 1000; context->width = data->config.scale_width; -@@ -215,15 +208,28 @@ static bool create_video_stream(struct ffmpeg_data *data) +@@ -194,14 +188,28 @@ static bool create_video_stream(struct ffmpeg_data *data) context->time_base = (AVRational){ovi.fps_den, ovi.fps_num}; context->framerate = (AVRational){ovi.fps_num, ovi.fps_den}; context->gop_size = data->config.gop_size; @@ -94,8 +93,7 @@ index 899f5e2d0..94eb66141 100644 context->color_primaries = data->config.color_primaries; context->color_trc = data->config.color_trc; context->colorspace = data->config.colorspace; -- context->chroma_sample_location = determine_chroma_location( -- closest_format, data->config.colorspace); +- context->chroma_sample_location = determine_chroma_location(closest_format, data->config.colorspace); context->thread_count = 0; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100) @@ -117,7 +115,7 @@ index 899f5e2d0..94eb66141 100644 data->video->time_base = context->time_base; data->video->avg_frame_rate = (AVRational){ovi.fps_num, ovi.fps_den}; -@@ -361,6 +367,7 @@ static bool create_audio_stream(struct ffmpeg_data *data, int idx) +@@ -305,6 +313,7 @@ static bool create_audio_stream(struct ffmpeg_data *data, int idx) AVStream *stream; struct obs_audio_info aoi; int channels; @@ -125,14 +123,11 @@ index 899f5e2d0..94eb66141 100644 if (!obs_get_audio_info(&aoi)) { ffmpeg_log_error(LOG_WARNING, data, "No active audio"); -@@ -392,9 +399,15 @@ static bool create_audio_stream(struct ffmpeg_data *data, int idx) +@@ -324,7 +333,14 @@ static bool create_audio_stream(struct ffmpeg_data *data, int idx) if (aoi.speakers == SPEAKERS_4POINT1) context->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_4POINT1; - #endif -- context->sample_fmt = data->acodec->sample_fmts -- ? data->acodec->sample_fmts[0] -- : AV_SAMPLE_FMT_FLTP; -+ + +- context->sample_fmt = data->acodec->sample_fmts ? data->acodec->sample_fmts[0] : AV_SAMPLE_FMT_FLTP; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100) + sample_fmts = data->acodec->sample_fmts; +#else @@ -145,5 +140,5 @@ index 899f5e2d0..94eb66141 100644 stream->time_base = context->time_base; -- -2.47.0 +2.47.1 diff --git a/app-multimedia/obs-studio/autobuild/patches/0003-libobs-opengl-Avoid-trying-to-allocate-0-byte-on-Lin.patch b/app-multimedia/obs-studio/autobuild/patches/0003-libobs-opengl-Avoid-trying-to-allocate-0-byte-on-Lin.patch new file mode 100644 index 00000000000..abfffb5f841 --- /dev/null +++ b/app-multimedia/obs-studio/autobuild/patches/0003-libobs-opengl-Avoid-trying-to-allocate-0-byte-on-Lin.patch @@ -0,0 +1,93 @@ +From 4879e78948ebb66113724cd44ee41c238bad6fc3 Mon Sep 17 00:00:00 2001 +From: tytan652 +Date: Wed, 11 Dec 2024 08:45:40 +0100 +Subject: [PATCH 3/3] libobs-opengl: Avoid trying to allocate 0 byte on Linux + +--- + libobs-opengl/gl-egl-common.c | 51 +++++++++++++++++++---------------- + 1 file changed, 28 insertions(+), 23 deletions(-) + +diff --git a/libobs-opengl/gl-egl-common.c b/libobs-opengl/gl-egl-common.c +index 8854e9d0c..f6f696f69 100644 +--- a/libobs-opengl/gl-egl-common.c ++++ b/libobs-opengl/gl-egl-common.c +@@ -297,26 +297,28 @@ static inline bool is_implicit_dmabuf_modifiers_supported(void) + static inline bool query_dmabuf_formats(EGLDisplay egl_display, EGLint **formats, EGLint *num_formats) + { + EGLint max_formats = 0; +- EGLint *format_list = NULL; + + if (!glad_eglQueryDmaBufFormatsEXT(egl_display, 0, NULL, &max_formats)) { + blog(LOG_ERROR, "Cannot query the number of formats: %s", gl_egl_error_to_string(eglGetError())); + return false; + } + +- format_list = bzalloc(max_formats * sizeof(EGLint)); +- if (!format_list) { +- blog(LOG_ERROR, "Unable to allocate memory"); +- return false; +- } ++ if (max_formats != 0) { ++ EGLint *format_list = bzalloc(max_formats * sizeof(EGLint)); ++ if (!format_list) { ++ blog(LOG_ERROR, "Unable to allocate memory"); ++ return false; ++ } + +- if (!glad_eglQueryDmaBufFormatsEXT(egl_display, max_formats, format_list, &max_formats)) { +- blog(LOG_ERROR, "Cannot query a list of formats: %s", gl_egl_error_to_string(eglGetError())); +- bfree(format_list); +- return false; ++ if (!glad_eglQueryDmaBufFormatsEXT(egl_display, max_formats, format_list, &max_formats)) { ++ blog(LOG_ERROR, "Cannot query a list of formats: %s", gl_egl_error_to_string(eglGetError())); ++ bfree(format_list); ++ return false; ++ } ++ ++ *formats = format_list; + } + +- *formats = format_list; + *num_formats = max_formats; + return true; + } +@@ -353,21 +355,24 @@ static inline bool query_dmabuf_modifiers(EGLDisplay egl_display, EGLint drm_for + return false; + } + +- EGLuint64KHR *modifier_list = bzalloc(max_modifiers * sizeof(EGLuint64KHR)); +- EGLBoolean *external_only = NULL; +- if (!modifier_list) { +- blog(LOG_ERROR, "Unable to allocate memory"); +- return false; +- } ++ if (max_modifiers != 0) { ++ EGLuint64KHR *modifier_list = bzalloc(max_modifiers * sizeof(EGLuint64KHR)); ++ EGLBoolean *external_only = NULL; ++ if (!modifier_list) { ++ blog(LOG_ERROR, "Unable to allocate memory"); ++ return false; ++ } + +- if (!glad_eglQueryDmaBufModifiersEXT(egl_display, drm_format, max_modifiers, modifier_list, external_only, +- &max_modifiers)) { +- blog(LOG_ERROR, "Cannot query a list of modifiers: %s", gl_egl_error_to_string(eglGetError())); +- bfree(modifier_list); +- return false; ++ if (!glad_eglQueryDmaBufModifiersEXT(egl_display, drm_format, max_modifiers, modifier_list, ++ external_only, &max_modifiers)) { ++ blog(LOG_ERROR, "Cannot query a list of modifiers: %s", gl_egl_error_to_string(eglGetError())); ++ bfree(modifier_list); ++ return false; ++ } ++ ++ *modifiers = modifier_list; + } + +- *modifiers = modifier_list; + *n_modifiers = (EGLuint64KHR)max_modifiers; + return true; + } +-- +2.47.1 + diff --git a/app-multimedia/obs-studio/spec b/app-multimedia/obs-studio/spec index 07e7265f093..9f5607750d6 100644 --- a/app-multimedia/obs-studio/spec +++ b/app-multimedia/obs-studio/spec @@ -1,15 +1,17 @@ -VER=30.2.3 -REL=2 +VER=31.0.0 # __OBS_CEF_VER: Find the build version on https://cef-builds.spotifycdn.com/index.html#linux64 -# FIXME: 126.x has https://github.com/chromiumembedded/cef/issues/3616#issuecomment-2158624330 -__OBS_CEF_VER="125.0.22+gc410c95+chromium-125.0.6422.142" +# Check https://github.com/obsproject/obs-studio/wiki/Build-Instructions-For-Linux#obs-browser +# for upstream required CEF version for reference. +__OBS_CEF_VER="127.3.5+g114ea2a+chromium-127.0.6533.120" SRCS="git::commit=tags/$VER;rename=obs-studio::https://github.com/obsproject/obs-studio" SRCS__AMD64="${SRCS} \ tbl::rename=cef.tar.bz2::https://cef-builds.spotifycdn.com/cef_binary_${__OBS_CEF_VER}_linux64_minimal.tar.bz2" SRCS__ARM64="${SRCS} \ tbl::rename=cef.tar.bz2::https://cef-builds.spotifycdn.com/cef_binary_${__OBS_CEF_VER}_linuxarm64_minimal.tar.bz2" CHKSUMS="SKIP" -CHKSUMS__AMD64="$CHKSUMS sha256::9c99e4346bf4e07c81201186e67ef1f35d6204cde14957579a22dd55a49fdfda" -CHKSUMS__ARM64="$CHKSUMS sha256::65e99652b4cd57f29d818bc7aa27f3be119a8ce0c69e59b1ea01af59583d0594" +CHKSUMS__AMD64="SKIP \ + sha256::e7b13b6d92a95625a7a3d5b801a6928cbf41e2ec6afab0d7028bb5b6c88e0d48" +CHKSUMS__ARM64="SKIP \ + sha256::b3c751f7bac03b49825306e96273d6c98dedf26a2fab4e4785964a965859741b" SUBDIR="obs-studio" CHKUPDATE="anitya::id=7239"