Subject: [PATCH] gnu: webrtc-for-telegram-desktop: Update to 0-489.8c233a4.
From: Jonathan Brielmaier <[email-masked]>
To: [email-masked]
Cc: Jonathan Brielmaier <[email-masked]>
Date: Tue, 13 May 2025 22:18:27 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Fixes the build against [email-masked].

* gnu/packages/telegram.scm (webrtc-for-telegram-desktop): Update to 0-489.8c233a4.
[source]: Remove patch who got rebased and merged upstream:
webrtc-for-telegram-desktop-unbundle-libsrtp.patch.
* gnu/local.mk (dist_patch_DATA): Remove it.

Change-Id: Ie07b49a402aa9b11097c7c0c61ac5da0e03fa899
---
 gnu/local.mk                                  |   1 -
 ...or-telegram-desktop-unbundle-libsrtp.patch | 136 ------------------
 gnu/packages/telegram.scm                     |  10 +-
 3 files changed, 3 insertions(+), 144 deletions(-)
 delete mode 100644 gnu/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index ce0f981a419..92f6f8b7cc8 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2411,7 +2411,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/webrtc-audio-processing-big-endian.patch	\
   %D%/packages/patches/webrtc-audio-processing-byte-order-pointer-size.patch \
   %D%/packages/patches/webrtc-audio-processing-x86-no-sse.patch	\
-  %D%/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch \
   %D%/packages/patches/websocketpp-fix-for-cmake-3.15.patch	\
   %D%/packages/patches/wmctrl-64-fix.patch			\
   %D%/packages/patches/wmfire-dont-inline-draw-fire.patch	\
