[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1035573: unblock: telegram-desktop/4.6.5+ds-2, libtgowt/0~git20230105.5098730+dfsg-2



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock
Control: block 1032927 by -1
Control: block 1035518 by -1

Please unblock package telegram-desktop as well as libtgowt, an ancillary VoIP
library for Telegram.

[ Reason ]
The updates fix an important issue with group calls and live streams. See
detailed description in Bug#1032927, Bug#1035518, and in an upstream bug
report.

[ Impact ]
The features do not work without updating libSRTP from the libsrtp2-1 package.

[ Tests ]
A manual test. See the test case in Bug#1035518.

[ Risks ]
Almost none. Telegram Desktop is leaf package, libtgowt has only one 
dependant.

[ Checklist ]
  [x] all changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the packages in testing

[ Other info ]
The libtgowt package carries a static library and needs to be build before
telegram-desktop, or the update will not have effect.

unblock telegram-desktop/4.6.5+ds-2
unblock libtgowt/0~git20230105.5098730+dfsg-2
diffstat for telegram-desktop-4.6.5+ds telegram-desktop-4.6.5+ds

 changelog                                                |    9 
 patches/Always-use-std-to_string-to-serialize-ints.patch |  232 +++++++++++++++
 patches/series                                           |    1 
 3 files changed, 242 insertions(+)

diff -Nru telegram-desktop-4.6.5+ds/debian/changelog telegram-desktop-4.6.5+ds/debian/changelog
--- telegram-desktop-4.6.5+ds/debian/changelog	2023-02-27 17:58:07.000000000 +0300
+++ telegram-desktop-4.6.5+ds/debian/changelog	2023-05-05 12:01:43.000000000 +0300
@@ -1,3 +1,12 @@
+telegram-desktop (4.6.5+ds-2) unstable; urgency=medium
+
+  * Rebuild against libtgowt-dev (>= 0~git20230105.5098730+dfsg-2). This
+    closes: #1032953, #1035518.
+  * New Always-use-std-to_string-to-serialize-ints.patch fixes an assert
+    violation in video chats (also known as group calls).
+
+ -- Nicholas Guriev <guriev-ns@ya.ru>  Fri, 05 May 2023 12:01:43 +0300
+
 telegram-desktop (4.6.5+ds-1) unstable; urgency=medium
 
   * New upstream release.
diff -Nru telegram-desktop-4.6.5+ds/debian/patches/Always-use-std-to_string-to-serialize-ints.patch telegram-desktop-4.6.5+ds/debian/patches/Always-use-std-to_string-to-serialize-ints.patch
--- telegram-desktop-4.6.5+ds/debian/patches/Always-use-std-to_string-to-serialize-ints.patch	1970-01-01 03:00:00.000000000 +0300
+++ telegram-desktop-4.6.5+ds/debian/patches/Always-use-std-to_string-to-serialize-ints.patch	2023-05-04 12:44:16.000000000 +0300
@@ -0,0 +1,232 @@
+Description: Always use std::to_string to serialize ints
+Origin: https://github.com/TelegramMessenger/tgcalls/commit/fecf542a74b0eb2c15ec7820d16653c57f4db27e
+        https://github.com/TelegramMessenger/tgcalls/commit/012f7a75ba7e20e1790203d02aedf573e3551d2f
+Author: John Preston <johnprestonmail@gmail.com>
+Acked-By: Nicholas Guriev <guriev-ns@ya.ru>
+Last-Update: Thu, 04 May 2023 12:44:16 +0300
+
+--- a/Telegram/ThirdParty/tgcalls/tgcalls/group/GroupInstanceCustomImpl.cpp
++++ b/Telegram/ThirdParty/tgcalls/tgcalls/group/GroupInstanceCustomImpl.cpp
+@@ -102,15 +102,11 @@ static int stringToInt(std::string const &string) {
+ }
+ 
+ static std::string intToString(int value) {
+-    std::ostringstream stringStream;
+-    stringStream << value;
+-    return stringStream.str();
++    return std::to_string(value);
+ }
+ 
+ static std::string uint32ToString(uint32_t value) {
+-    std::ostringstream stringStream;
+-    stringStream << value;
+-    return stringStream.str();
++    return std::to_string(value);
+ }
+ 
+ static uint32_t stringToUInt32(std::string const &string) {
+@@ -129,6 +125,7 @@ static uint16_t stringToUInt16(std::string const &string) {
+ 
+ static std::string formatTimestampMillis(int64_t timestamp) {
+     std::ostringstream stringStream;
++    stringStream.imbue(std::locale::classic());
+     stringStream << std::fixed << std::setprecision(3) << (double)timestamp / 1000.0;
+     return stringStream.str();
+ }
+--- a/Telegram/ThirdParty/tgcalls/tgcalls/v2/ContentNegotiation.cpp
++++ b/Telegram/ThirdParty/tgcalls/tgcalls/v2/ContentNegotiation.cpp
+@@ -187,11 +187,7 @@ cricket::ContentInfo createInactiveContentInfo(std::string const &contentId) {
+ }
+ 
+ std::string contentIdBySsrc(uint32_t ssrc) {
+-    std::ostringstream contentIdString;
+-    
+-    contentIdString << ssrc;
+-    
+-    return contentIdString.str();
++    return std::to_string(ssrc);
+ }
+ 
+ }
+@@ -639,11 +635,10 @@ void ContentNegotiationContext::setAnswer(std::unique_ptr<ContentNegotiationCont
+ }
+ 
+ std::string ContentNegotiationContext::takeNextOutgoingChannelId() {
+-    std::ostringstream result;
+-    result << "m" << _nextOutgoingChannelId;
++    const auto result = "m" + std::to_string(_nextOutgoingChannelId);
+     _nextOutgoingChannelId++;
+-    
+-    return result.str();
++
++    return result;
+ }
+ 
+ std::unique_ptr<ContentNegotiationContext::CoordinatedState> ContentNegotiationContext::coordinatedState() const {
+--- a/Telegram/ThirdParty/tgcalls/tgcalls/v2/InstanceV2Impl.cpp
++++ b/Telegram/ThirdParty/tgcalls/tgcalls/v2/InstanceV2Impl.cpp
+@@ -136,13 +136,12 @@ public:
+             audioOptions.noise_suppression = true;
+         }
+ 
+-        std::ostringstream contentId;
+-        contentId << _ssrc;
++        const auto contentId = std::to_string(_ssrc);
+ 
+         std::vector<std::string> streamIds;
+-        streamIds.push_back(contentId.str());
++        streamIds.push_back(contentId);
+ 
+-        _outgoingAudioChannel = _channelManager->CreateVoiceChannel(call, cricket::MediaConfig(), contentId.str(), false, NativeNetworkingImpl::getDefaulCryptoOptions(), audioOptions);
++        _outgoingAudioChannel = _channelManager->CreateVoiceChannel(call, cricket::MediaConfig(), contentId, false, NativeNetworkingImpl::getDefaulCryptoOptions(), audioOptions);
+         _threads->getNetworkThread()->BlockingCall([&]() {
+             _outgoingAudioChannel->SetRtpTransport(rtpTransport);
+         });
+@@ -272,12 +271,9 @@ public:
+         audioOptions.audio_jitter_buffer_fast_accelerate = true;
+         audioOptions.audio_jitter_buffer_min_delay_ms = 50;
+ 
+-        std::ostringstream contentId;
+-        contentId << _ssrc;
++        const auto streamId = std::to_string(_ssrc);
+ 
+-        std::string streamId = contentId.str();
+-
+-        _audioChannel = _channelManager->CreateVoiceChannel(call, cricket::MediaConfig(), contentId.str(), false, NativeNetworkingImpl::getDefaulCryptoOptions(), audioOptions);
++        _audioChannel = _channelManager->CreateVoiceChannel(call, cricket::MediaConfig(), streamId, false, NativeNetworkingImpl::getDefaulCryptoOptions(), audioOptions);
+         _threads->getNetworkThread()->BlockingCall([&]() {
+             _audioChannel->SetRtpTransport(rtpTransport);
+         });
+@@ -401,10 +397,7 @@ public:
+         cricket::VideoOptions videoOptions;
+         videoOptions.is_screencast = isScreencast;
+ 
+-        std::ostringstream contentId;
+-        contentId << mediaContent.ssrc;
+-
+-        _outgoingVideoChannel = _channelManager->CreateVideoChannel(call, cricket::MediaConfig(), contentId.str(), false, NativeNetworkingImpl::getDefaulCryptoOptions(), videoOptions, videoBitrateAllocatorFactory);
++        _outgoingVideoChannel = _channelManager->CreateVideoChannel(call, cricket::MediaConfig(), std::to_string(mediaContent.ssrc), false, NativeNetworkingImpl::getDefaulCryptoOptions(), videoOptions, videoBitrateAllocatorFactory);
+         _threads->getNetworkThread()->BlockingCall([&]() {
+             _outgoingVideoChannel->SetRtpTransport(rtpTransport);
+         });
+@@ -702,10 +695,9 @@ public:
+ 
+         _videoBitrateAllocatorFactory = webrtc::CreateBuiltinVideoBitrateAllocatorFactory();
+ 
+-        std::ostringstream contentId;
+-        contentId << mediaContent.ssrc;
++        const auto contentId = std::to_string(mediaContent.ssrc);
+ 
+-        _videoChannel = _channelManager->CreateVideoChannel(call, cricket::MediaConfig(), contentId.str(), false, NativeNetworkingImpl::getDefaulCryptoOptions(), cricket::VideoOptions(), _videoBitrateAllocatorFactory.get());
++        _videoChannel = _channelManager->CreateVideoChannel(call, cricket::MediaConfig(), contentId, false, NativeNetworkingImpl::getDefaulCryptoOptions(), cricket::VideoOptions(), _videoBitrateAllocatorFactory.get());
+         _threads->getNetworkThread()->BlockingCall([&]() {
+             _videoChannel->SetRtpTransport(rtpTransport);
+         });
+@@ -750,7 +742,7 @@ public:
+         videoRecvStreamParams.ssrcs = allSsrcs;
+ 
+         videoRecvStreamParams.cname = "cname";
+-        videoRecvStreamParams.set_stream_ids({ contentId.str() });
++        videoRecvStreamParams.set_stream_ids({ contentId });
+ 
+         auto incomingVideoDescription = std::make_unique<cricket::VideoContentDescription>();
+         for (const auto &rtpExtension : mediaContent.rtpExtensions) {
+@@ -1978,14 +1970,10 @@ public:
+         for (const auto &record : _networkStateLogRecords) {
+             json11::Json::object jsonRecord;
+ 
+-            std::ostringstream timestampString;
+-
+             if (baseTimestamp == 0) {
+                 baseTimestamp = record.timestamp;
+             }
+-            timestampString << (record.timestamp - baseTimestamp);
+-
+-            jsonRecord.insert(std::make_pair("t", json11::Json(timestampString.str())));
++            jsonRecord.insert(std::make_pair("t", json11::Json(std::to_string(record.timestamp - baseTimestamp))));
+             jsonRecord.insert(std::make_pair("c", json11::Json(record.record.isConnected ? 1 : 0)));
+             if (record.record.route) {
+                 jsonRecord.insert(std::make_pair("local", json11::Json(record.record.route->localDescription)));
+--- a/Telegram/ThirdParty/tgcalls/tgcalls/v2/InstanceV2ReferenceImpl.cpp
++++ b/Telegram/ThirdParty/tgcalls/tgcalls/v2/InstanceV2ReferenceImpl.cpp
+@@ -653,10 +653,8 @@ public:
+             if (server.isTurn) {
+                 webrtc::PeerConnectionInterface::IceServer mappedServer;
+ 
+-                std::ostringstream uri;
+-                uri << "turn:" << address.HostAsURIString() << ":" << server.port;
+-
+-                mappedServer.urls.push_back(uri.str());
++                mappedServer.urls.push_back(
++                    "turn:" + address.HostAsURIString() + ":" + std::to_string(server.port));
+                 mappedServer.username = server.login;
+                 mappedServer.password = server.password;
+ 
+@@ -664,10 +662,8 @@ public:
+             } else {
+                 webrtc::PeerConnectionInterface::IceServer mappedServer;
+ 
+-                std::ostringstream uri;
+-                uri << "stun:" << address.HostAsURIString() << ":" << server.port;
+-
+-                mappedServer.urls.push_back(uri.str());
++                mappedServer.urls.push_back(
++                    "stun:" + address.HostAsURIString() + ":" + std::to_string(server.port));
+ 
+                 peerConnectionConfiguration.servers.push_back(mappedServer);
+             }
+@@ -1455,14 +1451,10 @@ public:
+         for (const auto &record : _networkStateLogRecords) {
+             json11::Json::object jsonRecord;
+ 
+-            std::ostringstream timestampString;
+-
+             if (baseTimestamp == 0) {
+                 baseTimestamp = record.timestamp;
+             }
+-            timestampString << (record.timestamp - baseTimestamp);
+-
+-            jsonRecord.insert(std::make_pair("t", json11::Json(timestampString.str())));
++            jsonRecord.insert(std::make_pair("t", json11::Json(std::to_string(record.timestamp - baseTimestamp))));
+             jsonRecord.insert(std::make_pair("c", json11::Json(record.record.isConnected ? 1 : 0)));
+             if (record.record.route) {
+                 jsonRecord.insert(std::make_pair("local", json11::Json(record.record.route->localDescription)));
+--- a/Telegram/ThirdParty/tgcalls/tgcalls/v2/Signaling.cpp
++++ b/Telegram/ThirdParty/tgcalls/tgcalls/v2/Signaling.cpp
+@@ -11,9 +11,7 @@ namespace tgcalls {
+ namespace signaling {
+ 
+ static std::string uint32ToString(uint32_t value) {
+-    std::ostringstream stringStream;
+-    stringStream << value;
+-    return stringStream.str();
++    return std::to_string(value);
+ }
+ 
+ static uint32_t stringToUInt32(std::string const &string) {
+--- a/Telegram/ThirdParty/tgcalls/tgcalls/v2_4_0_0/InstanceV2_4_0_0Impl.cpp
++++ b/Telegram/ThirdParty/tgcalls/tgcalls/v2_4_0_0/InstanceV2_4_0_0Impl.cpp
+@@ -57,9 +57,7 @@ namespace tgcalls {
+ namespace {
+ 
+ static std::string intToString(int value) {
+-    std::ostringstream stringStream;
+-    stringStream << value;
+-    return stringStream.str();
++    return std::to_string(value);
+ }
+ 
+ static VideoCaptureInterfaceObject *GetVideoCaptureAssumingSameThread(VideoCaptureInterface *videoCapture) {
+--- a/Telegram/ThirdParty/tgcalls/tgcalls/v2_4_0_0/Signaling_4_0_0.cpp
++++ b/Telegram/ThirdParty/tgcalls/tgcalls/v2_4_0_0/Signaling_4_0_0.cpp
+@@ -10,9 +10,7 @@ namespace tgcalls {
+ namespace signaling_4_0_0 {
+ 
+ static std::string uint32ToString(uint32_t value) {
+-    std::ostringstream stringStream;
+-    stringStream << value;
+-    return stringStream.str();
++    return std::to_string(value);
+ }
+ 
+ static uint32_t stringToUInt32(std::string const &string) {
diff -Nru telegram-desktop-4.6.5+ds/debian/patches/series telegram-desktop-4.6.5+ds/debian/patches/series
--- telegram-desktop-4.6.5+ds/debian/patches/series	2023-02-27 10:59:16.000000000 +0300
+++ telegram-desktop-4.6.5+ds/debian/patches/series	2023-05-04 12:44:16.000000000 +0300
@@ -13,3 +13,4 @@
 Backport-GLib.patch
 Backport-KCoreAddons.patch
 Backport-Wayland-protocols.patch
+Always-use-std-to_string-to-serialize-ints.patch
diffstat for libtgowt-0~git20230105.5098730+dfsg libtgowt-0~git20230105.5098730+dfsg

 changelog                          |    9 ++
 control                            |    1 
 patches/Ignore-sanitize-attr.patch |   44 +++++++++++++
 patches/Unbundle-libSRTP.patch     |  124 +++++++++++++++++++++++++++++++++++++
 patches/series                     |    2 
 5 files changed, 180 insertions(+)

diff -Nru libtgowt-0~git20230105.5098730+dfsg/debian/changelog libtgowt-0~git20230105.5098730+dfsg/debian/changelog
--- libtgowt-0~git20230105.5098730+dfsg/debian/changelog	2023-01-10 23:20:23.000000000 +0300
+++ libtgowt-0~git20230105.5098730+dfsg/debian/changelog	2023-05-05 11:54:32.000000000 +0300
@@ -1,3 +1,12 @@
+libtgowt (0~git20230105.5098730+dfsg-2) unstable; urgency=medium
+
+  * New Unbundle-libSRTP.patch.
+    - Link against the updated library from the libsrtp2-dev package which
+      already has a fix of OpenSSL 3.0.0 incompatibility.
+  * Bring back Ignore-sanitize-attr.patch to fix build for RISC-V 64bit.
+
+ -- Nicholas Guriev <guriev-ns@ya.ru>  Fri, 05 May 2023 11:54:32 +0300
+
 libtgowt (0~git20230105.5098730+dfsg-1) unstable; urgency=medium
 
   * Update to the latest upstream commit.
diff -Nru libtgowt-0~git20230105.5098730+dfsg/debian/control libtgowt-0~git20230105.5098730+dfsg/debian/control
--- libtgowt-0~git20230105.5098730+dfsg/debian/control	2023-01-10 22:45:35.000000000 +0300
+++ libtgowt-0~git20230105.5098730+dfsg/debian/control	2023-05-04 16:21:09.000000000 +0300
@@ -20,6 +20,7 @@
  libpipewire-0.3-dev,
  libprotobuf-dev,
  libpulse-dev,
+ libsrtp2-dev,
  libssl-dev,
  libswresample-dev,
  libswscale-dev,
diff -Nru libtgowt-0~git20230105.5098730+dfsg/debian/patches/Ignore-sanitize-attr.patch libtgowt-0~git20230105.5098730+dfsg/debian/patches/Ignore-sanitize-attr.patch
--- libtgowt-0~git20230105.5098730+dfsg/debian/patches/Ignore-sanitize-attr.patch	1970-01-01 03:00:00.000000000 +0300
+++ libtgowt-0~git20230105.5098730+dfsg/debian/patches/Ignore-sanitize-attr.patch	2023-05-04 20:11:56.000000000 +0300
@@ -0,0 +1,44 @@
+Description: Do not put the no_sanitize attribute near generated declarations.
+ -fsanitize=cfi-icall is supported only by Clang for x86 and x86_64. That is not
+ our case. Exclude compiler_specific.h that requires hard-coded build_config.h.
+ .
+ This way we avoid the header blocking the build on RISC-V 64bit and other
+ platforms.
+Author: Nicholas Guriev <guriev-ns@ya.ru>
+Last-Update: Thu, 04 May 2023 20:11:56 +0300
+
+--- a/src/tools/generate_stubs/generate_stubs.py
++++ b/src/tools/generate_stubs/generate_stubs.py
+@@ -92,7 +92,6 @@
+ #   arg_list: The arguments used to call the stub function.
+ STUB_FUNCTION_DEFINITION = (
+     """extern %(return_type)s %(name)s(%(params)s) __attribute__((weak));
+-DISABLE_CFI_ICALL
+ %(return_type)s %(export)s %(name)s(%(params)s) {
+   %(return_prefix)s%(name)s_ptr(%(arg_list)s);
+ }""")
+@@ -111,7 +110,6 @@
+ #                   argument.
+ VARIADIC_STUB_FUNCTION_DEFINITION = (
+     """extern %(return_type)s %(name)s(%(params)s) __attribute__((weak));
+-DISABLE_CFI_ICALL
+ %(return_type)s %(export)s %(name)s(%(params)s) {
+   va_list args___;
+   va_start(args___, %(last_named_arg)s);
+@@ -133,7 +131,6 @@
+ #                   argument.
+ VOID_VARIADIC_STUB_FUNCTION_DEFINITION = (
+     """extern void %(name)s(%(params)s) __attribute__((weak));
+-DISABLE_CFI_ICALL
+ void %(export)s %(name)s(%(params)s) {
+   va_list args___;
+   va_start(args___, %(last_named_arg)s);
+@@ -182,8 +179,6 @@
+ 
+ #include <map>
+ #include <vector>
+-
+-#include "base/compiler_specific.h"
+ """
+ 
+ # The start and end templates for the enum definitions used by the Umbrella
diff -Nru libtgowt-0~git20230105.5098730+dfsg/debian/patches/series libtgowt-0~git20230105.5098730+dfsg/debian/patches/series
--- libtgowt-0~git20230105.5098730+dfsg/debian/patches/series	2023-01-10 22:51:02.000000000 +0300
+++ libtgowt-0~git20230105.5098730+dfsg/debian/patches/series	2023-05-04 20:11:56.000000000 +0300
@@ -1,6 +1,8 @@
 Better-denormal-check.patch
 Convert-endianness.patch
 Fix-libabsl-include.patch
+Ignore-sanitize-attr.patch
 Packaged-PipeWire.patch
 Skip-RNNoise.patch
+Unbundle-libSRTP.patch
 Backport-to-stable-libvpx.patch
diff -Nru libtgowt-0~git20230105.5098730+dfsg/debian/patches/Unbundle-libSRTP.patch libtgowt-0~git20230105.5098730+dfsg/debian/patches/Unbundle-libSRTP.patch
--- libtgowt-0~git20230105.5098730+dfsg/debian/patches/Unbundle-libSRTP.patch	1970-01-01 03:00:00.000000000 +0300
+++ libtgowt-0~git20230105.5098730+dfsg/debian/patches/Unbundle-libSRTP.patch	2023-05-04 16:21:09.000000000 +0300
@@ -0,0 +1,124 @@
+Description: Avoid private symbols and link against system-wide libSRTP
+ The package no longer uses outdated bundled copy of the library. The change
+ fixes incompatibility with OpenSSL 3.0.0 or later.
+ .
+ The excluded code in SrtpSession looks unreachable from the call integration
+ in Telegram Desktop. Though, I can't 100% confirm this.
+Author: Nicholas Guriev <guriev-ns@ya.ru>
+Forwarded: https://github.com/desktop-app/tg_owt/pull/123
+Last-Update: Thu, 04 May 2023 16:21:09 +0300
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -2658,6 +2658,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)
+     include(cmake/libabsl.cmake)
+     list(APPEND export_targets libabsl)
+--- 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)
+--- 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] = {
+--- 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
+--- 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,7 @@ bool SrtpSession::UnprotectRtcp(void* p,
+ bool SrtpSession::GetRtpAuthParams(uint8_t** key, int* key_len, int* tag_len) {
+   RTC_DCHECK(thread_checker_.IsCurrent());
+   RTC_DCHECK(IsExternalAuthActive());
++#ifndef HAVE_LIBSRTP
+   if (!IsExternalAuthActive()) {
+     return false;
+   }
+@@ -313,6 +318,10 @@ bool SrtpSession::GetRtpAuthParams(uint8
+   *key_len = external_hmac->key_length;
+   *tag_len = rtp_auth_tag_len_;
+   return true;
++#else
++  RTC_LOG_F(LS_WARNING) << "unavailable";
++  return false;
++#endif
+ }
+ 
+ int SrtpSession::GetSrtpOverhead() const {
+@@ -336,6 +345,7 @@ bool SrtpSession::GetSendStreamPacketInd
+                                            int in_len,
+                                            int64_t* index) {
+   RTC_DCHECK(thread_checker_.IsCurrent());
++#ifndef HAVE_LIBSRTP
+   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 +356,10 @@ bool SrtpSession::GetSendStreamPacketInd
+   *index = static_cast<int64_t>(rtc::NetworkToHost64(
+       srtp_rdbx_get_packet_index(&stream->rtp_rdbx) << 16));
+   return true;
++#else
++  RTC_LOG_F(LS_WARNING) << "unavailable";
++  return false;
++#endif
+ }
+ 
+ bool SrtpSession::DoSetKey(int type,

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: