unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Distopico <distopico@riseup.net>
To: Hilton Chain <hako@ultrarare.space>
Cc: 64748@debbugs.gnu.org
Subject: [bug#64748] [PATCH v7 2/2] gnu: webrtc-for-telegram-desktop: Update to 0-389.0532942.
Date: Tue, 29 Aug 2023 13:13:52 -0500	[thread overview]
Message-ID: <87msy990my.fsf@riseup.net> (raw)
In-Reply-To: <243d068053e6678cd4c89f2b2d9314b28473dbea.1693234399.git.hako@ultrarare.space>

[-- Attachment #1: Type: text/plain, Size: 9234 bytes --]

Build and the call works fine from my side

On 2023-08-28, Hilton Chain <hako@ultrarare.space> wrote:

> From: Distopico <distopico@riseup.net>
>
> * gnu/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch: New
> file.
> * gnu/local.mk (dist_patch_DATA): Register it.
> * gnu/packages/telegram.scm (webrtc-for-telegram-desktop): Update to
> 0-389.0532942, which fixes `telegram-desktop` calls that are not working with
> OpenSSL 3.
> [source]<patches>: Add the patch.
> <snippet>: Unbundle libsrtp.
> [inputs]: Add libsrtp.
>
> Signed-off-by: Hilton Chain <hako@ultrarare.space>
> ---
>  gnu/local.mk                                  |   1 +
>  ...or-telegram-desktop-unbundle-libsrtp.patch | 137 ++++++++++++++++++
>  gnu/packages/telegram.scm                     |  16 +-
>  3 files changed, 149 insertions(+), 5 deletions(-)
>  create mode 100644 gnu/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 48187d7e64..5ab021eaed 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -2093,6 +2093,7 @@ dist_patch_DATA =						\
>    %D%/packages/patches/wdl-link-libs-and-fix-jnetlib.patch	\
>    %D%/packages/patches/webkitgtk-adjust-bubblewrap-paths.patch	\
>    %D%/packages/patches/webrtc-audio-processing-big-endian.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-update-for-new-gdk-versions.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
> new file mode 100644
> index 0000000000..486f0b1aa5
> --- /dev/null
> +++ b/gnu/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch
> @@ -0,0 +1,137 @@
> +From 62672f3756ecf218252098211d78c13369ab6d28 Mon Sep 17 00:00:00 2001
> +From: Nicholas Guriev <nicholas@guriev.su>
> +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,6 +2647,9 @@ if (TG_OWT_USE_PROTOBUF)
> +     list(APPEND export_targets proto)
> + endif()
> +
> ++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 88daea7d7d..4814c22b6c 100644
> --- a/gnu/packages/telegram.scm
> +++ b/gnu/packages/telegram.scm
> @@ -1,8 +1,9 @@
>  ;;; GNU Guix --- Functional package management for GNU
>  ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
> -;;; Copyright © 2022 Hilton Chain <hako@ultrarare.space>
> +;;; Copyright © 2022, 2023 Hilton Chain <hako@ultrarare.space>
>  ;;; Copyright © 2023 Saku Laesvuori <saku@laesvuori.fi>
>  ;;; Copyright © 2023 Lu Hui <luhux76@gmail.com>
> +;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico@riseup.net>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -266,8 +267,8 @@ (define tgcalls-for-telegram-desktop
>        "193m2gkvipijqbfd6a8mhg9nd63wlnshzgspk3pip57vk21l709z"))))
>
>  (define-public webrtc-for-telegram-desktop
> -  (let ((commit "5098730b9eb6173f0b52068fe2555b7c1015123a")
> -        (revision "328"))
> +  (let ((commit "0532942ac6176a66ef184fb728a4cbb02958fc0b")
> +        (revision "389"))
>      (hidden-package
>       (package
>         (name "webrtc-for-telegram-desktop")
> @@ -283,14 +284,18 @@ (define-public webrtc-for-telegram-desktop
>            (file-name
>             (git-file-name name version))
>            (sha256
> -           (base32 "1lk54zlrff59rj5k9dylsgz4sdds4728psrk8m3v9qn5y8d6z8qy"))
> +           (base32 "0fary99yl1ddk5zjpfy0pyb5brd268j41plcnvv9qjyf0wj9hf2k"))
> +          (patches
> +           (search-patches
> +            ;; https://github.com/desktop-app/tg_owt/pull/123
> +            "webrtc-for-telegram-desktop-unbundle-libsrtp.patch"))
>            (modules '((guix build utils)
>                       (ice-9 ftw)
>                       (srfi srfi-1)))
>            (snippet
>             #~(begin
>                 (let ((keep
> -                      '("libsrtp" "rnnoise"
> +                      '("rnnoise"
>                          ;; Not available in Guix.
>                          "pffft")))
>                   (with-directory-excursion "src/third_party"
> @@ -325,6 +330,7 @@ (define-public webrtc-for-telegram-desktop
>                libdrm
>                libglvnd
>                libjpeg-turbo
> +              libsrtp
>                libvpx
>                libxcomposite
>                libxdamage


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 515 bytes --]

  reply	other threads:[~2023-08-29 18:16 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-20 17:18 [bug#64748] [PATCH] gnu: webrtc-for-telegram-desktop: Update to a45d8b8 Distopico
2023-07-20 19:33 ` Saku Laesvuori via Guix-patches via
2023-07-20 20:21   ` Distopico
2023-07-20 21:06     ` Saku Laesvuori via Guix-patches via
2023-07-20 23:09       ` Distopico
2023-07-21  7:22         ` Saku Laesvuori via Guix-patches via
2023-07-22  6:36           ` Raghav Gururajan via Guix-patches via
2023-07-22  8:25             ` Saku Laesvuori via Guix-patches via
2023-07-24 17:07               ` Distopico
2023-07-24 20:17                 ` Raghav Gururajan via Guix-patches via
2023-07-26  7:24                   ` Saku Laesvuori via Guix-patches via
2023-07-26 18:54                     ` Distopico
2023-07-20 23:26 ` [bug#64748] [PATCH v2] " Distopico
2023-07-26 18:54 ` [bug#64748] [PATCH v3] " Distopico
2023-07-26 19:13   ` Saku Laesvuori via Guix-patches via
2023-07-26 19:22     ` Distopico
2023-07-26 19:21 ` [bug#64748] [PATCH v4] " Distopico
2023-07-26 20:09   ` Saku Laesvuori via Guix-patches via
2023-08-05  2:59     ` [bug#64748] [PATCH] " Distopico
2023-08-07  9:38       ` Hilton Chain via Guix-patches via
2023-08-07 12:26         ` Hilton Chain via Guix-patches via
2023-08-28 13:30 ` [bug#64748] [PATCH v6 0/2] gnu: webrtc-for-telegram-desktop: Update to 0-389.0532942 Hilton Chain via Guix-patches via
2023-08-28 13:31   ` [bug#64748] [PATCH v6 1/2] gnu: libyuv-for-telegram-desktop: Update to 0-2439.77c2121 Hilton Chain via Guix-patches via
2023-08-28 13:31   ` [bug#64748] [PATCH v6 2/2] gnu: webrtc-for-telegram-desktop: Update to 0-389.0532942 Hilton Chain via Guix-patches via
2023-08-28 14:56 ` [bug#64748] [PATCH v7 0/2] " Hilton Chain via Guix-patches via
2023-08-28 15:00   ` [bug#64748] [PATCH v7 1/2] gnu: libyuv-for-telegram-desktop: Update to 0-2439.77c2121 Hilton Chain via Guix-patches via
2023-08-28 15:00   ` [bug#64748] [PATCH v7 2/2] gnu: webrtc-for-telegram-desktop: Update to 0-389.0532942 Hilton Chain via Guix-patches via
2023-08-29 18:13     ` Distopico [this message]
2023-09-01  9:01       ` bug#64748: " Hilton Chain via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87msy990my.fsf@riseup.net \
    --to=distopico@riseup.net \
    --cc=64748@debbugs.gnu.org \
    --cc=hako@ultrarare.space \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).