Skip to content

Commit

Permalink
Upgrade libsrt to v1.5.3. v5.0.183 (#3808)
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Sep 21, 2023
1 parent 389a62e commit 632d457
Show file tree
Hide file tree
Showing 154 changed files with 40,173 additions and 17,398 deletions.
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
874 changes: 672 additions & 202 deletions trunk/3rdparty/srt-1-fit/CMakeLists.txt

Large diffs are not rendered by default.

63 changes: 0 additions & 63 deletions trunk/3rdparty/srt-1-fit/common/win/ATTIC/winporting.h

This file was deleted.

4 changes: 2 additions & 2 deletions trunk/3rdparty/srt-1-fit/common/win/syslog_defs.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef INC__WINDOWS_SYSLOG_DEFS_H
#define INC__WINDOWS_SYSLOG_DEFS_H
#ifndef INC_SRT_WINDOWS_SYSLOG_DEFS_H
#define INC_SRT_WINDOWS_SYSLOG_DEFS_H

#define LOG_EMERG 0
#define LOG_ALERT 1
Expand Down
7 changes: 3 additions & 4 deletions trunk/3rdparty/srt-1-fit/common/win/wintime.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#ifndef INC__WIN_WINTIME
#define INC__WIN_WINTIME
#ifndef INC_SRT_WIN_WINTIME
#define INC_SRT_WIN_WINTIME

#include <winsock2.h>
#include <windows.h>
// HACK: This include is a workaround for a bug in the MinGW headers
// where pthread.h, which defines _POSIX_THREAD_SAFE_FUNCTIONS,
// has to be included before time.h so that time.h defines
// localtime_r correctly
#include <pthread.h>
#include <time.h>

#ifdef __cplusplus
Expand Down Expand Up @@ -53,4 +52,4 @@ SRTCOMPAT_WINTIME_STATIC_INLINE_DECL int gettimeofday(
}
#endif

#endif // INC__WIN_WINTIME
#endif // INC_SRT_WIN_WINTIME
38 changes: 5 additions & 33 deletions trunk/3rdparty/srt-1-fit/common/win_time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,39 +27,11 @@ void SRTCompat_timeradd(struct timeval *a, struct timeval *b, struct timeval *re
}
}

int SRTCompat_gettimeofday(struct timeval* tp, struct timezone* tz)
int SRTCompat_gettimeofday(struct timeval* tp, struct timezone*)
{
static LARGE_INTEGER tickFrequency, epochOffset;

// For our first call, use "ftime()", so that we get a time with a proper epoch.
// For subsequent calls, use "QueryPerformanceCount()", because it's more fine-grain.
static int isFirstCall = 1;

LARGE_INTEGER tickNow;
QueryPerformanceCounter(&tickNow);

if (isFirstCall)
{
struct timeb tb;
ftime(&tb);
tp->tv_sec = (long)tb.time;
tp->tv_usec = 1000*tb.millitm;

// Also get our counter frequency:
QueryPerformanceFrequency(&tickFrequency);

// And compute an offset to add to subsequent counter times, so we get a proper epoch:
epochOffset.QuadPart = tb.time*tickFrequency.QuadPart + (tb.millitm*tickFrequency.QuadPart)/1000 - tickNow.QuadPart;

isFirstCall = 0; // for next time
}
else
{
// Adjust our counter time so that we get a proper epoch:
tickNow.QuadPart += epochOffset.QuadPart;

tp->tv_sec = (long) (tickNow.QuadPart / tickFrequency.QuadPart);
tp->tv_usec = (long) (((tickNow.QuadPart % tickFrequency.QuadPart) * 1000000L) / tickFrequency.QuadPart);
}
struct timeb tb;
ftime(&tb);
tp->tv_sec = (long)tb.time;
tp->tv_usec = 1000*tb.millitm;
return 0;
}
25 changes: 22 additions & 3 deletions trunk/3rdparty/srt-1-fit/configure
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ foreach {o desc} $options {
}


if { $argv == "--help" } {
if { $argv == "--help" || $argv == "-h" } {
puts stderr "Usage: ./configure \[options\]"
puts stderr "OPTIONS:"
foreach o [lsort [array names opt]] {
Expand Down Expand Up @@ -153,8 +153,10 @@ foreach a $argv {

set type ""

if { [string first = $a] != -1 } {
lassign [split $a =] a val
if { [set a1 [string first = $a]] != -1 } {
# Do not split. Options may include =.
set val [string range $a $a1+1 end]
set a [string range $a 0 $a1-1]
}

if { [dict exists $::alias $a] } {
Expand Down Expand Up @@ -194,6 +196,23 @@ if { $saveopt != "" } {
error "Extra unhandled argument: $saveopt"
}

# Save the original call into config-status.sh

set ofd [open config-status.sh w]
puts $ofd "#!/bin/bash"
puts -nonewline $ofd "$argv0 "
foreach a $argv {
set len 1
if {[catch {llength $a} len] || $len > 1 } {
puts -nonewline $ofd "'$a' "
} else {
puts -nonewline $ofd "$a "
}
}
puts $ofd ""
close $ofd
file attributes config-status.sh -permissions +x

set cmakeopt ""

resolve_disablers
Expand Down
107 changes: 78 additions & 29 deletions trunk/3rdparty/srt-1-fit/configure-data.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -25,47 +25,56 @@

# Options processed here internally, not passed to cmake
set internal_options {
with-compiler-prefix=<prefix> "set C/C++ toolchains <prefix>gcc and <prefix>g++"
with-compiler-type=<name> "compiler type: gcc(default), cc, others simply add ++ for C++"
with-srt-name=<name> "Override srt library name"
with-haicrypt-name=<name> "Override haicrypt library name (if compiled separately)"
with-compiler-prefix=<prefix> "set C/C++ toolchains <prefix>gcc and <prefix>g++"
with-compiler-type=<name> "compiler type: gcc(default), cc, others simply add ++ for C++"
with-srt-name=<name> "Override srt library name"
with-haicrypt-name=<name> "Override haicrypt library name (if compiled separately)"
with-atomic=<spec> "Select implementation for atomics (compiler-intrinsics or sync-mutex)"
}

# Options that refer directly to variables used in CMakeLists.txt
set cmake_options {
cygwin-use-posix "Should the POSIX API be used for cygwin. Ignored if the system isn't cygwin. (default: OFF)"
enable-encryption "Should encryption features be enabled (default: ON)"
enable-c++11 "Should the c++11 parts (srt-live-transmit) be enabled (default: ON)"
enable-c++11 "Should the c++11 parts (srt-live-transmit) be enabled (default: ON, with gcc < 4.7 OFF)"
enable-apps "Should the Support Applications be Built? (default: ON)"
enable-bonding "Enable 'bonding' SRT feature (default: OFF)"
enable-testing "Should developer testing applications be built (default: OFF)"
enable-c++-deps "Extra library dependencies in srt.pc for C language (default: OFF)"
enable-heavy-logging "Should heavy debug logging be enabled (default: OFF)"
enable-profile "Should instrument the code for profiling. Ignored for non-GNU compiler. (default: OFF)"
enable-logging "Should logging be enabled (default: ON)"
enable-debug=<0,1,2> "Enable debug mode (0=disabled, 1=debug, 2=rel-with-debug)"
enable-heavy-logging "Should heavy debug logging be enabled (default: OFF)"
enable-haicrypt-logging "Should logging in haicrypt be enabled (default: OFF)"
enable-inet-pton "Set to OFF to prevent usage of inet_pton when building against modern SDKs (default: ON)"
enable-code-coverage "Enable code coverage reporting (default: OFF)"
enable-monotonic-clock "Enforced clock_gettime with monotonic clock on GC CV /temporary fix for #729/ (default: OFF)"
enable-profile "Should instrument the code for profiling. Ignored for non-GNU compiler. (default: OFF)"
enable-relative-libpath "Should applications contain relative library paths, like ../lib (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-suflip "Should suflip tool be built (default: OFF)"
enable-relative-libpath "Should applications contain relative library paths, like ../lib (default: OFF)"
enable-getnameinfo "In-logs sockaddr-to-string should do rev-dns (default: OFF)"
enable-unittests "Enable unit tests (default: OFF)"
enable-unittests "Enable Unit Tests (will download Google UT) (default: OFF)"
enable-encryption "Should encryption features be enabled (default: ON)"
enable-c++-deps "Extra library dependencies in srt.pc for C language (default: ON)"
use-static-libstdc++ "Should use static rather than shared libstdc++ (default: OFF)"
enable-inet-pton "Set to OFF to prevent usage of inet_pton when building against modern SDKs (default: ON)"
enable-code-coverage "Enable code coverage reporting (default: OFF)"
enable-monotonic-clock "Enforced clock_gettime with monotonic clock on GC CV /temporary fix for #729/ (default: OFF)"
enable-thread-check "Enable #include <threadcheck.h> that implements THREAD_* macros"
openssl-crypto-library=<filepath> "Path to a library."
openssl-include-dir=<path> "Path to a file."
openssl-ssl-library=<filepath> "Path to a library."
pkg-config-executable=<filepath> "pkg-config executable"
pthread-include-dir=<path> "Path to a file."
pthread-library=<filepath> "Path to a library."
enable-stdc++-sync "Use standard C++11 chrono/threads instead of pthread wrapper (default: OFF, on Windows: ON)"
use-openssl-pc "Use pkg-config to find OpenSSL libraries (default: ON)"
openssl-use-static-libs "Link OpenSSL statically (default: OFF)."
use-busy-waiting "Enable more accurate sending times at a cost of potentially higher CPU load (default: OFF)"
use-gnustl "Get c++ library/headers from the gnustl.pc"
enable-sock-cloexec "Enable setting SOCK_CLOEXEC on a socket (default: ON)"
enable-show-project-config "Enables use of ShowProjectConfig() in cmake (default: OFF)"
enable-new-rcvbuffer "Enables the new receiver buffer implementation (default: ON)"
enable-clang-tsa "Enable Clang's Thread-Safety-Analysis (default: OFF)"
atomic-use-srt-sync-mutex "Use mutex to implement atomics (alias: --with-atomic=sync-mutex) (default: OFF)"

use-enclib "Encryption library to be used: openssl(default), gnutls, mbedtls"
use-gnutls "DEPRECATED. Use USE_ENCLIB=openssl|gnutls|mbedtls instead"
use-openssl-pc "Use pkg-config to find OpenSSL libraries (default: ON)"
use-static-libstdc++ "Should use static rather than shared libstdc++ (default: OFF)"
enable-debug=<0,1,2> "Enable debug mode (0=disabled, 1=debug, 2=rel-with-debug)"
pkg-config-executable=<filepath> "pkg-config executable"
openssl-crypto-library=<filepath> "OpenSSL: Path to a libcrypto library."
openssl-include-dir=<path> "OpenSSL: Path to includes."
openssl-ssl-library=<filepath> "OpenSSL: Path to a libssl library."
pthread-include-dir=<path> "PThread: Path to includes"
pthread-library=<filepath> "PThread: Path to the pthread library."
}

set options $internal_options$cmake_options
Expand Down Expand Up @@ -162,6 +171,24 @@ proc preprocess {} {
set ::haicrypt_name $::optval(--with-haicrypt-name)
unset ::optval(--with-haicrypt-name)
}

if { "--with-atomic" in $::optkeys } {
switch -- $::optval(--with-atomic) {
compiler-intrinsics {
}

sync-mutex {
set ::optval(--atomic-use-srt-sync-mutex) 1
}

default {
puts "ERROR: --with-atomic option accepts two values: compiler-intrinsics (default) or sync-mutex"
exit 1
}
}

unset ::optval(--with-atomic)
}
}

proc GetCompilerCommand {} {
Expand All @@ -170,9 +197,16 @@ proc GetCompilerCommand {} {
# --cmake-c[++]-compiler
# (cmake-toolchain-file will set things up without the need to check things here)

set compiler gcc
if { [info exists ::optval(--with-compiler-type)] } {
set compiler $::optval(--with-compiler-type)
}

if { [info exists ::optval(--with-compiler-prefix)] } {
set prefix $::optval(--with-compiler-prefix)
return ${prefix}gcc
return ${prefix}$compiler
} else {
return $compiler
}

if { [info exists ::optval(--cmake-c-compiler)] } {
Expand Down Expand Up @@ -201,6 +235,7 @@ proc postprocess {} {
set toolchain_changed no
foreach changer {
--with-compiler-prefix
--with-compiler-type
--cmake-c-compiler
--cmake-c++-compiler
--cmake-cxx-compiler
Expand All @@ -223,6 +258,7 @@ proc postprocess {} {
# Check characteristics of the compiler - in particular, whether the target is different
# than the current target.
set compiler_path ""
set target_platform ""
set cmd [GetCompilerCommand]
if { $cmd != "" } {
set gcc_version [exec $cmd -v 2>@1]
Expand All @@ -237,14 +273,16 @@ proc postprocess {} {
}

if { $target_platform == "" } {
puts "NOTE: can't obtain target from gcc -v: $l"
puts "NOTE: can't obtain target from '[file tail $cmd] -v': $l - ASSUMING HOST compiler"
} else {
if { $target_platform != $::tcl_platform(machine) } {
puts "NOTE: foreign target type detected ($target)" ;# - setting CROSSCOMPILING flag"
#lappend ::cmakeopt "-DHAVE_CROSSCOMPILER=1"
set iscross 1
}
}
} else {
puts "CONFIGURE: default compiler used"
}
}

Expand Down Expand Up @@ -332,8 +370,19 @@ proc postprocess {} {
# Otherwise don't set PKG_CONFIG_PATH and we'll see.
}

if { $::HAVE_DARWIN && !$toolchain_changed} {

set use_brew 0
if { $::HAVE_DARWIN && !$toolchain_changed } {
set use_brew 1
}
if { $use_brew } {
foreach item $::cmakeopt {
if { [string first "Android" $item] != -1 } {
set use_brew 0
break
}
}
}
if { $use_brew } {
if { $have_gnutls } {
# Use gnutls explicitly, as found in brew
set er [catch {exec brew info gnutls} res]
Expand Down
Loading

0 comments on commit 632d457

Please sign in to comment.