Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package telegram-desktop for 
openSUSE:Leap:16.0 checked in at 2025-05-09 11:56:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:16.0/telegram-desktop (Old)
 and      /work/SRC/openSUSE:Leap:16.0/.telegram-desktop.new.30101 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "telegram-desktop"

Fri May  9 11:56:18 2025 rev:6 rq:1275371 version:5.13.1

Changes:
--------
--- /work/SRC/openSUSE:Leap:16.0/telegram-desktop/telegram-desktop.changes      
2025-04-14 18:54:21.732155872 +0200
+++ 
/work/SRC/openSUSE:Leap:16.0/.telegram-desktop.new.30101/telegram-desktop.changes
   2025-05-09 11:56:19.332934159 +0200
@@ -1,0 +2,14 @@
+Wed May  7 02:36:50 UTC 2025 - Илья Индиго <i...@ilya.top>
+
+- Updated ada to 3.2.4.
+- Updated openh264-headers to 2.6.0.
+- Updated tg_owt to git20250501
+  * Changed 0002-tg_owt-h264-dlopen.patch.
+  * Added pipewire 1.4 support (removed 0003-tg_owt-pipewire-1.4.patch).
+- Replaced tg_owt-dlopen-headers.tar.gz to openh264-headers-2.6.0.tar.xz.
+- Renamed 0001-dynamic-link-x.patch to dynamic-link-x.patch.
+- Renamed 0002-tg_owt-h264-dlopen.patch to tg_owt-h264-dlopen.patch.
+- Renamed 0001-Fix-build-with-Qt-6.9.patch to Qt-6.9.patch.
+- Used mold linker (keeps RAM consumption within the 16 GB limit).
+
+-------------------------------------------------------------------

Old:
----
  0001-Fix-build-with-Qt-6.9.patch
  0001-dynamic-link-x.patch
  0002-tg_owt-h264-dlopen.patch
  0003-tg_owt-pipewire-1.4.patch
  ada-3.2.1.tar.gz
  tg_owt-dlopen-headers.tar.gz
  tg_owt-git20241202.tar.xz

New:
----
  Qt-6.9.patch
  ada-3.2.4.tar.gz
  dynamic-link-x.patch
  openh264-headers-2.6.0.tar.xz
  tg_owt-git20250501.tar.xz
  tg_owt-h264-dlopen.patch

BETA DEBUG BEGIN:
  Old:- Renamed 0002-tg_owt-h264-dlopen.patch to tg_owt-h264-dlopen.patch.
- Renamed 0001-Fix-build-with-Qt-6.9.patch to Qt-6.9.patch.
- Used mold linker (keeps RAM consumption within the 16 GB limit).
  Old:- Replaced tg_owt-dlopen-headers.tar.gz to openh264-headers-2.6.0.tar.xz.
- Renamed 0001-dynamic-link-x.patch to dynamic-link-x.patch.
- Renamed 0002-tg_owt-h264-dlopen.patch to tg_owt-h264-dlopen.patch.
  Old:- Updated tg_owt to git20250501
  * Changed 0002-tg_owt-h264-dlopen.patch.
  * Added pipewire 1.4 support (removed 0003-tg_owt-pipewire-1.4.patch).
  Old:  * Changed 0002-tg_owt-h264-dlopen.patch.
  * Added pipewire 1.4 support (removed 0003-tg_owt-pipewire-1.4.patch).
- Replaced tg_owt-dlopen-headers.tar.gz to openh264-headers-2.6.0.tar.xz.
BETA DEBUG END:

BETA DEBUG BEGIN:
  New:- Renamed 0002-tg_owt-h264-dlopen.patch to tg_owt-h264-dlopen.patch.
- Renamed 0001-Fix-build-with-Qt-6.9.patch to Qt-6.9.patch.
- Used mold linker (keeps RAM consumption within the 16 GB limit).
  New:- Replaced tg_owt-dlopen-headers.tar.gz to openh264-headers-2.6.0.tar.xz.
- Renamed 0001-dynamic-link-x.patch to dynamic-link-x.patch.
- Renamed 0002-tg_owt-h264-dlopen.patch to tg_owt-h264-dlopen.patch.
  New:- Updated tg_owt to git20250501
  * Changed 0002-tg_owt-h264-dlopen.patch.
  * Added pipewire 1.4 support (removed 0003-tg_owt-pipewire-1.4.patch).
