Skip to content

Commit b686646

Browse files
committed
deps.ffmpeg: Revert libsrt to v1.5.2 with patches
Libsrt v1.5.3 does not link against mbedTLS 3.5+. Libsrt v1.5.4 fixes this, but it has a critical regression that causes OBS Studio Media Sources using SRT to fail. The patch to fix this is too large for us to want to backport to v1.5.4, so revert to v1.5.2 and backport the patches to build with mbedTLS 3.5+.
1 parent 5918611 commit b686646

8 files changed

+97
-36
lines changed

deps.ffmpeg/60-srt.ps1

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
param(
22
[string] $Name = 'srt',
3-
[string] $Version = '1.5.4',
4-
[string] $Uri = 'https://github.com/Haivision/srt/archive/refs/tags/v1.5.4.zip',
5-
[string] $Hash = "${PSScriptRoot}/checksums/v1.5.4.zip.sha256",
3+
[string] $Version = '1.5.2',
4+
[string] $Uri = 'https://github.com/Haivision/srt/archive/refs/tags/v1.5.2.zip',
5+
[string] $Hash = "${PSScriptRoot}/checksums/v1.5.2.zip.sha256",
66
[array] $Targets = @('x64', 'arm64'),
77
[switch] $ForceShared = $true,
88
[array] $Patches = @(
99
@{
1010
PatchFile = "${PSScriptRoot}/patches/srt/0002-update-mbedtls-discovery-windows.patch"
1111
HashSum = "c6b236a15e36767cc516c626c410be42b9ff05bd42338c194e1cf6247e4cbdc5"
12+
},
13+
@{
14+
PatchFile = "${PSScriptRoot}/patches/srt/0003-fix-mbedtls-v3.5.0-plus-build-error-on-windows.patch"
15+
HashSum = "7253ecfc1a36b1ff88dcb995ab8779107a5c7f979fd1f74390354a91fdf9f00b"
16+
},
17+
@{
18+
PatchFile = "${PSScriptRoot}/patches/srt/0004-fix-link-bcrypt-on-windows-when-mbedtls-v3.5.0-plus.patch"
19+
HashSum = "04a3c5be7402995328da91c2313aa0489c3d9501410361e406db8fff679d4054"
1220
}
1321
)
1422
)

deps.ffmpeg/60-srt.zsh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ autoload -Uz log_debug log_error log_info log_status log_output
22

33
## Dependency Information
44
local name='srt'
5-
local version='1.5.4'
6-
local url='https://github.com/Haivision/srt/archive/v1.5.4.tar.gz'
7-
local hash="${0:a:h}/checksums/v1.5.4.tar.gz.sha256"
5+
local version='1.5.2'
6+
local url='https://github.com/Haivision/srt/archive/v1.5.2.tar.gz'
7+
local hash="${0:a:h}/checksums/v1.5.2.tar.gz.sha256"
88
local -a patches=(
99
"* ${0:a:h}/patches/srt/0001-enable-proper-cmake-build-types.patch \
10-
8d1dc116ebf605d423d33cc6a4a1660e5b3ea81eb147622f55fed2043c41f0d7"
10+
d762ed8c4ce36f98329a5b7e1fcc10d67b38f23d100e1ed66da5d64c970e8a56"
1111
)
1212

1313
## Dependency Overrides
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
463970a3f575446b3f55abb6f323d5476c963c77b3c975cd902e9c87cdd9a92c v1.5.2.tar.gz

deps.ffmpeg/checksums/v1.5.4.zip.sha256 renamed to deps.ffmpeg/checksums/v1.5.2.zip.sha256

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<ToString>Microsoft.PowerShell.Commands.FileHashInfo</ToString>
88
<Props>
99
<S N="Algorithm">SHA256</S>
10-
<S N="Hash">6B6B3A1CB985657993B2B7D140CE22AF3F8694E76A734A6C5DEE41D028C1DD18</S>
11-
<S N="Path">v1.5.4.zip</S>
10+
<S N="Hash">2686F75533BD53EC917DAB6129186B124B4D105EADAA6A84E83719AC3B5AE6BD</S>
11+
<S N="Path">v1.5.2.zip</S>
1212
</Props>
1313
</Obj>
1414
</Objs>

deps.ffmpeg/checksums/v1.5.4.tar.gz.sha256

Lines changed: 0 additions & 1 deletion
This file was deleted.

deps.ffmpeg/patches/srt/0001-enable-proper-cmake-build-types.patch

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ Instead of setting internal debug status based on CMake standard build types,
22
libsrt uses inverse logic. This patches honors the official CMake types and
33
sets internal debug status accordingly.
44

5-
--- ./CMakeLists.txt 2024-11-16 21:09:22
6-
+++ ./CMakeLists.txt 2024-11-16 21:09:30
7-
@@ -52,14 +52,8 @@
8-
5+
--- ./CMakeLists.txt 2022-09-21 16:29:01.000000000 +0200
6+
+++ ./CMakeLists.txt 2022-11-03 12:40:20.973886158 +0100
7+
@@ -47,14 +47,8 @@
8+
99
include(GNUInstallDirs)
10-
10+
1111
-# The CMAKE_BUILD_TYPE seems not to be always set, weird.
1212
-if (NOT DEFINED ENABLE_DEBUG)
1313
-
@@ -16,40 +16,40 @@ sets internal debug status accordingly.
1616
- else()
1717
- set (ENABLE_DEBUG OFF)
1818
- endif()
19-
+if (NOT CMAKE_BUILD_TYPE)
20-
+ set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build type [Release, RelWithDebInfo, Debug, MinSizeRel]" FORCE)
19+
+if(NOT CMAKE_BUILD_TYPE)
20+
+ set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build type [Release, RelWithDebInfo, Debug, MinSizeRel]" FORCE)
2121
endif()
22-
22+
2323
# XXX This is a kind of workaround - this part to set the build
24-
@@ -70,24 +64,19 @@
24+
@@ -64,21 +58,16 @@
25+
# sets _DEBUG and NDEBUG flags itself, so this shouldn't be done
2526
# at all in this case.
2627
if (NOT MICROSOFT)
27-
28+
-
2829
- # Set CMAKE_BUILD_TYPE properly, now that you know
2930
- # that ENABLE_DEBUG is set as it should.
3031
- if (ENABLE_DEBUG EQUAL 2)
3132
- set (CMAKE_BUILD_TYPE "RelWithDebInfo")
32-
- if (ENABLE_ASSERT)
33-
- # Add _DEBUG macro if explicitly requested, to enable SRT_ASSERT().
34-
+ if(CMAKE_BUILD_TYPE STREQUAL Debug)
35-
+ if(ENABLE_ASSERT)
36-
add_definitions(-D_DEBUG)
37-
else()
38-
add_definitions(-DNDEBUG)
39-
endif()
33+
- add_definitions(-DNDEBUG)
4034
- elseif (ENABLE_DEBUG) # 1, ON, YES, TRUE, Y, or any other non-zero number
4135
- set (CMAKE_BUILD_TYPE "Debug")
4236
-
4337
- # Add _DEBUG macro in debug mode only, to enable SRT_ASSERT().
4438
- add_definitions(-D_DEBUG)
4539
- else()
4640
- set (CMAKE_BUILD_TYPE "Release")
47-
+ set(ENABLE_DEBUG 2)
48-
+ elseif(CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
49-
+ add_definitions(-DNDEBUG)
50-
+ set(ENABLE_DEBUG ON)
51-
+ else()
52-
add_definitions(-DNDEBUG)
53-
+ set(ENABLE_DEBUG OFF)
54-
endif()
41+
- add_definitions(-DNDEBUG)
42+
- endif()
43+
+ if(CMAKE_BUILD_TYPE STREQUAL Debug)
44+
+ add_definitions(-D_DEBUG)
45+
+ set(ENABLE_DEBUG 2)
46+
+ elseif(CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
47+
+ add_definitions(-DNDEBUG)
48+
+ set(ENABLE_DEBUG ON)
49+
+ else()
50+
+ add_definitions(-DNDEBUG)
51+
+ set(ENABLE_DEBUG OFF)
52+
+ endif()
5553
endif()
54+
55+
message(STATUS "BUILD TYPE: ${CMAKE_BUILD_TYPE}")
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
From 7899f1520b12218bcce4538bbe40e8e08663141b Mon Sep 17 00:00:00 2001
2+
From: Jay Zhang <wangyoucao577@gmail.com>
3+
Date: Mon, 8 Jan 2024 17:21:55 +0800
4+
Subject: [PATCH] [build] Fix mbedtls >=v3.5.0 build error on windows (#2842).
5+
6+
---
7+
CMakeLists.txt | 3 +++
8+
1 file changed, 3 insertions(+)
9+
10+
diff --git a/CMakeLists.txt b/CMakeLists.txt
11+
index 4611f0ca2..b62c3176c 100644
12+
--- a/CMakeLists.txt
13+
+++ b/CMakeLists.txt
14+
@@ -358,6 +358,9 @@ if (ENABLE_ENCRYPTION)
15+
endif()
16+
if ("${SSL_LIBRARIES}" STREQUAL "")
17+
set (SSL_LIBRARIES mbedtls mbedcrypto)
18+
+ if (WIN32)
19+
+ set (SSL_LIBRARIES ${SSL_LIBRARIES} bcrypt)
20+
+ endif()
21+
endif()
22+
message(STATUS "SSL enforced mbedtls: -I ${SSL_INCLUDE_DIRS} -l;${SSL_LIBRARIES}")
23+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
From 618ddfed45a53d99e4a0ce8528b2ecfe2860b5bc Mon Sep 17 00:00:00 2001
2+
From: Tommy Wu <7903172+tommyvct@users.noreply.github.com>
3+
Date: Thu, 7 Mar 2024 03:45:03 -0600
4+
Subject: [PATCH] [build] Fix: link bcrypt on Windows when mbedtls >=v3.5.0
5+
(#2860).
6+
7+
Only link to bcrypt if mbedtls is not found by find_package(mbedtls).
8+
---
9+
CMakeLists.txt | 6 +++---
10+
1 file changed, 3 insertions(+), 3 deletions(-)
11+
12+
diff --git a/CMakeLists.txt b/CMakeLists.txt
13+
index 8951dc46c..c5994d3b7 100644
14+
--- a/CMakeLists.txt
15+
+++ b/CMakeLists.txt
16+
@@ -365,11 +365,11 @@ if (ENABLE_ENCRYPTION)
17+
set (SSL_INCLUDE_DIRS ${MBEDTLS_INCLUDE_DIR})
18+
set (SSL_LIBRARIES ${MBEDTLS_LIBRARIES})
19+
endif()
20+
+ if (WIN32)
21+
+ set (SSL_LIBRARIES ${SSL_LIBRARIES} bcrypt)
22+
+ endif()
23+
if ("${SSL_LIBRARIES}" STREQUAL "")
24+
set (SSL_LIBRARIES mbedtls mbedcrypto)
25+
- if (WIN32)
26+
- set (SSL_LIBRARIES ${SSL_LIBRARIES} bcrypt)
27+
- endif()
28+
endif()
29+
message(STATUS "SSL enforced mbedtls: -I ${SSL_INCLUDE_DIRS} -l;${SSL_LIBRARIES}")
30+

0 commit comments

Comments
 (0)