GNU bug report logs - #64748
[PATCH] gnu: webrtc-for-telegram-desktop: Update to a45d8b8

Previous Next

Package: guix-patches;

Reported by: Distopico <distopico <at> riseup.net>

Date: Thu, 20 Jul 2023 17:20:02 UTC

Severity: normal

Tags: patch

Done: Hilton Chain <hako <at> ultrarare.space>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 64748 in the body.
You can then email your comments to 64748 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to rg <at> raghavgururajan.name, hako <at> ultrarare.space, saku <at> laesvuori.fi, guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Thu, 20 Jul 2023 17:20:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Distopico <distopico <at> riseup.net>:
New bug report received and forwarded. Copy sent to rg <at> raghavgururajan.name, hako <at> ultrarare.space, saku <at> laesvuori.fi, guix-patches <at> gnu.org. (Thu, 20 Jul 2023 17:20:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Distopico <distopico <at> riseup.net>
To: guix-patches <at> gnu.org
Cc: Distopico <distopico <at> riseup.net>
Subject: [PATCH] gnu: webrtc-for-telegram-desktop: Update to a45d8b8
Date: Thu, 20 Jul 2023 12:18:18 -0500
Fixes telegram-desktop call not working with openSSL 3

see: https://github.com/telegramdesktop/tdesktop/issues/26108

* gnu/packages/telegram.scm (webrtc-for-telegram-desktop): Update to a45d8b8 revision commit
---
 gnu/packages/telegram.scm | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/telegram.scm b/gnu/packages/telegram.scm
index aa01c2f692..aeab249198 100644
--- a/gnu/packages/telegram.scm
+++ b/gnu/packages/telegram.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2021 Raghav Gururajan <rg <at> raghavgururajan.name>
 ;;; Copyright © 2022 Hilton Chain <hako <at> ultrarare.space>
 ;;; Copyright © 2023 Saku Laesvuori <saku <at> laesvuori.fi>
+;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico <at> riseup.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -96,6 +97,21 @@ (define libyuv-for-telegram-desktop
        (base32
         "0mm56p8iapfild2xdw4w8zi35c3xm06fgagiali644gnxdmnym6c")))))
 
+(define libsrtp-for-telegram-desktop
+  (let ((commit "a566a9cfcd619e8327784aa7cff4a1276dc1e895")
+        (revision "1494"))
+    (origin
+      (method git-fetch)
+      (uri (git-reference
+            (url "https://github.com/cisco/libsrtp")
+            (commit commit)))
+      (file-name (git-file-name
+                  "libsrtp-for-telegram-desktop"
+                  (git-version "0" revision commit)))
+      (sha256
+       (base32
+        "1ichw2v9s2mggi5p2wbbmlg55q4r48dxi3ks7ykfcfkmh7pb1w1s")))))
+
 (define cmake-helpers-for-telegram-desktop
   (origin
     (method git-fetch)
@@ -265,8 +281,8 @@ (define tgcalls-for-telegram-desktop
       "193m2gkvipijqbfd6a8mhg9nd63wlnshzgspk3pip57vk21l709z"))))
 
 (define-public webrtc-for-telegram-desktop
-  (let ((commit "5098730b9eb6173f0b52068fe2555b7c1015123a")
-        (revision "328"))
+  (let ((commit "a45d8b8f0a99bd0e5118dda1dc4a8b7b3ad5dcfd")
+        (revision "388"))
     (hidden-package
      (package
        (name "webrtc-for-telegram-desktop")
@@ -282,14 +298,14 @@ (define-public webrtc-for-telegram-desktop
           (file-name
            (git-file-name name version))
           (sha256
-           (base32 "1lk54zlrff59rj5k9dylsgz4sdds4728psrk8m3v9qn5y8d6z8qy"))
+           (base32 "1qs3ikkd6l56brj40cv6wlhx5gj5avisj9mj8ypjfwcyw9hb2n5y"))
           (modules '((guix build utils)
                      (ice-9 ftw)
                      (srfi srfi-1)))
           (snippet
            #~(begin
                (let ((keep
-                      '("libsrtp" "rnnoise"
+                      '("rnnoise" "libsrtp_config"
                         ;; Not available in Guix.
                         "pffft")))
                  (with-directory-excursion "src/third_party"
@@ -311,9 +327,12 @@ (define-public webrtc-for-telegram-desktop
              (add-after 'unpack 'unpack-additional-sources
                (lambda _
                  (let* ((third-party (string-append (getcwd) "/src/third_party"))
-                        (libyuv-to (string-append third-party "/libyuv")))
+                        (libyuv-to (string-append third-party "/libyuv"))
+                        (libsrtp-to (string-append third-party "/libsrtp")))
                    (copy-recursively #$libyuv-for-telegram-desktop
-                                     libyuv-to)))))))
+                                     libyuv-to)
+                   (copy-recursively #$libsrtp-for-telegram-desktop
+                                     libsrtp-to)))))))
        (native-inputs (list pkg-config python-wrapper yasm))
        (inputs
         (list abseil-cpp-cxxstd17

base-commit: 13cb9b302868b5a966a6ae177412c474084f4bf1
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Thu, 20 Jul 2023 19:34:02 GMT) Full text and rfc822 format available.

Message #8 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Saku Laesvuori <saku <at> laesvuori.fi>
To: Distopico <distopico <at> riseup.net>
Cc: rg <at> raghavgururajan.name, 64748 <at> debbugs.gnu.org, hako <at> ultrarare.space
Subject: Re: [bug#64748] [PATCH] gnu: webrtc-for-telegram-desktop: Update to
 a45d8b8
Date: Thu, 20 Jul 2023 22:33:53 +0300
[Message part 1 (text/plain, inline)]
> Fixes telegram-desktop call not working with openSSL 3
> 
> see: https://github.com/telegramdesktop/tdesktop/issues/26108
> 
> * gnu/packages/telegram.scm (webrtc-for-telegram-desktop): Update to a45d8b8 revision commit

You should probably mention adding `libsrtp-for-telegram-desktop` in the
ChangeLog.

> @@ -96,6 +97,21 @@ (define libyuv-for-telegram-desktop
>         (base32
>          "0mm56p8iapfild2xdw4w8zi35c3xm06fgagiali644gnxdmnym6c")))))
>  
> +(define libsrtp-for-telegram-desktop
> +  (let ((commit "a566a9cfcd619e8327784aa7cff4a1276dc1e895")
> +        (revision "1494"))
> +    (origin
> +      (method git-fetch)
> +      (uri (git-reference
> +            (url "https://github.com/cisco/libsrtp")
> +            (commit commit)))
> +      (file-name (git-file-name
> +                  "libsrtp-for-telegram-desktop"
> +                  (git-version "0" revision commit)))
> +      (sha256
> +       (base32
> +        "1ichw2v9s2mggi5p2wbbmlg55q4r48dxi3ks7ykfcfkmh7pb1w1s")))))
> +

Have you tried using the libsrtp version packaged in Guix as an input to
`webrtc-for-telegram-desktop` instead of bundling it? If that doesn't
work, have you tried packaging libsrtp 2.5.0 and using it as an input?
It would probably be relatively easy with record inheriting.

