Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade libsrt to v1.5.3. v5.0.183 v6.0.81 #3808

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions trunk/3rdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ nginx-1.5.7.zip
* for srs to support hls streaming.

srt-1-fit
srt-1.4.1.tar.gz
* https://github.com/Haivision/srt/releases/tag/v1.4.1
srt-1.5.3.tar.gz
* https://github.com/Haivision/srt/releases/tag/v1.5.3
* https://ossrs.net/lts/zh-cn/license#srt

openssl-1.1-fit
Expand Down
106 changes: 89 additions & 17 deletions trunk/3rdparty/srt-1-fit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#

cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
set (SRT_VERSION 1.5.1)
set (SRT_VERSION 1.5.3)

set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/scripts")
include(haiUtil) # needed for set_version_variables
Expand Down Expand Up @@ -117,6 +117,9 @@ if (ENABLE_DEBUG)
set(ENABLE_HEAVY_LOGGING_DEFAULT ON)
endif()

# Note that the IP_PKTINFO has a limited portability and may not work on some platforms
# (Windows, FreeBSD, ...).
set (ENABLE_PKTINFO_DEFAULT OFF)

set(ENABLE_STDCXX_SYNC_DEFAULT OFF)
set(ENABLE_MONOTONIC_CLOCK_DEFAULT OFF)
Expand Down Expand Up @@ -144,10 +147,13 @@ option(ENABLE_HEAVY_LOGGING "Should heavy debug logging be enabled" ${ENABLE_HEA
option(ENABLE_HAICRYPT_LOGGING "Should logging in haicrypt be enabled" 0)
option(ENABLE_SHARED "Should libsrt be built as a shared library" ON)
option(ENABLE_STATIC "Should libsrt be built as a static library" ON)
option(ENABLE_PKTINFO "Enable using IP_PKTINFO to allow the listener extracting the target IP address from incoming packets" ${ENABLE_PKTINFO_DEFAULT})
option(ENABLE_RELATIVE_LIBPATH "Should application contain relative library paths, like ../lib" OFF)
option(ENABLE_GETNAMEINFO "In-logs sockaddr-to-string should do rev-dns" OFF)
option(ENABLE_UNITTESTS "Enable unit tests" OFF)
option(ENABLE_ENCRYPTION "Enable encryption in SRT" ON)
option(ENABLE_AEAD_API_PREVIEW "Enable AEAD API preview in SRT" Off)
option(ENABLE_MAXREXMITBW "Enable SRTO_MAXREXMITBW (v1.6.0 API preview)" Off)
option(ENABLE_CXX_DEPS "Extra library dependencies in srt.pc for the CXX libraries useful with C language" ON)
option(USE_STATIC_LIBSTDCXX "Should use static rather than shared libstdc++" OFF)
option(ENABLE_INET_PTON "Set to OFF to prevent usage of inet_pton when building against modern SDKs while still requiring compatibility with older Windows versions, such as Windows XP, Windows Server 2003 etc." ON)
Expand All @@ -160,7 +166,6 @@ option(USE_BUSY_WAITING "Enable more accurate sending times at a cost of potenti
option(USE_GNUSTL "Get c++ library/headers from the gnustl.pc" OFF)
option(ENABLE_SOCK_CLOEXEC "Enable setting SOCK_CLOEXEC on a socket" ON)
option(ENABLE_SHOW_PROJECT_CONFIG "Enable show Project Configuration" OFF)
option(ENABLE_NEW_RCVBUFFER "Enable new receiver buffer implementation" ON)

option(ENABLE_CLANG_TSA "Enable Clang Thread Safety Analysis" OFF)

Expand Down Expand Up @@ -200,6 +205,16 @@ else()
message(STATUS "USE_BUSY_WAITING: OFF (default)")
endif()

# Reduce the frequency of some frequent logs, milliseconds
set(SRT_LOG_SLOWDOWN_FREQ_MS_DEFAULT 1000) # 1s
if (NOT DEFINED SRT_LOG_SLOWDOWN_FREQ_MS)
if (ENABLE_HEAVY_LOGGING)
set(SRT_LOG_SLOWDOWN_FREQ_MS 0) # Just show every log message.
else()
set(SRT_LOG_SLOWDOWN_FREQ_MS ${SRT_LOG_SLOWDOWN_FREQ_MS_DEFAULT})
endif()
endif()

if ( CYGWIN AND NOT CYGWIN_USE_POSIX )
set(WIN32 1)
set(CMAKE_LEGACY_CYGWIN_WIN32 1)
Expand Down Expand Up @@ -285,7 +300,13 @@ if(WIN32)
if(ENABLE_INET_PTON)
set(CMAKE_REQUIRED_LIBRARIES ws2_32)
check_function_exists(inet_pton HAVE_INET_PTON)
add_definitions(-D_WIN32_WINNT=0x0600)
try_compile(AT_LEAST_VISTA
${CMAKE_BINARY_DIR}
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/test_vista.c")
if(NOT AT_LEAST_VISTA)
# force targeting Vista
add_definitions(-D_WIN32_WINNT=0x0600)
endif()
else()
add_definitions(-D_WIN32_WINNT=0x0501)
endif()
Expand Down Expand Up @@ -422,8 +443,21 @@ if (ENABLE_ENCRYPTION)
add_definitions(-DSRT_ENABLE_ENCRYPTION)
message(STATUS "ENCRYPTION: ENABLED, using: ${SSL_REQUIRED_MODULES}")
message (STATUS "SSL libraries: ${SSL_LIBRARIES}")

if (ENABLE_AEAD_API_PREVIEW)
if ("${USE_ENCLIB}" STREQUAL "openssl-evp")
add_definitions(-DENABLE_AEAD_API_PREVIEW)
message(STATUS "ENCRYPTION AEAD API: ENABLED")
else()
message(FATAL_ERROR "ENABLE_AEAD_API_PREVIEW is only available with USE_ENCLIB=openssl-evp!")
endif()
else()
message(STATUS "ENCRYPTION AEAD API: DISABLED")
endif()

else()
message(STATUS "ENCRYPTION: DISABLED")
message(STATUS "ENCRYPTION AEAD API: N/A")
endif()

if (USE_GNUSTL)
Expand All @@ -433,8 +467,15 @@ if (USE_GNUSTL)
set (SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE} ${GNUSTL_LIBRARIES} ${GNUSTL_LDFLAGS})
endif()

if (ENABLE_MAXREXMITBW)
add_definitions(-DENABLE_MAXREXMITBW)
message(STATUS "MAXREXMITBW API: ENABLED")
else()
message(STATUS "MAXREXMITBW API: DISABLED")
endif()

if (USING_DEFAULT_COMPILER_PREFIX)
# Detect if the compiler is GNU compatable for flags
# Detect if the compiler is GNU compatible for flags
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Intel|Clang|AppleClang")
message(STATUS "COMPILER: ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) - GNU compat")
set(HAVE_COMPILER_GNU_COMPAT 1)
Expand Down Expand Up @@ -478,6 +519,15 @@ CheckGCCAtomicIntrinsics()
include(CheckCXXAtomic)
CheckCXXAtomic()

# Check for std::put_time():
# Sets:
# HAVE_CXX_STD_PUT_TIME
include(CheckCXXStdPutTime)
CheckCXXStdPutTime()
if (HAVE_CXX_STD_PUT_TIME)
add_definitions(-DHAVE_CXX_STD_PUT_TIME=1)
endif()

if (DISABLE_CXX11)
set (ENABLE_CXX11 0)
elseif( DEFINED ENABLE_CXX11 )
Expand Down Expand Up @@ -533,14 +583,6 @@ if (ENABLE_SOCK_CLOEXEC)
add_definitions(-DENABLE_SOCK_CLOEXEC=1)
endif()

if (ENABLE_NEW_RCVBUFFER)
add_definitions(-DENABLE_NEW_RCVBUFFER=1)
message(STATUS "RECEIVER_BUFFER: NEW")
else()
remove_definitions(-DENABLE_NEW_RCVBUFFER)
message(STATUS "RECEIVER_BUFFER: OLD")
endif()

if (CMAKE_MAJOR_VERSION LESS 3)
set (FORCE_CXX_STANDARD_GNUONLY 1)
endif()
Expand Down Expand Up @@ -614,6 +656,9 @@ endif()
# add extra warning flags for gccish compilers
if (HAVE_COMPILER_GNU_COMPAT)
set (SRT_GCC_WARN "-Wall -Wextra")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0 AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set (SRT_GCC_WARN "${SRT_GCC_WARN} -Wshadow=local")
endif()
else()
# cpp debugging on Windows :D
#set (SRT_GCC_WARN "/showIncludes")
Expand Down Expand Up @@ -720,6 +765,15 @@ if (ENABLE_GETNAMEINFO)
list(APPEND SRT_EXTRA_CFLAGS "-DENABLE_GETNAMEINFO=1")
endif()

if (ENABLE_PKTINFO)
if (WIN32 OR BSD)
message(FATAL_ERROR "PKTINFO is not implemented on Windows or *BSD.")
endif()

list(APPEND SRT_EXTRA_CFLAGS "-DSRT_ENABLE_PKTINFO=1")
endif()


# ENABLE_EXPERIMENTAL_BONDING is deprecated. Use ENABLE_BONDING. ENABLE_EXPERIMENTAL_BONDING is be removed in v1.6.0.
if (ENABLE_EXPERIMENTAL_BONDING)
message(DEPRECATION "ENABLE_EXPERIMENTAL_BONDING is deprecated. Please use ENABLE_BONDING instead.")
Expand Down Expand Up @@ -1040,6 +1094,8 @@ if (ENABLE_SHARED)
target_compile_definitions(srt_virtual PUBLIC -DSRT_DYNAMIC)
endif()

target_compile_definitions(srt_virtual PRIVATE -DSRT_LOG_SLOWDOWN_FREQ_MS=${SRT_LOG_SLOWDOWN_FREQ_MS})

if (srt_libspec_shared)
if (MICROSOFT)
target_link_libraries(${TARGET_srt}_shared PUBLIC Ws2_32.lib)
Expand All @@ -1064,6 +1120,11 @@ elseif (HAVE_LIBATOMIC AND HAVE_LIBATOMIC_COMPILES_STATIC)
if (srt_libspec_static)
target_link_libraries(${TARGET_srt}_static PUBLIC atomic)
endif()
elseif (LINUX AND HAVE_LIBATOMIC AND HAVE_LIBATOMIC_COMPILES)
# This is a workaround for some older Linux Toolchains.
if (srt_libspec_static)
target_link_libraries(${TARGET_srt}_static PUBLIC atomic)
endif()
endif()

# Cygwin installs the *.dll libraries in bin directory and uses PATH.
Expand Down Expand Up @@ -1122,7 +1183,7 @@ endif()
# obtained by `pkg-config --libs`.
if(ENABLE_CXX_DEPS)
foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES})
if(IS_ABSOLUTE ${LIB} AND EXISTS ${LIB})
if((IS_ABSOLUTE ${LIB} AND EXISTS ${LIB}) OR (${LIB} MATCHES "^-l"))
set(SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE} ${LIB})
else()
set(SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE} "-l${LIB}")
Expand Down Expand Up @@ -1334,6 +1395,10 @@ if (ENABLE_EXAMPLES)

srt_add_example(recvfile.cpp)

srt_add_example(sendmsg.cpp)

srt_add_example(recvmsg.cpp)

srt_add_example(test-c-client.c)

srt_add_example(example-client-nonblock.c)
Expand Down Expand Up @@ -1363,7 +1428,13 @@ if (ENABLE_UNITTESTS AND ENABLE_CXX11)

set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)

find_package(GTest 1.8)
# Version ranges are only supported with CMake 3.19 or later.
# Need GTest v1.10 or higher to support GTEST_SKIP.
if (${CMAKE_VERSION} VERSION_LESS "3.19.0")
find_package(GTest 1.10)
else()
find_package(GTest 1.10...1.12)
endif()
if (NOT GTEST_FOUND)
message(STATUS "GTEST not found! Fetching from git.")
include(googletest)
Expand Down Expand Up @@ -1395,12 +1466,13 @@ if (ENABLE_UNITTESTS AND ENABLE_CXX11)
NAME test-srt
COMMAND ${CMAKE_BINARY_DIR}/test-srt
)
#set_tests_properties(test-srt PROPERTIES RUN_SERIAL TRUE)
else()
gtest_add_tests(
test-srt
""
AUTO
TEST_LIST tests_srt
TARGET test-srt
)
set_tests_properties(${tests_srt} PROPERTIES RUN_SERIAL TRUE)
endif()

enable_testing()
Expand Down
1 change: 1 addition & 0 deletions trunk/3rdparty/srt-1-fit/configure-data.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ set cmake_options {
enable-logging "Should logging be enabled (default: ON)"
enable-heavy-logging "Should heavy debug logging be enabled (default: OFF)"
enable-haicrypt-logging "Should logging in haicrypt be enabled (default: OFF)"
enable-pktinfo "Should pktinfo reading and using be enabled (POSIX only) (default: OFF)"
enable-shared "Should libsrt be built as a shared library (default: ON)"
enable-static "Should libsrt be built as a static library (default: ON)"
enable-relative-libpath "Should applications contain relative library paths, like ../lib (default: OFF)"
Expand Down
15 changes: 7 additions & 8 deletions trunk/3rdparty/srt-1-fit/haicrypt/cryspr-mbedtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ written by
2022-05-19 (jdube)
CRYSPR2 adaptation
2019-06-27 (jdube)
GnuTLS/Nettle CRYSPR/4SRT (CRYypto Service PRovider for SRT)
MBedTLS CRYSPR/4SRT (CRYypto Service PRovider for SRT)
*****************************************************************************/

#include "hcrypt.h"
Expand All @@ -32,7 +32,7 @@ written by
static mbedtls_ctr_drbg_context crysprMbedtls_ctr_drbg;
static mbedtls_entropy_context crysprMbedtls_entropy;

typedef struct tag_crysprGnuTLS_AES_cb {
typedef struct tag_crysprMBedTLS_AES_cb {
CRYSPR_cb ccb; /* CRYSPR control block */
/* Add other cryptolib specific data here */
#ifdef CRYSPR2
Expand Down Expand Up @@ -75,9 +75,9 @@ int crysprMbedtls_AES_SetKey(
// kstr_len is in "bytes" convention (16, 24, 32).

if (bEncrypt) { /* Encrypt key */
ret = mbedtls_aes_setkey_enc(aes_key, kstr, kstr_len*8);
ret = mbedtls_aes_setkey_enc(aes_key, kstr, (unsigned int)kstr_len*8);
} else { /* Decrypt key */
ret = mbedtls_aes_setkey_dec(aes_key, kstr, kstr_len*8);
ret = mbedtls_aes_setkey_dec(aes_key, kstr, (unsigned int)kstr_len*8);
}

return ret == 0 ? 0 : -1;
Expand All @@ -91,8 +91,8 @@ int crysprMbedtls_AES_EcbCipher( /* AES Electronic Codebook cipher*/
unsigned char *out_txt, /* dst (cipher text) */
size_t *outlen) /* dst len */
{
int nblk = inlen/CRYSPR_AESBLKSZ;
int nmore = inlen%CRYSPR_AESBLKSZ;
int nblk = (int)(inlen/CRYSPR_AESBLKSZ);
int nmore = (int)(inlen%CRYSPR_AESBLKSZ);
int i;

if (bEncrypt) {
Expand Down Expand Up @@ -160,7 +160,6 @@ int crysprMbedtls_AES_CtrCipher( /* AES-CTR128 Encryption */
static CRYSPR_cb *crysprMbedtls_Open(CRYSPR_methods *cryspr, size_t max_len)
{
crysprMbedtls_cb *aes_data;
CRYSPR_cb *cryspr_cb;

aes_data = (crysprMbedtls_cb *)crysprHelper_Open(cryspr, sizeof(crysprMbedtls_cb), max_len);
if (NULL == aes_data) {
Expand Down Expand Up @@ -216,7 +215,7 @@ int crysprMbedtls_KmPbkdf2(

ret = mbedtls_pkcs5_pbkdf2_hmac(&mdctx,
(unsigned char*)passwd, passwd_len, salt, salt_len,
itr, key_len, out);
itr, (uint32_t)key_len, out);

mbedtls_md_free(&mdctx);

Expand Down
8 changes: 4 additions & 4 deletions trunk/3rdparty/srt-1-fit/haicrypt/cryspr-mbedtls.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ written by
Haivision Systems Inc.
2019-06-27 (jdube)
GnuTLS/Nettle CRYSPR/4SRT (CRYypto Service PRovider for SRT)
MBedTLS CRYSPR/4SRT (CRYypto Service PRovider for SRT)
*****************************************************************************/

#ifndef CRYSPR_GNUTLS_H
#define CRYSPR_GNUTLS_H
#ifndef CRYSPR_MBEDTLS_H
#define CRYSPR_MBEDTLS_H

#include <mbedtls/ctr_drbg.h>
#include <mbedtls/aes.h>
Expand Down Expand Up @@ -59,5 +59,5 @@ typedef mbedtls_aes_context CRYSPR_AESCTX; /* CRYpto Service PRovider AES key

struct tag_CRYSPR_methods *crysprMbedtls(void);

#endif /* CRYSPR_GNUTLS_H */
#endif /* CRYSPR_MBEDTLS_H */

Loading