diff --git a/gnu/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch b/gnu/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch
deleted file mode 100644
index 3317d0a9c16..00000000000
--- a/gnu/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch
+++ /dev/null
@@ -1,136 +0,0 @@
-From 62672f3756ecf218252098211d78c13369ab6d28 Mon Sep 17 00:00:00 2001
-From: Nicholas Guriev <[email-masked]>
-Date: Thu, 4 May 2023 16:21:09 +0300
-Subject: [PATCH] Unbundle libSRTP
-
-Avoid private symbols and link against system-wide libSRTP. The excluded code
-in SrtpSession looks unreachable from the call integration in Telegram Desktop.
----
- CMakeLists.txt          |  3 +++
- cmake/libsrtp.cmake     | 13 +++++++++++++
- src/pc/external_hmac.cc |  1 -
- src/pc/external_hmac.h  |  9 ++++++---
- src/pc/srtp_session.cc  | 16 ++++++++++++++--
- 5 files changed, 36 insertions(+), 6 deletions(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index af7d24c21..66bec8fdf 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -2647,5 +2647,8 @@ if (APPLE)
-     libyuv
- )
-+if (LIBSRTP_FOUND)
-+    target_compile_definitions(tg_owt PRIVATE HAVE_LIBSRTP)
-+endif()
- if (NOT absl_FOUND)
-     list(APPEND export_targets libabsl)
- endif()
-diff --git a/cmake/libsrtp.cmake b/cmake/libsrtp.cmake
-index 5124312d2..01f051606 100644
---- a/cmake/libsrtp.cmake
-+++ b/cmake/libsrtp.cmake
-@@ -1,3 +1,16 @@
-+find_package(PkgConfig REQUIRED)
-+pkg_check_modules(LIBSRTP libsrtp2)
-+
-+if (LIBSRTP_FOUND)
-+    add_library(libsrtp INTERFACE EXCLUDE_FROM_ALL)
-+    add_library(tg_owt::libsrtp ALIAS libsrtp)
-+
-+    target_include_directories(libsrtp INTERFACE ${LIBSRTP_INCLUDE_DIRS} ${LIBSRTP_CFLAGS_OTHER})
-+    target_link_libraries(libsrtp INTERFACE ${LIBSRTP_LINK_LIBRARIES} ${LIBSRTP_LDFLAGS_OTHER})
-+
-+    return()
-+endif()
-+
- add_library(libsrtp OBJECT EXCLUDE_FROM_ALL)
- init_target(libsrtp)
- add_library(tg_owt::libsrtp ALIAS libsrtp)
-diff --git a/src/pc/external_hmac.cc b/src/pc/external_hmac.cc
-index 27b5d0e5a..222f5d9ae 100644
---- a/src/pc/external_hmac.cc
-+++ b/src/pc/external_hmac.cc
-@@ -15,7 +15,6 @@
- 
- #include "rtc_base/logging.h"
- #include "rtc_base/zero_memory.h"
--#include "third_party/libsrtp/include/srtp.h"
- 
- // Begin test case 0 */
- static const uint8_t kExternalHmacTestCase0Key[20] = {
-diff --git a/src/pc/external_hmac.h b/src/pc/external_hmac.h
-index c5071fc19..8fdc2f1a7 100644
---- a/src/pc/external_hmac.h
-+++ b/src/pc/external_hmac.h
-@@ -30,9 +30,12 @@
- 
- #include <stdint.h>
- 
--#include "third_party/libsrtp/crypto/include/crypto_types.h"
--#include "third_party/libsrtp/include/srtp.h"
--#include "third_party/libsrtp/include/srtp_priv.h"
-+#ifdef HAVE_LIBSRTP
-+# include <srtp2/auth.h>
-+# include <srtp2/srtp.h>
-+#else
-+# include "srtp_priv.h"
-+#endif
- 
- #define EXTERNAL_HMAC_SHA1 SRTP_HMAC_SHA1 + 1
- #define HMAC_KEY_LENGTH 20
-diff --git a/src/pc/srtp_session.cc b/src/pc/srtp_session.cc
-index 7d1aaf2d6..7b5a789b0 100644
---- a/src/pc/srtp_session.cc
-+++ b/src/pc/srtp_session.cc
-@@ -30,8 +30,12 @@
- #include "rtc_base/thread_annotations.h"
- #include "rtc_base/time_utils.h"
- #include "system_wrappers/include/metrics.h"
--#include "third_party/libsrtp/include/srtp.h"
--#include "third_party/libsrtp/include/srtp_priv.h"
-+
-+#ifdef HAVE_LIBSRTP
-+# include <srtp2/srtp.h>
-+#else
-+# include "srtp_priv.h"
-+#endif
- 
- namespace cricket {
- 
-@@ -290,6 +294,9 @@ bool SrtpSession::UnprotectRtcp(void* p, int in_len, int* out_len) {
- bool SrtpSession::GetRtpAuthParams(uint8_t** key, int* key_len, int* tag_len) {
-   RTC_DCHECK(thread_checker_.IsCurrent());
-   RTC_DCHECK(IsExternalAuthActive());
-+#ifdef HAVE_LIBSRTP
-+  return false;
-+#else
-   if (!IsExternalAuthActive()) {
-     return false;
-   }
-@@ -313,6 +320,7 @@ bool SrtpSession::GetRtpAuthParams(uint8_t** key, int* key_len, int* tag_len) {
-   *key_len = external_hmac->key_length;
-   *tag_len = rtp_auth_tag_len_;
-   return true;
-+#endif
- }
- 
- int SrtpSession::GetSrtpOverhead() const {
-@@ -336,6 +344,9 @@ bool SrtpSession::GetSendStreamPacketIndex(void* p,
-                                            int in_len,
-                                            int64_t* index) {
-   RTC_DCHECK(thread_checker_.IsCurrent());
-+#ifdef HAVE_LIBSRTP
-+  return false;
-+#else
-   srtp_hdr_t* hdr = reinterpret_cast<srtp_hdr_t*>(p);
-   srtp_stream_ctx_t* stream = srtp_get_stream(session_, hdr->ssrc);
-   if (!stream) {
-@@ -346,6 +357,7 @@ bool SrtpSession::GetSendStreamPacketIndex(void* p,
-   *index = static_cast<int64_t>(rtc::NetworkToHost64(
-       srtp_rdbx_get_packet_index(&stream->rtp_rdbx) << 16));
-   return true;
-+#endif
- }
- 
- bool SrtpSession::DoSetKey(int type,
diff --git a/gnu/packages/telegram.scm b/gnu/packages/telegram.scm
index 37772fa2746..65d95711b95 100644
--- a/gnu/packages/telegram.scm
+++ b/gnu/packages/telegram.scm
@@ -274,8 +274,8 @@ (define tgcalls-for-telegram-desktop
       "1p563a11w8jrid96xf03dg6j39ciz28n5f4r6g28lxhiphbqzfym"))))
 
 (define-public webrtc-for-telegram-desktop
-  (let ((commit "c425281150317753d7bc5182c6572abe20f9a784")
-        (revision "456"))
+  (let ((commit "8c233a4c12d6ec1f2aa87991564ac28cc996c57a")
+        (revision "489"))
     (hidden-package
      (package
        (name "webrtc-for-telegram-desktop")
@@ -291,11 +291,7 @@ (define-public webrtc-for-telegram-desktop
           (file-name
            (git-file-name name version))
           (sha256
-           (base32 "1fj48iq56awnrckncy1qc3zhdzifl725hbb6an7wg2v3zmagvrwn"))
-          (patches
-           (search-patches
-            ;; https://github.com/desktop-app/tg_owt/pull/123
-            "webrtc-for-telegram-desktop-unbundle-libsrtp.patch"))
+           (base32 "0d1nglf8irxgavw0p1d23wffmzyzbwapnli45ssgmrn1czzri4gw"))
           (modules '((guix build utils)
                      (ice-9 ftw)
                      (srfi srfi-1)))

base-commit: 380282f3f5b862b67b6601b89eb7749fd9814509
-- 
2.49.0