I'm quite new to Guix (and couldn't push changes even if they were
perfect) so someone else might have more comments on this.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Thu, 20 Jul 2023 20:25:01 GMT) Full text and rfc822 format available.

Message #11 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Distopico <distopico <at> riseup.net>
To: Saku Laesvuori <saku <at> laesvuori.fi>
Cc: rg <at> raghavgururajan.name, 64748 <at> debbugs.gnu.org, hako <at> ultrarare.space
Subject: Re: [bug#64748] [PATCH] gnu: webrtc-for-telegram-desktop: Update to
 a45d8b8
Date: Thu, 20 Jul 2023 15:21:05 -0500
[Message part 1 (text/plain, inline)]
On 2023-07-20, Saku Laesvuori <saku <at> laesvuori.fi> wrote:

>
> You should probably mention adding `libsrtp-for-telegram-desktop` in the
> ChangeLog.

Looks like it's not longer necessary, Changelog is auto-generated, that
said in the main Changelog

>
> Have you tried using the libsrtp version packaged in Guix as an input to
> `webrtc-for-telegram-desktop` instead of bundling it? If that doesn't
> work, have you tried packaging libsrtp 2.5.0 and using it as an input?
> It would probably be relatively easy with record inheriting.
>
> I'm quite new to Guix (and couldn't push changes even if they were
> perfect) so someone else might have more comments on this.
>

I tried but it require source code inside libsrtp folder, for example
'/crypto/cipher/cipher.c', also libsrtp package is the compiled version
and webrtc-.. require source code from libsrtp.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Thu, 20 Jul 2023 21:07:02 GMT) Full text and rfc822 format available.

Message #14 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Saku Laesvuori <saku <at> laesvuori.fi>
To: Distopico <distopico <at> riseup.net>
Cc: rg <at> raghavgururajan.name, 64748 <at> debbugs.gnu.org, hako <at> ultrarare.space
Subject: Re: [bug#64748] [PATCH] gnu: webrtc-for-telegram-desktop: Update to
 a45d8b8
Date: Fri, 21 Jul 2023 00:06:00 +0300
[Message part 1 (text/plain, inline)]
> > You should probably mention adding `libsrtp-for-telegram-desktop` in the
> > ChangeLog.
> 
> Looks like it's not longer necessary, Changelog is auto-generated, that
> said in the main Changelog

I mean the commit message. Now your commit message's ChangeLog only
mentions updating webrtc-for-telegram-desktop. See my last telegram
commit 6192acf8b77 for an example of what I'm talking about.

I would assume the ChangeLog file is autogenerated based on the commit
messages.

> > Have you tried using the libsrtp version packaged in Guix as an input to
> > `webrtc-for-telegram-desktop` instead of bundling it? If that doesn't
> > work, have you tried packaging libsrtp 2.5.0 and using it as an input?
> > It would probably be relatively easy with record inheriting.
> >
> > I'm quite new to Guix (and couldn't push changes even if they were
> > perfect) so someone else might have more comments on this.
> 
> I tried but it require source code inside libsrtp folder, for example
> '/crypto/cipher/cipher.c', also libsrtp package is the compiled version
> and webrtc-.. require source code from libsrtp.

You would probably have to patch the `CMakeLists.txt` so it doesn't try
to build libsrtp from source, see what I did with crc32c in the
mentioned commit for reference. It is quite possible that telegram
doesn't actually need the source code and they are simply using a git
submodule to simplify their own dependency versioning and development.

You might also have to add a new libsrtp version because the one
packaged in Guix is not configured to use openssl unlike telegram
expects. I'd still try the packaged version first if compiling telegram
a few more times isn't a big problem for you.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Thu, 20 Jul 2023 23:18:01 GMT) Full text and rfc822 format available.

Message #17 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Distopico <distopico <at> riseup.net>
To: Saku Laesvuori <saku <at> laesvuori.fi>
Cc: rg <at> raghavgururajan.name, 64748 <at> debbugs.gnu.org, hako <at> ultrarare.space
Subject: Re: [bug#64748] [PATCH] gnu: webrtc-for-telegram-desktop: Update to
 a45d8b8
Date: Thu, 20 Jul 2023 18:09:13 -0500
[Message part 1 (text/plain, inline)]
On 2023-07-21, Saku Laesvuori <saku <at> laesvuori.fi> wrote:

>
> I mean the commit message. Now your commit message's ChangeLog only
> mentions updating webrtc-for-telegram-desktop. See my last telegram
> commit 6192acf8b77 for an example of what I'm talking about.
>
> I would assume the ChangeLog file is autogenerated based on the commit
> messages.
>
Make sense, I'll update the patch to add more description

>
> You would probably have to patch the `CMakeLists.txt` so it doesn't try
> to build libsrtp from source, see what I did with crc32c in the
> mentioned commit for reference. It is quite possible that telegram
> doesn't actually need the source code and they are simply using a git
> submodule to simplify their own dependency versioning and development.
>
> You might also have to add a new libsrtp version because the one
> packaged in Guix is not configured to use openssl unlike telegram
> expects. I'd still try the packaged version first if compiling telegram
> a few more times isn't a big problem for you.
>
I tried but didn't work, this change is similar to **libyuv**, that have
reference to the source code of that external library: example
https://github.com/desktop-app/tg_owt/blob/83-sdk/src/api/video/i010_buffer.cc#L17

So the case of **libsrtp** is similar, check for example:
- https://github.com/desktop-app/tg_owt/blob/master/src/pc/srtp_session_unittest.cc#L25
- https://github.com/desktop-app/tg_owt/blob/master/src/pc/external_hmac.cc#L18
- https://github.com/desktop-app/tg_owt/blob/master/src/pc/BUILD.gn#L174

So change that will require patch several files, not just
`CMakeLists.txt`, patch all those file will be make this package hard to
maintain.

but you can try if you want and let me know if works.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to rg <at> raghavgururajan.name, hako <at> ultrarare.space, saku <at> laesvuori.fi, guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Thu, 20 Jul 2023 23:30:02 GMT) Full text and rfc822 format available.

Message #20 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Distopico <distopico <at> riseup.net>
To: 64748 <at> debbugs.gnu.org
Cc: Distopico <distopico <at> riseup.net>
Subject: [PATCH v2] gnu: webrtc-for-telegram-desktop: Update to a45d8b8
Date: Thu, 20 Jul 2023 18:26:59 -0500
Fixes telegram-desktop call not working with openSSL 3

Add libsrtp-for-telegram-desktop because webrtc (tg_owt) now use `libsrtp` as
submodule and in the code use code source directly from the submodule.

see: https://github.com/telegramdesktop/tdesktop/issues/26108

* gnu/packages/telegram.scm (webrtc-for-telegram-desktop): Update to a45d8b8 revision commit
* gnu/packages/telegram.scm (libsrtp-for-telegram-desktop): Add libsrtp a566a9 revision commit
---
 Add more context about the change in the commit message

 gnu/packages/telegram.scm | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/telegram.scm b/gnu/packages/telegram.scm