BETA DEBUG END:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ telegram-desktop.spec ++++++
--- /var/tmp/diff_new_pack.TjZtua/_old  2025-05-09 11:56:20.608987830 +0200
+++ /var/tmp/diff_new_pack.TjZtua/_new  2025-05-09 11:56:20.612987998 +0200
@@ -20,8 +20,10 @@
 # 
https://github.com/telegramdesktop/tdesktop/blob/8fab9167beb2407c1153930ed03a4badd0c2b59f/snap/snapcraft.yaml#L87-L88
 %define api_id    611335
 %define api_hash  d524b414d21f4d37f08684c1df41ac9c
-%define ada_ver   3.2.1
-%define owt_ver   git20241202
+%define ada_ver   3.2.4
+%define exp_ver   1.1.0
+%define h264_ver  2.6.0
+%define owt_ver   git20250501
 Name:           telegram-desktop
 Version:        5.13.1
 Release:        0
@@ -30,56 +32,45 @@
 URL:            https://github.com/telegramdesktop/tdesktop
 Source0:        
https://github.com/telegramdesktop/tdesktop/releases/download/v%{version}/tdesktop-%{version}-full.tar.gz
 Source1:        
https://github.com/ada-url/ada/archive/refs/tags/v%{ada_ver}.tar.gz#/ada-%{ada_ver}.tar.gz
-# n=tg_owt && cd /tmp && git clone https://github.com/desktop-app/$n && pushd 
$n && v=git$(TZ=UTC date -d @`git log -1 --format=%at` +%Y%m%d) && d=$n-$v && 
f=$d.tar.xz && git submodule update --init && rm -rf .??* && popd && mv $n $d 
&& tar c --remove-files "$d" | xz -9e > "$f"
-Source2:        tg_owt-%{owt_ver}.tar.xz
-Source3:        tg_owt-dlopen-headers.tar.gz
-Patch1:         0001-dynamic-link-x.patch
-Patch2:         0002-tg_owt-h264-dlopen.patch
-Patch3:         0003-tg_owt-pipewire-1.4.patch
-# PATCH-FIX-UPSTREAM -- https://github.com/desktop-app/lib_base/pull/268
-Patch4:         0001-Fix-build-with-Qt-6.9.patch
+# v=2.6.0 && n=openh264 && d=$n-headers-$v && f=$d.tar.xz && cd /tmp && git 
clone -bv$v --depth=1 https://github.com/cisco/$n.git && mkdir $d && mv 
$n/codec/api/wels/*.h $d && rm -rf $n && tar c --remove-files "$d" | xz -9e > 
"$f"
+Source2:        openh264-headers-%{h264_ver}.tar.xz
+# n=tg_owt && cd /tmp && git clone --depth=1 https://github.com/desktop-app/$n 
&& pushd $n && v=git$(TZ=UTC date -d @`git log -1 --format=%at` +%Y%m%d) && 
d=$n-$v && f=$d.tar.xz && git submodule update --init --depth=1 && rm -rf .??* 
&& popd && mv $n $d && tar c --remove-files "$d" | xz -9e > "$f"
+Source3:        tg_owt-%{owt_ver}.tar.xz
+Patch0:         dynamic-link-x.patch
+Patch1:         tg_owt-h264-dlopen.patch
+Patch2:         Qt-6.9.patch
 BuildRequires:  appstream-glib
-BuildRequires:  chrpath
-BuildRequires:  clang
 BuildRequires:  cmake
-BuildRequires:  desktop-file-utils
-BuildRequires:  enchant-devel
-BuildRequires:  expect-devel
-BuildRequires:  ffmpeg-7-libavcodec-devel
-BuildRequires:  ffmpeg-7-libavdevice-devel
-BuildRequires:  ffmpeg-7-libavfilter-devel
-BuildRequires:  ffmpeg-7-libavformat-devel
-BuildRequires:  ffmpeg-7-libavutil-devel
 BuildRequires:  gcc-c++
 BuildRequires:  glibc-devel
+BuildRequires:  kf6-kcoreaddons-devel
 BuildRequires:  libboost_program_options-devel
 BuildRequires:  libboost_regex-devel
 BuildRequires:  libdispatch-devel
 BuildRequires:  libjpeg-devel
 BuildRequires:  liblz4-devel
+BuildRequires:  mold
+BuildRequires:  ms-gsl-devel
 BuildRequires:  ninja
 BuildRequires:  pkgconfig
-BuildRequires:  python3 >= 3.7
+BuildRequires:  python3
 BuildRequires:  qt6-gui-private-devel
 BuildRequires:  qt6-waylandclient-private-devel
 BuildRequires:  qt6-widgets-private-devel
 BuildRequires:  range-v3-devel
 BuildRequires:  unzip
-BuildRequires:  wayland-devel
 BuildRequires:  xxhash-devel
 BuildRequires:  xz
-BuildRequires:  yasm
-BuildRequires:  cmake(Qt6Concurrent)
-BuildRequires:  cmake(Qt6Core)
-BuildRequires:  cmake(Qt6DBus)
-BuildRequires:  cmake(Qt6Network)
-BuildRequires:  cmake(Qt6OpenGL)
-BuildRequires:  cmake(Qt6OpenGLWidgets)
-BuildRequires:  cmake(Qt6Qml)
-BuildRequires:  cmake(Qt6Quick)
-BuildRequires:  cmake(Qt6Svg)
-BuildRequires:  cmake(Qt6WaylandClient)
-BuildRequires:  cmake(Qt6Widgets)
+BuildRequires:  pkgconfig(Qt6Concurrent)
+BuildRequires:  pkgconfig(Qt6Core)
+BuildRequires:  pkgconfig(Qt6DBus)
+BuildRequires:  pkgconfig(Qt6Network)
+BuildRequires:  pkgconfig(Qt6OpenGLWidgets)
+BuildRequires:  pkgconfig(Qt6Qml)
+BuildRequires:  pkgconfig(Qt6Quick)
+BuildRequires:  pkgconfig(Qt6Svg)
+BuildRequires:  pkgconfig(Qt6WaylandClient)
+BuildRequires:  pkgconfig(Qt6Widgets)
 BuildRequires:  pkgconfig(alsa)
 BuildRequires:  pkgconfig(expat)
 BuildRequires:  pkgconfig(fmt)
@@ -90,10 +81,13 @@
 BuildRequires:  pkgconfig(glibmm-2.68)
 BuildRequires:  pkgconfig(gobject-introspection-1.0)
 BuildRequires:  pkgconfig(gsl)
-BuildRequires:  pkgconfig(gtk+-3.0)
 BuildRequires:  pkgconfig(harfbuzz)
 BuildRequires:  pkgconfig(hunspell)
 BuildRequires:  pkgconfig(jemalloc)
+BuildRequires:  pkgconfig(libavcodec)
+BuildRequires:  pkgconfig(libavfilter)
+BuildRequires:  pkgconfig(libavformat)
+BuildRequires:  pkgconfig(libavutil)
 BuildRequires:  pkgconfig(libcrypto)
 BuildRequires:  pkgconfig(liblzma)
 BuildRequires:  pkgconfig(libmng)
@@ -101,6 +95,8 @@
 BuildRequires:  pkgconfig(libpng)
 BuildRequires:  pkgconfig(libproxy-1.0)
 BuildRequires:  pkgconfig(libpulse)
+BuildRequires:  pkgconfig(libswresample)
+BuildRequires:  pkgconfig(libswscale)
 BuildRequires:  pkgconfig(libtiff-4)
 BuildRequires:  pkgconfig(libva)
 BuildRequires:  pkgconfig(libva-glx)
@@ -111,8 +107,6 @@
 BuildRequires:  pkgconfig(openal)
 BuildRequires:  pkgconfig(openssl)
 BuildRequires:  pkgconfig(opus)
-BuildRequires:  pkgconfig(opusfile)
-BuildRequires:  pkgconfig(opusurl)
 BuildRequires:  pkgconfig(portaudio-2.0)
 BuildRequires:  pkgconfig(portaudiocpp)
 BuildRequires:  pkgconfig(protobuf)
@@ -143,8 +137,6 @@
 Requires:       icu
 Requires:       qt6-imageformats
 Requires:       xdg-desktop-portal
-Recommends:     google-opensans-fonts
-Recommends:     qt6-wayland
 ExclusiveArch:  x86_64 aarch64
 
 %description
@@ -156,38 +148,54 @@
 
 %prep
 %setup -q -n tdesktop-%{version}-full -b1 -b2 -b3
-%autopatch -p1 1 4
+%autopatch -p1 0 2
 
-mkdir -p %{_builddir}/Libraries/ada
-mkdir -p %{_builddir}/Libraries/tg_owt
-mkdir -p %{_builddir}/Libraries/openh264/include
-mv ../ada-%{ada_ver}/* %{_builddir}/Libraries/ada
-mv ../tg_owt-%{owt_ver}/* %{_builddir}/Libraries/tg_owt
-mv ../wels %{_builddir}/Libraries/openh264/include
+mkdir -p ../Libraries/ada
+mv ../ada-%{ada_ver}/* ../Libraries/ada
 
-pushd %{_builddir}/Libraries/tg_owt
-%autopatch -p1 2 3
+mv Telegram/ThirdParty/expected ../Libraries
+
+mkdir -p ../Libraries/openh264/include/wels
+mv ../openh264-headers-%{h264_ver}/* ../Libraries/openh264/include/wels
+
+mkdir -p ../Libraries/tg_owt
+mv ../tg_owt-%{owt_ver}/* ../Libraries/tg_owt
+pushd ../Libraries/tg_owt
+%autopatch -p1 1
 popd
 
 %build
+CFLAGS="%{optflags} -g1 -Wl,-v -fuse-ld=mold"
+export CMAKE_GENERATOR=Ninja
 mkdir -p %{_builddir}/Libraries/install
 
-pushd %{_builddir}/Libraries/ada
+cd %{_builddir}/Libraries/ada
 %cmake -LA \
-      -G Ninja \
-      -B build \
       -DBUILD_SHARED_LIBS=OFF \
       -DCMAKE_BUILD_TYPE=Release \
+      -DCMAKE_C_FLAGS="$CFLAGS" \
+      -DCMAKE_CXX_FLAGS="$CFLAGS" \
       -DCMAKE_INSTALL_PREFIX=%{_builddir}/Libraries/install
-%cmake_build -C build
-ninja install -C build
+%cmake_build
+ninja install
+
+cd %{_builddir}/Libraries/expected
+%cmake -LA \
+      -DCMAKE_BUILD_TYPE=Release \
+      -DCMAKE_C_FLAGS="$CFLAGS" \
+      -DCMAKE_CXX_FLAGS="$CFLAGS" \
+      -DCMAKE_INSTALL_PREFIX=%{_builddir}/Libraries/install \
+      -DEXPECTED_BUILD_PACKAGE=OFF \
+      -DEXPECTED_BUILD_TESTS=OFF
+%cmake_build
+ninja install
 
 cd %{_builddir}/Libraries/tg_owt
 %cmake -LA \
-      -G Ninja \
-      -B out/Release \
       -DBUILD_SHARED_LIBS=OFF \
       -DCMAKE_BUILD_TYPE=Release \
+      -DCMAKE_C_FLAGS="$CFLAGS" \
+      -DCMAKE_CXX_FLAGS="$CFLAGS" \
       -DCMAKE_INSTALL_PREFIX=%{_builddir}/Libraries/install \
       -DTG_OWT_DLOPEN_H264=ON \
       -DTG_OWT_SPECIAL_TARGET=linux \
@@ -197,17 +205,16 @@
       -DTG_OWT_OPUS_INCLUDE_PATH=%{_includedir}/opus \
       -DTG_OWT_FFMPEG_INCLUDE_PATH=%{_includedir}/ffmpeg \
       -DTG_OWT_LIBVPX_INCLUDE_PATH=%{_includedir}/vpx
-%cmake_build -C out/Release
-ninja install -C out/Release
+%cmake_build
+ninja install
 
-pushd %{_builddir}/tdesktop-%{version}-full
+cd %{_builddir}/tdesktop-%{version}-full
 %cmake -LA \
-      -G Ninja \
       -DCMAKE_BUILD_TYPE=Release \
-      -DCMAKE_C_FLAGS="%{optflags} -g1" \
-      -DCMAKE_CXX_FLAGS="%{optflags} -g1" \
+      -DCMAKE_C_FLAGS="$CFLAGS" \
+      -DCMAKE_CXX_FLAGS="$CFLAGS" \
       -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-      -DCMAKE_PREFIX_PATH=%{_builddir}/Libraries/install/lib64/cmake \
+      
-DCMAKE_PREFIX_PATH="%{_builddir}/Libraries/install/lib64/cmake;%{_builddir}/Libraries/install/share/cmake/tl-expected"
 \
       -DDESKTOP_APP_QT6=ON \
       -DQT_VERSION_MAJOR=6 \
       -DTDESKTOP_API_ID=%{api_id} \

++++++ Qt-6.9.patch ++++++
>From bab67be7b40ebf42acf4514f0ef63e4d77ce4dff Mon Sep 17 00:00:00 2001
From: Antonio Rojas <aro...@archlinux.org>
Date: Sat, 1 Mar 2025 01:20:04 +0100
Subject: [PATCH] Fix build with Qt 6.9

---
 .../base/platform/linux/base_linux_xdp_utilities.cpp      | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Telegram/lib_base/base/platform/linux/base_linux_xdp_utilities.cpp 
b/Telegram/lib_base/base/platform/linux/base_linux_xdp_utilities.cpp
index 8aca67c..80626af 100644
--- a/Telegram/lib_base/base/platform/linux/base_linux_xdp_utilities.cpp
+++ b/Telegram/lib_base/base/platform/linux/base_linux_xdp_utilities.cpp
@@ -16,7 +16,11 @@
 #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
 #include <qpa/qplatformintegration.h>
 #include <private/qguiapplication_p.h>
+#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
+#include <private/qdesktopunixservices_p.h>
+#else
 #include <private/qgenericunixservices_p.h>
+#endif // Qt >= 6.9.0
 #endif // Qt >= 6.5.0
 
 #include <sstream>
@@ -39,7 +43,11 @@ std::string ParentWindowID(QWindow *window) {
        }
 
 #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
+       if (const auto services = dynamic_cast<QDesktopUnixServices*>(
+#else
        if (const auto services = dynamic_cast<QGenericUnixServices*>(
+#endif // Qt >= 6.9.0
                        
QGuiApplicationPrivate::platformIntegration()->services())) {
                return services->portalWindowIdentifier(window).toStdString();
        }
-- 
2.49.0


++++++ ada-3.2.1.tar.gz -> ada-3.2.4.tar.gz ++++++
++++ 1904 lines of diff (skipped)

++++++ dynamic-link-x.patch ++++++
diff --git a/tdesktop/cmake/external/webrtc/CMakeLists.txt 
b/tdesktop-copy/cmake/external/webrtc/CMakeLists.txt
index a372fb7..6a81876 100644
--- a/cmake/external/webrtc/CMakeLists.txt
+++ b/cmake/external/webrtc/CMakeLists.txt
@@ -9,7 +9,18 @@ add_library(desktop-app::external_webrtc ALIAS external_webrtc)
 
 if (DESKTOP_APP_USE_PACKAGED)
     find_package(tg_owt REQUIRED)
-    target_link_libraries(external_webrtc INTERFACE tg_owt::tg_owt)
+    target_link_libraries(external_webrtc INTERFACE
+      tg_owt::tg_owt
+      X11
+      Xcomposite
+      Xdamage
+      Xext
+      Xfixes
+      Xrandr
+      Xrender
+      Xtst
+      vpx
+    )
     return()
 endif()
 

++++++ tg_owt-git20241202.tar.xz -> tg_owt-git20250501.tar.xz ++++++
/work/SRC/openSUSE:Leap:16.0/telegram-desktop/tg_owt-git20241202.tar.xz 
/work/SRC/openSUSE:Leap:16.0/.telegram-desktop.new.30101/tg_owt-git20250501.tar.xz
 differ: char 15, line 1

++++++ tg_owt-h264-dlopen.patch ++++++
diff -Pdpru tg_owt-git20250501.orig/cmake/external.cmake 
tg_owt-git20250501/cmake/external.cmake
--- tg_owt-git20250501.orig/cmake/external.cmake        2025-05-01 
16:56:47.396132976 +0300
+++ tg_owt-git20250501/cmake/external.cmake     2025-05-01 17:17:25.251241954 
+0300
@@ -129,7 +129,7 @@ endfunction()
 
 # libopenh264
 set(TG_OWT_OPENH264_INCLUDE_PATH "" CACHE STRING "Include path for openh264.")
-function(link_libopenh264 target_name)
+function(link_libopenh264 target_name with_dlopen)
     if (TG_OWT_PACKAGED_BUILD)
         find_package(PkgConfig REQUIRED)
         pkg_check_modules(OPENH264 REQUIRED openh264)
@@ -145,6 +145,10 @@ function(link_libopenh264 target_name)
             ${TG_OWT_OPENH264_INCLUDE_PATH}
         )
     endif()
+    if (with_dlopen)
+        target_compile_definitions(${target_name} PRIVATE 
-DWEBRTC_USE_H264_DLOPEN)
+        target_sources(${target_name} PRIVATE 
${CMAKE_CURRENT_LIST_DIR}/src/modules/video_coding/codecs/h264/h264_dlopen.cc)
+    endif()
 endfunction()
 
 # libSRTP
diff -Pdpru tg_owt-git20250501.orig/CMakeLists.txt 
tg_owt-git20250501/CMakeLists.txt
--- tg_owt-git20250501.orig/CMakeLists.txt      2025-05-01 16:56:47.393637297 
+0300
+++ tg_owt-git20250501/CMakeLists.txt   2025-05-01 17:20:21.607517353 +0300
@@ -23,6 +23,7 @@ cmake_dependent_option(TG_OWT_USE_X11 "U
 cmake_dependent_option(TG_OWT_USE_PIPEWIRE "Use pipewire for desktop capture." 
ON "UNIX; NOT APPLE" OFF)
 cmake_dependent_option(TG_OWT_DLOPEN_PIPEWIRE "dlopen pipewire for desktop 
capture." ${not_packaged_build} TG_OWT_USE_PIPEWIRE OFF)
 option(TG_OWT_BUILD_AUDIO_BACKENDS "Build webrtc audio backends." OFF)
+option(TG_OWT_DLOPEN_H264 "dlopen H264 for video coding." OFF)
 
 if (BUILD_SHARED_LIBS)
     set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@@ -149,7 +150,7 @@ link_openssl(tg_owt)
 link_ffmpeg(tg_owt)
 link_opus(tg_owt)
 link_libabsl(tg_owt)
-link_libopenh264(tg_owt)
+link_libopenh264(tg_owt ${TG_OWT_DLOPEN_H264})
 link_libsrtp(tg_owt)
 link_libvpx(tg_owt)
 link_crc32c(tg_owt)
diff -Pdpru 
tg_owt-git20250501.orig/src/modules/video_coding/codecs/h264/h264_dlopen.cc 
tg_owt-git20250501/src/modules/video_coding/codecs/h264/h264_dlopen.cc
--- tg_owt-git20250501.orig/src/modules/video_coding/codecs/h264/h264_dlopen.cc 
1970-01-01 03:00:00.000000000 +0300
+++ tg_owt-git20250501/src/modules/video_coding/codecs/h264/h264_dlopen.cc      
2025-05-01 17:29:41.701908949 +0300
@@ -0,0 +1,128 @@
+/*
+ * OpenH264 dlopen code
+ *
+ *  Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include <dlfcn.h>
+#include <cstddef>
+
+#include "h264_dlopen.h"
+
+/*
+ * The symbol binding makes sure we do not run into strict aliasing issues 
which
+ * can lead into segfaults.
+ */
+typedef int (*__oh264_WelsCreateSVCEncoder)(ISVCEncoder **);
+typedef void (*__oh264_WelsDestroySVCEncoder)(ISVCEncoder *);
+typedef int (*__oh264_WelsGetDecoderCapability)(SDecoderCapability *);
+typedef long (*__oh264_WelsCreateDecoder)(ISVCDecoder **);
+typedef void (*__oh264_WelsDestroyDecoder)(ISVCDecoder *);
+typedef OpenH264Version (*__oh264_WelsGetCodecVersion)(void);
+typedef void (*__oh264_WelsGetCodecVersionEx)(OpenH264Version *);
+
+#define OH264_SYMBOL_ENTRY(i)                                                  
\
+  union {                                                                      
\
+    __oh264_##i f;                                                             
\
+    void *obj;                                                                 
\
+  } _oh264_##i
+
+struct oh264_symbols {
+  OH264_SYMBOL_ENTRY(WelsCreateSVCEncoder);
+  OH264_SYMBOL_ENTRY(WelsDestroySVCEncoder);
+  OH264_SYMBOL_ENTRY(WelsGetDecoderCapability);
+  OH264_SYMBOL_ENTRY(WelsCreateDecoder);
+  OH264_SYMBOL_ENTRY(WelsDestroyDecoder);
+  OH264_SYMBOL_ENTRY(WelsGetCodecVersion);
+  OH264_SYMBOL_ENTRY(WelsGetCodecVersionEx);
+};
+
+/* Symbols are bound by loadLibOpenH264() */
+static struct oh264_symbols openh264_symbols;
+
+int oh264_WelsCreateSVCEncoder(ISVCEncoder **ppEncoder) {
+  return openh264_symbols._oh264_WelsCreateSVCEncoder.f(ppEncoder);
+}
+
+void oh264_WelsDestroySVCEncoder(ISVCEncoder *pEncoder) {
+  return openh264_symbols._oh264_WelsDestroySVCEncoder.f(pEncoder);
+}
+
+int oh264_WelsGetDecoderCapability(SDecoderCapability *pDecCapability) {
+  return openh264_symbols._oh264_WelsGetDecoderCapability.f(pDecCapability);
+}
+
+long oh264_WelsCreateDecoder(ISVCDecoder **ppDecoder) {
+  return openh264_symbols._oh264_WelsCreateDecoder.f(ppDecoder);
+}
+
+void oh264_WelsDestroyDecoder(ISVCDecoder *pDecoder) {
+  return openh264_symbols._oh264_WelsDestroyDecoder.f(pDecoder);
+}
+
+OpenH264Version oh264_WelsGetCodecVersion(void) {
+  return openh264_symbols._oh264_WelsGetCodecVersion.f();
+}
+
+void oh264_WelsGetCodecVersionEx(OpenH264Version *pVersion) {
+  openh264_symbols._oh264_WelsGetCodecVersionEx.f(pVersion);
+}
+
+static void *_oh264_bind_symbol(void *handle,
+                                const char *sym_name) {
+    void *sym = NULL;
+
+    sym = dlsym(handle, sym_name);
+    if (sym == NULL) {
+        const char *err = dlerror();
+        return NULL;
+    }
+
+    return sym;
+}
+
+#define oh264_bind_symbol(handle, sym_name)                           \
+  if (openh264_symbols._oh264_##sym_name.obj == NULL) {                      \
+    openh264_symbols._oh264_##sym_name.obj = _oh264_bind_symbol(handle, 
#sym_name); \
+    if (openh264_symbols._oh264_##sym_name.obj == NULL) {                    \
+      return 1;                                                              \
+    }                                                                        \
+  }
+
+int loadLibOpenH264(void) {
+  static bool initialized = false;
+  void *libopenh264 = NULL;
+  const char *err = NULL;
+
+  if (initialized) {
+      return 0;
+  }
+
+#define OPENH264_LIB "libopenh264.so.7"
+  libopenh264 = dlopen(OPENH264_LIB, RTLD_LAZY);
+  err = dlerror();
+  if (err != NULL) {
+    if (libopenh264 != NULL) {
+      dlclose(libopenh264);
+    }
+    return 1;
+  }
+
+  oh264_bind_symbol(libopenh264, WelsCreateSVCEncoder);
+  oh264_bind_symbol(libopenh264, WelsDestroySVCEncoder);
+  oh264_bind_symbol(libopenh264, WelsGetDecoderCapability);
+  oh264_bind_symbol(libopenh264, WelsCreateDecoder);
+  oh264_bind_symbol(libopenh264, WelsDestroyDecoder);
+  oh264_bind_symbol(libopenh264, WelsGetCodecVersion);
+  oh264_bind_symbol(libopenh264, WelsGetCodecVersionEx);
+
+  initialized = true;
+
+  return 0;
+}
diff -Pdpru 
tg_owt-git20250501.orig/src/modules/video_coding/codecs/h264/h264_dlopen.h 
tg_owt-git20250501/src/modules/video_coding/codecs/h264/h264_dlopen.h
--- tg_owt-git20250501.orig/src/modules/video_coding/codecs/h264/h264_dlopen.h  
1970-01-01 03:00:00.000000000 +0300
+++ tg_owt-git20250501/src/modules/video_coding/codecs/h264/h264_dlopen.h       
2025-05-01 17:31:20.183993988 +0300
@@ -0,0 +1,46 @@
+/*
+ * OpenH264 dlopen code
+ *
+ *  Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef HAVE_LIBOPENH264_DLOPEN_H
+#define HAVE_LIBOPENH264_DLOPEN_H
+
+#ifdef WEBRTC_USE_H264_DLOPEN
+
+#include <wels/codec_api.h>
+#include <wels/codec_ver.h>
+
+int oh264_WelsCreateSVCEncoder(ISVCEncoder **ppEncoder);
+#define WelsCreateSVCEncoder oh264_WelsCreateSVCEncoder
+
+void oh264_WelsDestroySVCEncoder(ISVCEncoder *pEncoder);
+#define WelsDestroySVCEncoder oh264_WelsDestroySVCEncoder
+
+int oh264_WelsGetDecoderCapability(SDecoderCapability *pDecCapability);
+#define WelsGetDecoderCapability oh264_WelsGetDecoderCapability
+
+long oh264_WelsCreateDecoder(ISVCDecoder **ppDecoder);
+#define WelsCreateDecoder oh264_WelsCreateDecoder
+
+void oh264_WelsDestroyDecoder(ISVCDecoder *pDecoder);
+#define WelsDestroyDecoder oh264_WelsDestroyDecoder
+
+OpenH264Version oh264_WelsGetCodecVersion(void);
+#define WelsGetCodecVersion oh264_WelsGetCodecVersion
+
+void oh264_WelsGetCodecVersionEx(OpenH264Version *pVersion);
+#define WelsGetCodecVersionEx oh264_WelsGetCodecVersionEx
+
+int loadLibOpenH264(void);
+
+#endif /* WEBRTC_USE_H264_DLOPEN */
+
+#endif /* HAVE_LIBOPENH264_DLOPEN_H */
diff -Pdpru 
tg_owt-git20250501.orig/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc
 tg_owt-git20250501/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc
--- 
tg_owt-git20250501.orig/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc
   2025-05-01 16:56:48.776637476 +0300
+++ 
tg_owt-git20250501/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc    
    2025-05-01 17:24:17.724547184 +0300
@@ -217,6 +217,12 @@ int32_t H264EncoderImpl::InitEncode(cons
     ReportError();
     return release_ret;
   }
+  
+  #ifdef WEBRTC_USE_H264_DLOPEN
+  if (loadLibOpenH264()) {
+    return WEBRTC_VIDEO_CODEC_ERROR;
+  }
+  #endif
 
   int number_of_streams = SimulcastUtility::NumberOfSimulcastStreams(*inst);
   bool doing_simulcast = (number_of_streams > 1);
diff -Pdpru 
tg_owt-git20250501.orig/src/modules/video_coding/codecs/h264/h264_encoder_impl.h
 tg_owt-git20250501/src/modules/video_coding/codecs/h264/h264_encoder_impl.h
--- 
tg_owt-git20250501.orig/src/modules/video_coding/codecs/h264/h264_encoder_impl.h
    2025-05-01 16:56:48.777637476 +0300
+++ tg_owt-git20250501/src/modules/video_coding/codecs/h264/h264_encoder_impl.h 
2025-05-01 17:26:30.342146980 +0300
@@ -30,7 +30,12 @@
 #include "modules/video_coding/codecs/h264/include/h264.h"
 #include "modules/video_coding/svc/scalable_video_controller.h"
 #include "modules/video_coding/utility/quality_scaler.h"
+
+#ifdef WEBRTC_USE_H264_DLOPEN
+#include "h264_dlopen.h"
+#else
 #include <wels/codec_app_def.h>
+#endif
 
 class ISVCEncoder;
 

Reply via email to