index aa01c2f692..aeab249198 100644
--- a/gnu/packages/telegram.scm
+++ b/gnu/packages/telegram.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2021 Raghav Gururajan <rg <at> raghavgururajan.name>
 ;;; Copyright © 2022 Hilton Chain <hako <at> ultrarare.space>
 ;;; Copyright © 2023 Saku Laesvuori <saku <at> laesvuori.fi>
+;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico <at> riseup.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -96,6 +97,21 @@ (define libyuv-for-telegram-desktop
        (base32
         "0mm56p8iapfild2xdw4w8zi35c3xm06fgagiali644gnxdmnym6c")))))
 
+(define libsrtp-for-telegram-desktop
+  (let ((commit "a566a9cfcd619e8327784aa7cff4a1276dc1e895")
+        (revision "1494"))
+    (origin
+      (method git-fetch)
+      (uri (git-reference
+            (url "https://github.com/cisco/libsrtp")
+            (commit commit)))
+      (file-name (git-file-name
+                  "libsrtp-for-telegram-desktop"
+                  (git-version "0" revision commit)))
+      (sha256
+       (base32
+        "1ichw2v9s2mggi5p2wbbmlg55q4r48dxi3ks7ykfcfkmh7pb1w1s")))))
+
 (define cmake-helpers-for-telegram-desktop
   (origin
     (method git-fetch)
@@ -265,8 +281,8 @@ (define tgcalls-for-telegram-desktop
       "193m2gkvipijqbfd6a8mhg9nd63wlnshzgspk3pip57vk21l709z"))))
 
 (define-public webrtc-for-telegram-desktop
-  (let ((commit "5098730b9eb6173f0b52068fe2555b7c1015123a")
-        (revision "328"))
+  (let ((commit "a45d8b8f0a99bd0e5118dda1dc4a8b7b3ad5dcfd")
+        (revision "388"))
     (hidden-package
      (package
        (name "webrtc-for-telegram-desktop")
@@ -282,14 +298,14 @@ (define-public webrtc-for-telegram-desktop
           (file-name
            (git-file-name name version))
           (sha256
-           (base32 "1lk54zlrff59rj5k9dylsgz4sdds4728psrk8m3v9qn5y8d6z8qy"))
+           (base32 "1qs3ikkd6l56brj40cv6wlhx5gj5avisj9mj8ypjfwcyw9hb2n5y"))
           (modules '((guix build utils)
                      (ice-9 ftw)
                      (srfi srfi-1)))
           (snippet
            #~(begin
                (let ((keep
-                      '("libsrtp" "rnnoise"
+                      '("rnnoise" "libsrtp_config"
                         ;; Not available in Guix.
                         "pffft")))
                  (with-directory-excursion "src/third_party"
@@ -311,9 +327,12 @@ (define-public webrtc-for-telegram-desktop
              (add-after 'unpack 'unpack-additional-sources
                (lambda _
                  (let* ((third-party (string-append (getcwd) "/src/third_party"))
-                        (libyuv-to (string-append third-party "/libyuv")))
+                        (libyuv-to (string-append third-party "/libyuv"))
+                        (libsrtp-to (string-append third-party "/libsrtp")))
                    (copy-recursively #$libyuv-for-telegram-desktop
-                                     libyuv-to)))))))
+                                     libyuv-to)
+                   (copy-recursively #$libsrtp-for-telegram-desktop
+                                     libsrtp-to)))))))
        (native-inputs (list pkg-config python-wrapper yasm))
        (inputs
         (list abseil-cpp-cxxstd17

base-commit: 13cb9b302868b5a966a6ae177412c474084f4bf1
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Fri, 21 Jul 2023 07:23:01 GMT) Full text and rfc822 format available.

Message #23 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Saku Laesvuori <saku <at> laesvuori.fi>
To: Distopico <distopico <at> riseup.net>
Cc: rg <at> raghavgururajan.name, 64748 <at> debbugs.gnu.org, hako <at> ultrarare.space
Subject: Re: [bug#64748] [PATCH] gnu: webrtc-for-telegram-desktop: Update to
 a45d8b8
Date: Fri, 21 Jul 2023 10:22:42 +0300
[Message part 1 (text/plain, inline)]
> > You would probably have to patch the `CMakeLists.txt` so it doesn't try
> > to build libsrtp from source, see what I did with crc32c in the
> > mentioned commit for reference. It is quite possible that telegram
> > doesn't actually need the source code and they are simply using a git
> > submodule to simplify their own dependency versioning and development.
> >
> > You might also have to add a new libsrtp version because the one
> > packaged in Guix is not configured to use openssl unlike telegram
> > expects. I'd still try the packaged version first if compiling telegram
> > a few more times isn't a big problem for you.
>
> I tried but didn't work, this change is similar to **libyuv**, that have
> reference to the source code of that external library: example
> https://github.com/desktop-app/tg_owt/blob/83-sdk/src/api/video/i010_buffer.cc#L17
> 
> So the case of **libsrtp** is similar, check for example:
> - https://github.com/desktop-app/tg_owt/blob/master/src/pc/srtp_session_unittest.cc#L25
> - https://github.com/desktop-app/tg_owt/blob/master/src/pc/external_hmac.cc#L18
> - https://github.com/desktop-app/tg_owt/blob/master/src/pc/BUILD.gn#L174
> 
> So change that will require patch several files, not just
> `CMakeLists.txt`, patch all those file will be make this package hard to
> maintain.

I see. I think libsrtp is small enough that unbundling it is not worth
the effort of patching all those files.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Sat, 22 Jul 2023 06:37:02 GMT) Full text and rfc822 format available.

Message #26 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Raghav Gururajan <rg <at> raghavgururajan.name>
To: Saku Laesvuori <saku <at> laesvuori.fi>, Distopico <distopico <at> riseup.net>
Cc: hako <at> ultrarare.space, 64748 <at> debbugs.gnu.org
Subject: Re: [bug#64748] [PATCH] gnu: webrtc-for-telegram-desktop: Update to
 a45d8b8
Date: Sat, 22 Jul 2023 02:36:39 -0400
[Message part 1 (text/plain, inline)]
If libsrtp in Guix uses something other than openssl by default, then we 
could create a package-definition "libsrtp-openssl" which inherits from 
"libsrtp" and build-flagged to use openssl. We can then use that for 
telegram desktop.

Thoughts?

Regards,
RG.
[OpenPGP_signature (application/pgp-signature, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Sat, 22 Jul 2023 08:26:02 GMT) Full text and rfc822 format available.

Message #29 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Saku Laesvuori <saku <at> laesvuori.fi>
To: Raghav Gururajan <rg <at> raghavgururajan.name>
Cc: hako <at> ultrarare.space, 64748 <at> debbugs.gnu.org,
 Distopico <distopico <at> riseup.net>
Subject: Re: [bug#64748] [PATCH] gnu: webrtc-for-telegram-desktop: Update to
 a45d8b8
Date: Sat, 22 Jul 2023 11:25:16 +0300
[Message part 1 (text/plain, inline)]
> If libsrtp in Guix uses something other than openssl by default, then we 
> could create a package-definition "libsrtp-openssl" which inherits from 
> "libsrtp" and build-flagged to use openssl. We can then use that for 
> telegram desktop.

Yes, but we would still need to patch webrtc-for-telegram-desktop as the
code currently refers to headers in the submodule directory. Now that I
think of it, it could actually be relatively easy with a regex substitution
(something like s!^#include "third_party/(srtp/[^"]*)"$!#include <\1>!)
on every file. That's of course assuming that the code only refers to
headers in the submodule.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Mon, 24 Jul 2023 17:17:01 GMT) Full text and rfc822 format available.

Message #32 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Distopico <distopico <at> riseup.net>
To: Saku Laesvuori <saku <at> laesvuori.fi>
Cc: Raghav Gururajan <rg <at> raghavgururajan.name>, 64748 <at> debbugs.gnu.org,
 hako <at> ultrarare.space
Subject: Re: [bug#64748] [PATCH] gnu: webrtc-for-telegram-desktop: Update to
 a45d8b8
Date: Mon, 24 Jul 2023 12:07:12 -0500
I just tested trying to replace all the libsrtp but not luck from side,
they use for example:
- third_party/libsrtp/crypto/include/crypto_types.h
- third_party/libsrtp/include/srtp.h

not exposed by "libsrtp" package, also they use a custom configuration
for that library
https://github.com/desktop-app/tg_owt/blob/master/src/third_party/libsrtp_config/config.h

Also there is many other references to `libsrtp` .C source code
https://github.com/desktop-app/tg_owt/blob/a45d8b8f0a99bd0e5118dda1dc4a8b7b3ad5dcfd/cmake/libsrtp.cmake#L4

I was checking nix implementation and they just use the submodules
https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/applications/networking/instant-messengers/telegram/telegram-desktop/tg_owt.nix#L19
and not "srtp" package.

So I think the patch that i sent is a good solution, similar to the nix
one, but if someone else want to try another option would be great.


On 2023-07-22, Saku Laesvuori <saku <at> laesvuori.fi> wrote:

> [[PGP Signed Part:Undecided]]
>> If libsrtp in Guix uses something other than openssl by default, then we 
>> could create a package-definition "libsrtp-openssl" which inherits from 
>> "libsrtp" and build-flagged to use openssl. We can then use that for 
>> telegram desktop.
>
> Yes, but we would still need to patch webrtc-for-telegram-desktop as the
> code currently refers to headers in the submodule directory. Now that I
> think of it, it could actually be relatively easy with a regex substitution
> (something like s!^#include "third_party/(srtp/[^"]*)"$!#include <\1>!)
> on every file. That's of course assuming that the code only refers to
> headers in the submodule.
>
> [[End of PGP Signed Part]]





Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Mon, 24 Jul 2023 20:18:02 GMT) Full text and rfc822 format available.

Message #35 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Raghav Gururajan <rg <at> raghavgururajan.name>
To: Distopico <distopico <at> riseup.net>, Saku Laesvuori <saku <at> laesvuori.fi>
Cc: hako <at> ultrarare.space, 64748 <at> debbugs.gnu.org
Subject: Re: [bug#64748] [PATCH] gnu: webrtc-for-telegram-desktop: Update to
 a45d8b8
Date: Mon, 24 Jul 2023 16:17:19 -0400
[Message part 1 (text/plain, inline)]
Hello,

> I just tested trying to replace all the libsrtp but not luck from side,
> they use for example:
> - third_party/libsrtp/crypto/include/crypto_types.h
> - third_party/libsrtp/include/srtp.h
>
>> Yes, but we would still need to patch webrtc-for-telegram-desktop as the
>> code currently refers to headers in the submodule directory. Now that I
>> think of it, it could actually be relatively easy with a regex substitution
>> (something like s!^#include "third_party/(srtp/[^"]*)"$!#include <\1>!)
>> on every file. That's of course assuming that the code only refers to
>> headers in the submodule.

I was wondering if we could add new phase after unpack that copies 
contents from libsrtp package to `[build-dir]/third_party/libsrtp`.

Regards,
RG.

[OpenPGP_signature (application/pgp-signature, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Wed, 26 Jul 2023 07:26:02 GMT) Full text and rfc822 format available.

Message #38 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Saku Laesvuori <saku <at> laesvuori.fi>
To: Raghav Gururajan <rg <at> raghavgururajan.name>
Cc: hako <at> ultrarare.space, 64748 <at> debbugs.gnu.org,
 Distopico <distopico <at> riseup.net>
Subject: Re: [bug#64748] [PATCH] gnu: webrtc-for-telegram-desktop: Update to
 a45d8b8
Date: Wed, 26 Jul 2023 10:24:58 +0300
[Message part 1 (text/plain, inline)]
> I was wondering if we could add new phase after unpack that copies 
> contents from libsrtp package to `[build-dir]/third_party/libsrtp`.

Simply replacing #$libsrtp-for-telegram-desktop with #$(package-source
libsrtp) in the unpack-additional-sources phase seems to work (builds fine and
telegram doesn't crash; I haven't tried calls).
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Wed, 26 Jul 2023 18:55:01 GMT) Full text and rfc822 format available.

Message #41 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Distopico <distopico <at> riseup.net>
To: Saku Laesvuori <saku <at> laesvuori.fi>
Cc: Raghav Gururajan <rg <at> raghavgururajan.name>, 64748 <at> debbugs.gnu.org,
 hako <at> ultrarare.space
Subject: Re: [bug#64748] [PATCH] gnu: webrtc-for-telegram-desktop: Update to
 a45d8b8
Date: Wed, 26 Jul 2023 13:54:02 -0500
Tested with calls and works fine, changes in the last path

On 2023-07-26, Saku Laesvuori <saku <at> laesvuori.fi> wrote:

> [[PGP Signed Part:Undecided]]
>> I was wondering if we could add new phase after unpack that copies 
>> contents from libsrtp package to `[build-dir]/third_party/libsrtp`.
>
> Simply replacing #$libsrtp-for-telegram-desktop with #$(package-source
> libsrtp) in the unpack-additional-sources phase seems to work (builds fine and
> telegram doesn't crash; I haven't tried calls).
>
> [[End of PGP Signed Part]]





Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Wed, 26 Jul 2023 18:57:02 GMT) Full text and rfc822 format available.

Message #44 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Distopico <distopico <at> riseup.net>
To: 64748 <at> debbugs.gnu.org
Cc: hako <at> ultrarare.space, Distopico <distopico <at> riseup.net>,
 rg <at> raghavgururajan.name
Subject: [PATCH v3] gnu: webrtc-for-telegram-desktop: Update to a45d8b8
Date: Wed, 26 Jul 2023 13:54:48 -0500
Fixes telegram-desktop call not working with openSSL 3 ,
Use sources from `libsrtp` instead of the submodule.

gnu: libsrtp: Update to 2.5.0.

see: https://github.com/telegramdesktop/tdesktop/issues/26108

* gnu/packages/telegram.scm (webrtc-for-telegram-desktop): Update to a45d8b8 revision commit
* gnu/packages/telephony.scm (libsrtp): Update to 2.5.0.
---
 use sources from existing `libsrtp` package,
 update it to the last version

 gnu/packages/telegram.scm  | 17 +++++++++++------
 gnu/packages/telephony.scm |  4 ++--
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/telegram.scm b/gnu/packages/telegram.scm
index aa01c2f692..0b32b49d14 100644
--- a/gnu/packages/telegram.scm
+++ b/gnu/packages/telegram.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2021 Raghav Gururajan <rg <at> raghavgururajan.name>
 ;;; Copyright © 2022 Hilton Chain <hako <at> ultrarare.space>
 ;;; Copyright © 2023 Saku Laesvuori <saku <at> laesvuori.fi>
+;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico <at> riseup.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -265,8 +266,8 @@ (define tgcalls-for-telegram-desktop
       "193m2gkvipijqbfd6a8mhg9nd63wlnshzgspk3pip57vk21l709z"))))
 
 (define-public webrtc-for-telegram-desktop
-  (let ((commit "5098730b9eb6173f0b52068fe2555b7c1015123a")
-        (revision "328"))
+  (let ((commit "a45d8b8f0a99bd0e5118dda1dc4a8b7b3ad5dcfd")
+        (revision "388"))
     (hidden-package
      (package
        (name "webrtc-for-telegram-desktop")
@@ -282,14 +283,14 @@ (define-public webrtc-for-telegram-desktop
           (file-name
            (git-file-name name version))
           (sha256
-           (base32 "1lk54zlrff59rj5k9dylsgz4sdds4728psrk8m3v9qn5y8d6z8qy"))
+           (base32 "1qs3ikkd6l56brj40cv6wlhx5gj5avisj9mj8ypjfwcyw9hb2n5y"))
           (modules '((guix build utils)
                      (ice-9 ftw)
                      (srfi srfi-1)))
           (snippet
            #~(begin
                (let ((keep
-                      '("libsrtp" "rnnoise"
+                      '("rnnoise" "libsrtp_config"
                         ;; Not available in Guix.
                         "pffft")))
                  (with-directory-excursion "src/third_party"
@@ -311,9 +312,13 @@ (define-public webrtc-for-telegram-desktop
              (add-after 'unpack 'unpack-additional-sources
                (lambda _
                  (let* ((third-party (string-append (getcwd) "/src/third_party"))
-                        (libyuv-to (string-append third-party "/libyuv")))
+                        (libyuv-to (string-append third-party "/libyuv"))
+                        (libsrtp-to (string-append third-party "/libsrtp")))
                    (copy-recursively #$libyuv-for-telegram-desktop
-                                     libyuv-to)))))))
+                                     libyuv-to)
+                   (copy-recursively #$(package-source
+				        libsrtp)
+                                     libsrtp-to)))))))
        (native-inputs (list pkg-config python-wrapper yasm))
        (inputs
         (list abseil-cpp-cxxstd17
diff --git a/gnu/packages/telephony.scm b/gnu/packages/telephony.scm
index aa65c4eaad..dc0adc7334 100644
--- a/gnu/packages/telephony.scm
+++ b/gnu/packages/telephony.scm
@@ -456,7 +456,7 @@ (define-public sipwitch
 (define-public libsrtp
   (package
     (name "libsrtp")
-    (version "2.4.2")
+    (version "2.5.0")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -465,7 +465,7 @@ (define-public libsrtp
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1gswpjm4jacfxmgglbf8hxi3yzsag4drk4q943p0wkmv21zj8l78"))))
+                "1ichw2v9s2mggi5p2wbbmlg55q4r48dxi3ks7ykfcfkmh7pb1w1s"))))
     (native-inputs
      (list psmisc ;some tests require 'killall'
            procps))
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Wed, 26 Jul 2023 19:14:02 GMT) Full text and rfc822 format available.

Message #47 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Saku Laesvuori <saku <at> laesvuori.fi>
To: Distopico <distopico <at> riseup.net>
Cc: hako <at> ultrarare.space, 64748 <at> debbugs.gnu.org, rg <at> raghavgururajan.name
Subject: Re: [bug#64748] [PATCH v3] gnu: webrtc-for-telegram-desktop: Update
 to a45d8b8
Date: Wed, 26 Jul 2023 22:13:07 +0300
[Message part 1 (text/plain, inline)]
> diff --git a/gnu/packages/telephony.scm b/gnu/packages/telephony.scm
> index aa65c4eaad..dc0adc7334 100644
> --- a/gnu/packages/telephony.scm
> +++ b/gnu/packages/telephony.scm
> @@ -456,7 +456,7 @@ (define-public sipwitch
>  (define-public libsrtp
>    (package
>      (name "libsrtp")
> -    (version "2.4.2")
> +    (version "2.5.0")

This should be split to a separate commit (one package per commit).

Also, according to `guix refresh --list-dependent libsrtp` libsrtp has
739 (>300) dependent packages and should thus not be updated on master to avoid
a drop in substitute availability. Have you checked if the calls work
with libsrtp 2.4.2 so that the telegram update could be applied to
master without updating libsrtp?
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Wed, 26 Jul 2023 19:23:01 GMT) Full text and rfc822 format available.

Message #50 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Distopico <distopico <at> riseup.net>
To: 64748 <at> debbugs.gnu.org
Cc: hako <at> ultrarare.space, Distopico <distopico <at> riseup.net>,
 rg <at> raghavgururajan.name
Subject: [PATCH v4] gnu: webrtc-for-telegram-desktop: Update to a45d8b8
Date: Wed, 26 Jul 2023 14:21:39 -0500
Fixes telegram-desktop call not working with openSSL 3 ,
Use sources from `libsrtp` instead of the submodule.

see: https://github.com/telegramdesktop/tdesktop/issues/26108

* gnu/packages/telegram.scm (webrtc-for-telegram-desktop): Update to a45d8b8 revision commit
---
 gnu/packages/telegram.scm | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/telegram.scm b/gnu/packages/telegram.scm
index aa01c2f692..0b32b49d14 100644
--- a/gnu/packages/telegram.scm
+++ b/gnu/packages/telegram.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2021 Raghav Gururajan <rg <at> raghavgururajan.name>
 ;;; Copyright © 2022 Hilton Chain <hako <at> ultrarare.space>
 ;;; Copyright © 2023 Saku Laesvuori <saku <at> laesvuori.fi>
+;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico <at> riseup.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -265,8 +266,8 @@ (define tgcalls-for-telegram-desktop
       "193m2gkvipijqbfd6a8mhg9nd63wlnshzgspk3pip57vk21l709z"))))
 
 (define-public webrtc-for-telegram-desktop
-  (let ((commit "5098730b9eb6173f0b52068fe2555b7c1015123a")
-        (revision "328"))
+  (let ((commit "a45d8b8f0a99bd0e5118dda1dc4a8b7b3ad5dcfd")
+        (revision "388"))
     (hidden-package
      (package
        (name "webrtc-for-telegram-desktop")
@@ -282,14 +283,14 @@ (define-public webrtc-for-telegram-desktop
           (file-name
            (git-file-name name version))
           (sha256
-           (base32 "1lk54zlrff59rj5k9dylsgz4sdds4728psrk8m3v9qn5y8d6z8qy"))
+           (base32 "1qs3ikkd6l56brj40cv6wlhx5gj5avisj9mj8ypjfwcyw9hb2n5y"))
           (modules '((guix build utils)
                      (ice-9 ftw)
                      (srfi srfi-1)))
           (snippet
            #~(begin
                (let ((keep
-                      '("libsrtp" "rnnoise"
+                      '("rnnoise" "libsrtp_config"
                         ;; Not available in Guix.
                         "pffft")))
                  (with-directory-excursion "src/third_party"
@@ -311,9 +312,13 @@ (define-public webrtc-for-telegram-desktop
              (add-after 'unpack 'unpack-additional-sources
                (lambda _
                  (let* ((third-party (string-append (getcwd) "/src/third_party"))
-                        (libyuv-to (string-append third-party "/libyuv")))
+                        (libyuv-to (string-append third-party "/libyuv"))
+                        (libsrtp-to (string-append third-party "/libsrtp")))
                    (copy-recursively #$libyuv-for-telegram-desktop
-                                     libyuv-to)))))))
+                                     libyuv-to)
+                   (copy-recursively #$(package-source
+				        libsrtp)
+                                     libsrtp-to)))))))
        (native-inputs (list pkg-config python-wrapper yasm))
        (inputs
         (list abseil-cpp-cxxstd17
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Wed, 26 Jul 2023 19:24:02 GMT) Full text and rfc822 format available.

Message #53 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Distopico <distopico <at> riseup.net>
To: Saku Laesvuori <saku <at> laesvuori.fi>
Cc: hako <at> ultrarare.space, 64748 <at> debbugs.gnu.org, rg <at> raghavgururajan.name
Subject: Re: [bug#64748] [PATCH v3] gnu: webrtc-for-telegram-desktop: Update
 to a45d8b8
Date: Wed, 26 Jul 2023 14:22:29 -0500
actually I tested first with 2.4.2 and it works fine from my side.

On 2023-07-26, Saku Laesvuori <saku <at> laesvuori.fi> wrote:

> [[PGP Signed Part:Undecided]]
>> diff --git a/gnu/packages/telephony.scm b/gnu/packages/telephony.scm
>> index aa65c4eaad..dc0adc7334 100644
>> --- a/gnu/packages/telephony.scm
>> +++ b/gnu/packages/telephony.scm
>> @@ -456,7 +456,7 @@ (define-public sipwitch
>>  (define-public libsrtp
>>    (package
>>      (name "libsrtp")
>> -    (version "2.4.2")
>> +    (version "2.5.0")
>
> This should be split to a separate commit (one package per commit).
>
> Also, according to `guix refresh --list-dependent libsrtp` libsrtp has
> 739 (>300) dependent packages and should thus not be updated on master to avoid
> a drop in substitute availability. Have you checked if the calls work
> with libsrtp 2.4.2 so that the telegram update could be applied to
> master without updating libsrtp?
>
> [[End of PGP Signed Part]]





Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Wed, 26 Jul 2023 20:10:02 GMT) Full text and rfc822 format available.

Message #56 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Saku Laesvuori <saku <at> laesvuori.fi>
To: Distopico <distopico <at> riseup.net>
Cc: hako <at> ultrarare.space, 64748 <at> debbugs.gnu.org, rg <at> raghavgururajan.name
Subject: Re: [bug#64748] [PATCH v4] gnu: webrtc-for-telegram-desktop: Update
 to a45d8b8
Date: Wed, 26 Jul 2023 23:09:16 +0300
[Message part 1 (text/plain, inline)]
> Fixes telegram-desktop call not working with openSSL 3 ,
> Use sources from `libsrtp` instead of the submodule.
> 
> see: https://github.com/telegramdesktop/tdesktop/issues/26108
> 
> * gnu/packages/telegram.scm (webrtc-for-telegram-desktop): Update to a45d8b8 revision commit
> ---

I wonder if this ChangeLog should mention something about adding libsrtp
sources to the unpack-additional-sources phase. Otherwise it looks good
to me and is just waiting for someone with more experience/commit
access.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Sat, 05 Aug 2023 03:01:02 GMT) Full text and rfc822 format available.

Message #59 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Distopico <distopico <at> riseup.net>
To: 64748 <at> debbugs.gnu.org
Cc: hako <at> ultrarare.space, Distopico <distopico <at> riseup.net>,
 rg <at> raghavgururajan.name
Subject: [PATCH] gnu: webrtc-for-telegram-desktop: Update to a45d8b8
Date: Fri,  4 Aug 2023 21:59:50 -0500
* gnu/packages/telegram.scm (webrtc-for-telegram-desktop): Update to a45d8b8 revision commit

Fixes `telegram-desktop` calls that are not working with OpenSSL 3.
Now, `webrtc-for-telegram-desktop` uses sources from the Guix `libsrtp`
package instead of the submodule in the `unpack-additional-sources` phase.

see: https://github.com/telegramdesktop/tdesktop/issues/26108

---
* gnu/packages/telegram.scm (webrtc-for-telegram-desktop): Update to a45d8b8 revision commit

Fixes `telegram-desktop` calls that are not working with OpenSSL 3.
Now, `webrtc-for-telegram-desktop` uses sources from the Guix `libsrtp`
package instead of the submodule in the `unpack-additional-sources` phase.

 gnu/packages/telegram.scm | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/telegram.scm b/gnu/packages/telegram.scm
index aa01c2f692..0b32b49d14 100644
--- a/gnu/packages/telegram.scm
+++ b/gnu/packages/telegram.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2021 Raghav Gururajan <rg <at> raghavgururajan.name>
 ;;; Copyright © 2022 Hilton Chain <hako <at> ultrarare.space>
 ;;; Copyright © 2023 Saku Laesvuori <saku <at> laesvuori.fi>
+;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico <at> riseup.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -265,8 +266,8 @@ (define tgcalls-for-telegram-desktop
       "193m2gkvipijqbfd6a8mhg9nd63wlnshzgspk3pip57vk21l709z"))))
 
 (define-public webrtc-for-telegram-desktop
-  (let ((commit "5098730b9eb6173f0b52068fe2555b7c1015123a")
-        (revision "328"))
+  (let ((commit "a45d8b8f0a99bd0e5118dda1dc4a8b7b3ad5dcfd")
+        (revision "388"))
     (hidden-package
      (package
        (name "webrtc-for-telegram-desktop")
@@ -282,14 +283,14 @@ (define-public webrtc-for-telegram-desktop
           (file-name
            (git-file-name name version))
           (sha256
-           (base32 "1lk54zlrff59rj5k9dylsgz4sdds4728psrk8m3v9qn5y8d6z8qy"))
+           (base32 "1qs3ikkd6l56brj40cv6wlhx5gj5avisj9mj8ypjfwcyw9hb2n5y"))
           (modules '((guix build utils)
                      (ice-9 ftw)
                      (srfi srfi-1)))
           (snippet
            #~(begin
                (let ((keep
-                      '("libsrtp" "rnnoise"
+                      '("rnnoise" "libsrtp_config"
                         ;; Not available in Guix.
                         "pffft")))
                  (with-directory-excursion "src/third_party"
@@ -311,9 +312,13 @@ (define-public webrtc-for-telegram-desktop
              (add-after 'unpack 'unpack-additional-sources
                (lambda _
                  (let* ((third-party (string-append (getcwd) "/src/third_party"))
-                        (libyuv-to (string-append third-party "/libyuv")))
+                        (libyuv-to (string-append third-party "/libyuv"))
+                        (libsrtp-to (string-append third-party "/libsrtp")))
                    (copy-recursively #$libyuv-for-telegram-desktop
-                                     libyuv-to)))))))
+                                     libyuv-to)
+                   (copy-recursively #$(package-source
+				        libsrtp)
+                                     libsrtp-to)))))))
        (native-inputs (list pkg-config python-wrapper yasm))
        (inputs
         (list abseil-cpp-cxxstd17

base-commit: cf9904bcc8dd03e73675475bb4d8746dc434e415
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Mon, 07 Aug 2023 09:54:02 GMT) Full text and rfc822 format available.

Message #62 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: Distopico <distopico <at> riseup.net>
Cc: Raghav Gururajan <rg <at> raghavgururajan.name>,
 Saku Laesvuori <saku <at> laesvuori.fi>, 64748 <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: webrtc-for-telegram-desktop: Update to a45d8b8
Date: Mon, 07 Aug 2023 17:38:57 +0800
Hi,

Sorry for the late reply (in this thread).

On Sat, 05 Aug 2023 10:59:50 +0800,
Distopico wrote:
>
> * gnu/packages/telegram.scm (webrtc-for-telegram-desktop): Update to a45d8b8 revision commit
>
> Fixes `telegram-desktop` calls that are not working with OpenSSL 3.
> Now, `webrtc-for-telegram-desktop` uses sources from the Guix `libsrtp`
> package instead of the submodule in the `unpack-additional-sources` phase.
>
> see: https://github.com/telegramdesktop/tdesktop/issues/26108
>
> ---
> * gnu/packages/telegram.scm (webrtc-for-telegram-desktop): Update to a45d8b8 revision commit
>
> Fixes `telegram-desktop` calls that are not working with OpenSSL 3.
> Now, `webrtc-for-telegram-desktop` uses sources from the Guix `libsrtp`
> package instead of the submodule in the `unpack-additional-sources` phase.

Have you checked <https://github.com/desktop-app/tg_owt/pull/123>
(Unbundle libSRTP) yet?

`git grep include.*libsrtp' shows that `srtp_priv.h' is used, and it's
not present in libsrtp <at> 2.4.2.  But since you have tested, I think it's
not an issue here.

For commit message, I think there's a 80-character limit and the long
sentences could be split into the [...] below as well.
--8<---------------cut here---------------start------------->8---
* gnu/packages/telegram.scm (...): ...
[snippet]: [...]
[#:phases]<unpack-additional-sources>: [...]
--8<---------------cut here---------------end--------------->8---

0-388.a45d8b8 can be used to describe the version if you prefer.

Patch LGTM, but if the aforementioned patch works, it's better to add
it.

Thanks




Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Mon, 07 Aug 2023 12:28:02 GMT) Full text and rfc822 format available.

Message #65 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: Distopico <distopico <at> riseup.net>
Cc: Raghav Gururajan <rg <at> raghavgururajan.name>,
 Saku Laesvuori <saku <at> laesvuori.fi>, 64748 <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: webrtc-for-telegram-desktop: Update to a45d8b8
Date: Mon, 07 Aug 2023 20:26:48 +0800
On Mon, 07 Aug 2023 17:38:57 +0800,
Hilton Chain wrote:
> `git grep include.*libsrtp' shows that `srtp_priv.h' is used, and it's
> not present in libsrtp <at> 2.4.2.  But since you have tested, I think it's
> not an issue here.

Found it in libsrtp source!  So the reply's unrelated here.




Information forwarded to distopico <at> riseup.net, saku <at> laesvuori.fi, rg <at> raghavgururajan.name, guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Mon, 28 Aug 2023 13:32:01 GMT) Full text and rfc822 format available.

Message #68 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: 64748 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH v6 0/2] gnu: webrtc-for-telegram-desktop: Update to
 0-389.0532942.
Date: Mon, 28 Aug 2023 21:30:50 +0800
Finished my own request for unbundling libSRTP and updated the package to the
latest commit.

Don't have a Telegram account, so I can't test the functionality.  Please let
me know if it works.

Thanks

Distopico (1):
  gnu: webrtc-for-telegram-desktop: Update to 0-389.0532942.

Hilton Chain (1):
  gnu: libyuv-for-telegram-desktop: Update to 0-2439.77c2121.

 gnu/local.mk                                  |   1 +
 ...or-telegram-desktop-unbundle-libsrtp.patch | 137 ++++++++++++++++++
 gnu/packages/telegram.scm                     |  22 ++-
 3 files changed, 152 insertions(+), 8 deletions(-)
 create mode 100644 gnu/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch


base-commit: 3b927302124de6eadaa8e0a7280002cd85c04d33
--
2.41.0




Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Mon, 28 Aug 2023 13:33:01 GMT) Full text and rfc822 format available.

Message #71 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: 64748 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH v6 1/2] gnu: libyuv-for-telegram-desktop: Update to
 0-2439.77c2121.
Date: Mon, 28 Aug 2023 21:31:28 +0800
* gnu/packages/telegram.scm (libyuv-for-telegram-desktop): Update to
0-2439.77c2121.
---
 gnu/packages/telegram.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/telegram.scm b/gnu/packages/telegram.scm
index dffc6b8ff4..88daea7d7d 100644
--- a/gnu/packages/telegram.scm
+++ b/gnu/packages/telegram.scm
@@ -83,8 +83,8 @@ (define-module (gnu packages telegram)
 (define %telegram-version "4.8.1")
 
 (define libyuv-for-telegram-desktop
-  (let ((commit "00950840d1c9bcbb3eb6ebc5aac5793e71166c8b")
-        (revision "2212"))
+  (let ((commit "77c2121f7e6b8e694d6e908bbbe9be24214097da")
+        (revision "2439"))
     (origin
       (method git-fetch)
       (uri (git-reference
@@ -95,7 +95,7 @@ (define libyuv-for-telegram-desktop
                   (git-version "0" revision commit)))
       (sha256
        (base32
-        "0mm56p8iapfild2xdw4w8zi35c3xm06fgagiali644gnxdmnym6c")))))
+        "1b4k8yskr9ffl5k8s9i0af1gn1pavsfixla26vh8bij69rdr7f9c")))))
 
 (define cmake-helpers-for-telegram-desktop
   (origin
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Mon, 28 Aug 2023 13:33:02 GMT) Full text and rfc822 format available.

Message #74 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: 64748 <at> debbugs.gnu.org
Cc: Distopico <distopico <at> riseup.net>
Subject: [PATCH v6 2/2] gnu: webrtc-for-telegram-desktop: Update to
 0-389.0532942.
Date: Mon, 28 Aug 2023 21:31:29 +0800
From: Distopico <distopico <at> 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.
Keep libsrtp_config.
[inputs]: Add libsrtp.
---
 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 8f409b7ea8..684f9f3ec4 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2094,6 +2094,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 <at> 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..a3d5dc273a 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 <at> raghavgururajan.name>
-;;; Copyright © 2022 Hilton Chain <hako <at> ultrarare.space>
+;;; Copyright © 2022, 2023 Hilton Chain <hako <at> ultrarare.space>
 ;;; Copyright © 2023 Saku Laesvuori <saku <at> laesvuori.fi>
 ;;; Copyright © 2023 Lu Hui <luhux76 <at> gmail.com>
+;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico <at> 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"
+                      '("libsrtp_config" "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
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Mon, 28 Aug 2023 14:58:02 GMT) Full text and rfc822 format available.

Message #77 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: 64748 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH v7 0/2] gnu: webrtc-for-telegram-desktop: Update to
 0-389.0532942.
Date: Mon, 28 Aug 2023 22:56:34 +0800
V6 -> V7: Don't keep the unnecessary libsrtp_config.

Distopico (1):
  gnu: webrtc-for-telegram-desktop: Update to 0-389.0532942.

Hilton Chain (1):
  gnu: libyuv-for-telegram-desktop: Update to 0-2439.77c2121.

 gnu/local.mk                                  |   1 +
 ...or-telegram-desktop-unbundle-libsrtp.patch | 137 ++++++++++++++++++
 gnu/packages/telegram.scm                     |  22 ++-
 3 files changed, 152 insertions(+), 8 deletions(-)
 create mode 100644 gnu/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch


base-commit: 4a49a89b09d07d96f4d6ef3c0ca93801370f7b20
--
2.41.0




Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Mon, 28 Aug 2023 15:01:02 GMT) Full text and rfc822 format available.

Message #80 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: 64748 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH v7 1/2] gnu: libyuv-for-telegram-desktop: Update to
 0-2439.77c2121.
Date: Mon, 28 Aug 2023 23:00:03 +0800
* gnu/packages/telegram.scm (libyuv-for-telegram-desktop): Update to
0-2439.77c2121.
---

(no change since v6)

 gnu/packages/telegram.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/telegram.scm b/gnu/packages/telegram.scm
index dffc6b8ff4..88daea7d7d 100644
--- a/gnu/packages/telegram.scm
+++ b/gnu/packages/telegram.scm
@@ -83,8 +83,8 @@ (define-module (gnu packages telegram)
 (define %telegram-version "4.8.1")
 
 (define libyuv-for-telegram-desktop
-  (let ((commit "00950840d1c9bcbb3eb6ebc5aac5793e71166c8b")
-        (revision "2212"))
+  (let ((commit "77c2121f7e6b8e694d6e908bbbe9be24214097da")
+        (revision "2439"))
     (origin
       (method git-fetch)
       (uri (git-reference
@@ -95,7 +95,7 @@ (define libyuv-for-telegram-desktop
                   (git-version "0" revision commit)))
       (sha256
        (base32
-        "0mm56p8iapfild2xdw4w8zi35c3xm06fgagiali644gnxdmnym6c")))))
+        "1b4k8yskr9ffl5k8s9i0af1gn1pavsfixla26vh8bij69rdr7f9c")))))
 
 (define cmake-helpers-for-telegram-desktop
   (origin
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Mon, 28 Aug 2023 15:01:02 GMT) Full text and rfc822 format available.

Message #83 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: 64748 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>, Distopico <distopico <at> riseup.net>
Subject: [PATCH v7 2/2] gnu: webrtc-for-telegram-desktop: Update to
 0-389.0532942.
Date: Mon, 28 Aug 2023 23:00:04 +0800
From: Distopico <distopico <at> 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 <at> 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 <at> 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 <at> raghavgururajan.name>
-;;; Copyright © 2022 Hilton Chain <hako <at> ultrarare.space>
+;;; Copyright © 2022, 2023 Hilton Chain <hako <at> ultrarare.space>
 ;;; Copyright © 2023 Saku Laesvuori <saku <at> laesvuori.fi>
 ;;; Copyright © 2023 Lu Hui <luhux76 <at> gmail.com>
+;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico <at> 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
--
2.41.0




Information forwarded to guix-patches <at> gnu.org:
bug#64748; Package guix-patches. (Tue, 29 Aug 2023 18:16:01 GMT) Full text and rfc822 format available.

Message #86 received at 64748 <at> debbugs.gnu.org (full text, mbox):

From: Distopico <distopico <at> riseup.net>
To: Hilton Chain <hako <at> ultrarare.space>
Cc: 64748 <at> debbugs.gnu.org
Subject: Re: [PATCH v7 2/2] gnu: webrtc-for-telegram-desktop: Update to
 0-389.0532942.
Date: Tue, 29 Aug 2023 13:13:52 -0500
[Message part 1 (text/plain, inline)]
Build and the call works fine from my side

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

> From: Distopico <distopico <at> 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 <at> 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 <at> 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 <at> raghavgururajan.name>
> -;;; Copyright © 2022 Hilton Chain <hako <at> ultrarare.space>
> +;;; Copyright © 2022, 2023 Hilton Chain <hako <at> ultrarare.space>
>  ;;; Copyright © 2023 Saku Laesvuori <saku <at> laesvuori.fi>
>  ;;; Copyright © 2023 Lu Hui <luhux76 <at> gmail.com>
> +;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico <at> 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

[signature.asc (application/pgp-signature, inline)]

Reply sent to Hilton Chain <hako <at> ultrarare.space>:
You have taken responsibility. (Fri, 01 Sep 2023 09:03:02 GMT) Full text and rfc822 format available.

Notification sent to Distopico <distopico <at> riseup.net>:
bug acknowledged by developer. (Fri, 01 Sep 2023 09:03:02 GMT) Full text and rfc822 format available.

Message #91 received at 64748-done <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: Distopico <distopico <at> riseup.net>
Cc: Hilton Chain <hako <at> ultrarare.space>, 64748-done <at> debbugs.gnu.org
Subject: Re: [PATCH v7 2/2] gnu: webrtc-for-telegram-desktop: Update to
 0-389.0532942.
Date: Fri, 01 Sep 2023 17:01:31 +0800
On Wed, 30 Aug 2023 02:13:52 +0800,
Distopico wrote:
> 
> [1  <text/plain; utf-8 (quoted-printable)>]
> Build and the call works fine from my side
> 

Thanks!  Pushed as 33018f8c2506a1ed0b805d595f3309b90153ac23.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 29 Sep 2023 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 224 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.