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

Sync to fork #1

Merged
merged 37 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2fcd3d4
[core] Fix crypto mode auto for listener sender (#2711).
maxsharabayko Apr 17, 2023
9fc5c09
[build] Upgraded CI: ubuntu to version 20.04 (#2682).
ethouris Apr 18, 2023
4c9a417
[docs] Added the link for registration in slack to the getting starte…
mbakholdina Apr 18, 2023
59cde53
[core] Fixed FEC Emergency resize crash (#2717).
ethouris Apr 19, 2023
6fcff6d
[core] Fixed various compiler warnings on various platforms (#2679).
oviano Apr 21, 2023
30e7ccd
[core] Minor fix of variable shadowing.
maxsharabayko Apr 24, 2023
be254e7
[tests] Minor fix of variable shadowing.
maxsharabayko Apr 24, 2023
66c86b1
[build] Add -Wshadow=local to CMake build flags.
maxsharabayko Apr 25, 2023
3cefede
[core] Correct remaining endianness issues
matoro Apr 29, 2023
9448e26
[docs] Minor updates to AEAD docs plus changed v1.6.0 to 1.5.2 in som…
mbakholdina Jun 2, 2023
421f4e1
[build] Fix downversioning of _WIN32_WINNT (#2754).
robUx4 Jun 29, 2023
10e71a6
[core] Fixed unhandled error in haicrypt (#2685).
ethouris Jun 29, 2023
61c7bed
[core] Use overlapped WSASendTo to avoid loss in UDP sending (#2632).
maxsharabayko Jun 29, 2023
1737e96
[core] Add volatile keyword to asm block in rdtsc (#2759).
aaron-jencks Jul 13, 2023
9f4e9b6
[core] Fixed srctime from closing socket was mistakenly cleared
gou4shi1 Jun 1, 2023
c639310
[core] Fixed group read-ready epoll events.
maxsharabayko Aug 4, 2023
31294e3
[core] Removed unused CUDTGroup::m_Positions.
maxsharabayko Jul 18, 2023
88ca9cc
[core] Perf improvement of group reading.
maxsharabayko Jul 19, 2023
69c2376
[core] Fixed RCV buffer initialization in Rendezvous.
maxsharabayko Aug 4, 2023
d063313
[docs] Updating the explicit information for binding to IPv6 wildcard…
ethouris Aug 7, 2023
9f41437
[tests] Added custom main with transparent parameters for tests (#2681).
ethouris Aug 8, 2023
256244f
[core] Fix memory leak when can't buffer a HS packet (#2757).
xiaozhihong Aug 8, 2023
c6572bf
[core] Refactor CRcvQueue::storePkt(..) for better resource managemen…
maxsharabayko Aug 8, 2023
744035b
[core] Fix hang up on not enough space in the RCV buffer (#2745).
yomnes0 Aug 8, 2023
7cfe12b
[core] fix tsbpd() may deadlock with processCtrlShutdown()
gou4shi1 May 17, 2023
46b0579
[core] Slightly optimize the RCV drop by message number (#2686).
gou4shi1 Aug 9, 2023
d039fe6
[core] Rejection not undertaken in rendezvous after KMX failure (#2692).
ethouris Aug 10, 2023
50619bd
[core] Fix: In rendezvous when processing resulted in ACCEPT it was s…
Aug 7, 2023
54ef85f
[core] Minor code clean up in CRateEstimator.
maxsharabayko Aug 14, 2023
f9e36db
[core] Initialize ISN and PeerISN in CUDT.
maxsharabayko Aug 14, 2023
033dc9f
[core] Drop unencrypted packets in GCM mode.
maxsharabayko Aug 15, 2023
e9eb8b3
[apps] Fix the build for target without IP_ADD_SOURCE_MEMBERSHIP (#27…
jlsantiago0 Aug 16, 2023
78a1020
[core] Added maximum BW limit for retransmissions (#2714).
maxsharabayko Aug 16, 2023
4682646
[API] SRT version raised to 1.5.3.
maxsharabayko Aug 16, 2023
33a620b
[apps] Fixed conditional IP_ADD_SOURCE_MEMBERSHIP in testmedia (#2780).
ethouris Aug 16, 2023
b1d8b04
[core] Fixed SRT_ATTR_REQUIRES use.
maxsharabayko Aug 21, 2023
51e3d0d
[build] Added missing public header files in Windows binary installer…
lelegard Aug 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
build:
name: NDK-R23
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- name: Setup Android NDK R23
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cxx11-ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
build:
name: ubuntu
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ matrix:
- BUILD_TYPE=Release
- BUILD_OPTS='-DENABLE_MONOTONIC_CLOCK=ON'
script:
- TESTS_IPv6="TestMuxer.IPv4_and_IPv6:TestIPv6.v6_calls_v6*:ReuseAddr.ProtocolVersion:ReuseAddr.*6" ; # Tests to skip due to lack of IPv6 support
- if [ "$TRAVIS_COMPILER" == "x86_64-w64-mingw32-g++" ]; then
export CC="x86_64-w64-mingw32-gcc";
export CXX="x86_64-w64-mingw32-g++";
Expand All @@ -95,7 +94,7 @@ script:
fi
- if [ "$TRAVIS_COMPILER" != "x86_64-w64-mingw32-g++" ]; then
ulimit -c unlimited;
./test-srt --gtest_filter="-$TESTS_IPv6";
./test-srt -disable-ipv6;
SUCCESS=$?;
if [ -f core ]; then gdb -batch ./test-srt -c core -ex bt -ex "info thread" -ex quit; else echo "NO CORE - NO CRY!"; fi;
test $SUCCESS == 0;
Expand Down
21 changes: 19 additions & 2 deletions 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.2)
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 @@ -153,6 +153,7 @@ 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 Down Expand Up @@ -299,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 @@ -460,6 +467,13 @@ 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 compatible for flags
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Intel|Clang|AppleClang")
Expand Down Expand Up @@ -642,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
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ In live streaming configurations, the SRT protocol maintains a constant end-to-e

## Getting Started with SRT

| | | |
|:-----------------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------:|
| [The SRT API](./docs#srt-api-documents) | [IETF Internet Draft](https://datatracker.ietf.org/doc/html/draft-sharabayko-srt-01) | [Sample Apps](./docs#sample-applications) |
| Reference documentation for the SRT library API | The SRT Protocol Internet Draft | Instructions for using test apps (`srt-live-transmit`, `srt-file-transmit`, etc.) |
| [SRT Technical Overview](https://github.com/Haivision/srt/files/2489142/SRT_Protocol_TechnicalOverview_DRAFT_2018-10-17.pdf) | [SRT Deployment Guide](https://www.srtalliance.org/srt-deployment-guide/) | [SRT CookBook](https://srtlab.github.io/srt-cookbook) |
| Early draft technical overview (precursor to the Internet Draft) | A comprehensive overview of the protocol with deployment guidelines | Development notes on the SRT protocol |
| [Innovation Labs Blog](https://medium.com/innovation-labs-blog/tagged/secure-reliable-transport) | [SRTLab YouTube Channel](https://www.youtube.com/channel/UCr35JJ32jKKWIYymR1PTdpA) | [Slack](https://srtalliance.slack.com) |
| The blog on Medium with SRT-related technical articles | Technical YouTube channel with useful videos | Slack channels to get the latest updates and ask questions |
| | | |
|:-----------------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------:|
| [The SRT API](./docs#srt-api-documents) | [IETF Internet Draft](https://datatracker.ietf.org/doc/html/draft-sharabayko-srt-01) | [Sample Apps](./docs#sample-applications) |
| Reference documentation for the SRT library API | The SRT Protocol Internet Draft | Instructions for using test apps (`srt-live-transmit`, `srt-file-transmit`, etc.) |
| [SRT Technical Overview](https://github.com/Haivision/srt/files/2489142/SRT_Protocol_TechnicalOverview_DRAFT_2018-10-17.pdf) | [SRT Deployment Guide](https://www.srtalliance.org/srt-deployment-guide/) | [SRT CookBook](https://srtlab.github.io/srt-cookbook) |
| Early draft technical overview (precursor to the Internet Draft) | A comprehensive overview of the protocol with deployment guidelines | Development notes on the SRT protocol |
| [Innovation Labs Blog](https://medium.com/innovation-labs-blog/tagged/secure-reliable-transport) | [SRTLab YouTube Channel](https://www.youtube.com/channel/UCr35JJ32jKKWIYymR1PTdpA) | [Slack](https://srtalliance.slack.com) |
| The blog on Medium with SRT-related technical articles | Technical YouTube channel with useful videos | Slack channels to get the latest updates and ask questions <br />[Join SRT Alliance on Slack](https://slackin-srtalliance.azurewebsites.net/) |

### Additional Documentation

Expand Down
7 changes: 5 additions & 2 deletions apps/apputil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ int inet_pton(int af, const char * src, void * dst)
ZeroMemory(&ss, sizeof(ss));

// work around non-const API
strncpy(srcCopy, src, INET6_ADDRSTRLEN + 1);
#ifdef _MSC_VER
strncpy_s(srcCopy, INET6_ADDRSTRLEN + 1, src, _TRUNCATE);
#else
strncpy(srcCopy, src, INET6_ADDRSTRLEN);
srcCopy[INET6_ADDRSTRLEN] = '\0';

#endif
if (WSAStringToAddress(
srcCopy, af, NULL, (struct sockaddr *)&ss, &ssSize) != 0)
{
Expand Down
3 changes: 3 additions & 0 deletions apps/socketoptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ const SocketOption srt_options [] {
#ifdef ENABLE_AEAD_API_PREVIEW
,{ "cryptomode", 0, SRTO_CRYPTOMODE, SocketOption::PRE, SocketOption::INT, nullptr }
#endif
#ifdef ENABLE_MAXREXMITBW
,{ "maxrexmitbw", 0, SRTO_MAXREXMITBW, SocketOption::POST, SocketOption::INT64, nullptr }
#endif
};
}

Expand Down
10 changes: 8 additions & 2 deletions apps/srt-live-transmit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,8 +852,14 @@ int main(int argc, char** argv)
void TestLogHandler(void* opaque, int level, const char* file, int line, const char* area, const char* message)
{
char prefix[100] = "";
if ( opaque )
strncpy(prefix, (char*)opaque, 99);
if ( opaque ) {
#ifdef _MSC_VER
strncpy_s(prefix, sizeof(prefix), (char*)opaque, _TRUNCATE);
#else
strncpy(prefix, (char*)opaque, sizeof(prefix) - 1);
prefix[sizeof(prefix) - 1] = '\0';
#endif
}
time_t now;
time(&now);
char buf[1024];
Expand Down
18 changes: 9 additions & 9 deletions apps/srt-tunnel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class Tunnel

Tunnel(Tunnelbox* m, std::unique_ptr<Medium>&& acp, std::unique_ptr<Medium>&& clr):
parent_box(m),
med_acp(move(acp)), med_clr(move(clr)),
med_acp(std::move(acp)), med_clr(std::move(clr)),
acp_to_clr(this, med_acp.get(), med_clr.get(), med_acp->id() + ">" + med_clr->id()),
clr_to_acp(this, med_clr.get(), med_acp.get(), med_clr->id() + ">" + med_acp->id())
{
Expand Down Expand Up @@ -649,7 +649,7 @@ void TcpMedium::CreateListener()

sockaddr_any sa = CreateAddr(m_uri.host(), m_uri.portno());

m_socket = socket(sa.get()->sa_family, SOCK_STREAM, IPPROTO_TCP);
m_socket = (int)socket(sa.get()->sa_family, SOCK_STREAM, IPPROTO_TCP);
ConfigurePre();

int stat = ::bind(m_socket, sa.get(), sa.size());
Expand Down Expand Up @@ -694,7 +694,7 @@ unique_ptr<Medium> SrtMedium::Accept()
unique_ptr<Medium> TcpMedium::Accept()
{
sockaddr_any sa;
int s = ::accept(m_socket, (sa.get()), (&sa.syslen()));
int s = (int)::accept(m_socket, (sa.get()), (&sa.syslen()));
if (s == -1)
{
Error(errno, "accept");
Expand Down Expand Up @@ -726,7 +726,7 @@ void SrtMedium::CreateCaller()

void TcpMedium::CreateCaller()
{
m_socket = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
m_socket = (int)::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
ConfigurePre();
}

Expand Down Expand Up @@ -850,7 +850,7 @@ Medium::ReadStatus Medium::Read(bytevector& w_output)
size_t pred_size = shift + m_chunk;

w_output.resize(pred_size);
int st = ReadInternal((w_output.data() + shift), m_chunk);
int st = ReadInternal((w_output.data() + shift), (int)m_chunk);
if (st == -1)
{
if (IsErrorAgain())
Expand Down Expand Up @@ -884,7 +884,7 @@ Medium::ReadStatus Medium::Read(bytevector& w_output)

void SrtMedium::Write(bytevector& w_buffer)
{
int st = srt_send(m_socket, w_buffer.data(), w_buffer.size());
int st = srt_send(m_socket, w_buffer.data(), (int)w_buffer.size());
if (st == SRT_ERROR)
{
Error(UDT::getlasterror(), "srt_send");
Expand All @@ -907,7 +907,7 @@ void SrtMedium::Write(bytevector& w_buffer)

void TcpMedium::Write(bytevector& w_buffer)
{
int st = ::send(m_socket, w_buffer.data(), w_buffer.size(), DEF_SEND_FLAG);
int st = ::send(m_socket, w_buffer.data(), (int)w_buffer.size(), DEF_SEND_FLAG);
if (st == -1)
{
Error(errno, "send");
Expand Down Expand Up @@ -971,7 +971,7 @@ struct Tunnelbox
lock_guard<std::mutex> lk(access);
Verb() << "Tunnelbox: Starting tunnel: " << acp->uri() << " <-> " << clr->uri();

tunnels.emplace_back(new Tunnel(this, move(acp), move(clr)));
tunnels.emplace_back(new Tunnel(this, std::move(acp), std::move(clr)));
// Note: after this instruction, acp and clr are no longer valid!
auto& it = tunnels.back();

Expand Down Expand Up @@ -1191,7 +1191,7 @@ int main( int argc, char** argv )
Verb() << "Connected. Establishing pipe.";

// No exception, we are free to pass :)
g_tunnels.install(move(accepted), move(caller));
g_tunnels.install(std::move(accepted), std::move(caller));
}
catch (...)
{
Expand Down
6 changes: 3 additions & 3 deletions apps/transmitmedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ class UdpCommon

void Setup(string host, int port, map<string,string> attr)
{
m_sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
m_sock = (int)socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (m_sock == -1)
Error(SysError(), "UdpCommon::Setup: socket");

Expand Down Expand Up @@ -848,7 +848,6 @@ class UdpCommon

if (is_multicast)
{
ip_mreq_source mreq_ssm;
ip_mreq mreq;
sockaddr_any maddr (AF_INET);
int opt_name;
Expand All @@ -872,6 +871,7 @@ class UdpCommon
if (attr.count("source"))
{
#ifdef IP_ADD_SOURCE_MEMBERSHIP
ip_mreq_source mreq_ssm;
/* this is an ssm. we need to use the right struct and opt */
opt_name = IP_ADD_SOURCE_MEMBERSHIP;
mreq_ssm.imr_multiaddr.s_addr = sadr.sin.sin_addr.s_addr;
Expand Down Expand Up @@ -1144,7 +1144,7 @@ extern unique_ptr<Base> CreateMedium(const string& uri)
}

if (ptr.get())
ptr->uri = move(u);
ptr->uri = std::move(u);

return ptr;
}
Expand Down
6 changes: 3 additions & 3 deletions apps/uriparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void UriParser::Parse(const string& strUrl, DefaultExpect exp)
if (idx != string::npos)
{
m_host = strUrl.substr(0, idx);
iQueryStart = idx + 1;
iQueryStart = (int)(idx + 1);
}
else
{
Expand Down Expand Up @@ -297,12 +297,12 @@ void UriParser::Parse(const string& strUrl, DefaultExpect exp)
if (idx != string::npos)
{
strQueryPair = strUrl.substr(iQueryStart, idx - iQueryStart);
iQueryStart = idx + 1;
iQueryStart = (int)(idx + 1);
}
else
{
strQueryPair = strUrl.substr(iQueryStart, strUrl.size() - iQueryStart);
iQueryStart = idx;
iQueryStart = (int)idx;
}

idx = strQueryPair.find("=");
Expand Down
10 changes: 7 additions & 3 deletions docs/API/API-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Since SRT v1.5.0.
| [SRT_REJ_FILTER](#SRT_REJ_FILTER) | 1.3.4 | The [`SRTO_PACKETFILTER`](API-socket-options.md#SRTO_PACKETFILTER) option has been set differently on both connection parties |
| [SRT_REJ_GROUP](#SRT_REJ_GROUP) | 1.4.2 | The group type or some group settings are incompatible for both connection parties |
| [SRT_REJ_TIMEOUT](#SRT_REJ_TIMEOUT) | 1.4.2 | The connection wasn't rejected, but it timed out |
| [SRT_REJ_CRYPTO](#SRT_REJ_CRYPTO) | 1.6.0-dev | The connection was rejected due to an unsupported or mismatching encryption mode |
| [SRT_REJ_CRYPTO](#SRT_REJ_CRYPTO) | 1.5.2 | The connection was rejected due to an unsupported or mismatching encryption mode |
| <img width=290px height=1px/> | | |

<h4 id="error-codes">Error Codes</h4>
Expand Down Expand Up @@ -359,8 +359,12 @@ int srt_bind(SRTSOCKET u, const struct sockaddr* name, int namelen);
Binds a socket to a local address and port. Binding specifies the local network
interface and the UDP port number to be used for the socket. When the local
address is a wildcard (`INADDR_ANY` for IPv4 or `in6addr_any` for IPv6), then
it's bound to all interfaces (although see `SRTO_IPV6ONLY` and additional
information below for details about the wildcard address in IPv6).
it's bound to all interfaces.

**IMPORTANT**: When you bind an IPv6 wildcard address, note that the
`SRTO_IPV6ONLY` option must be set on the socket explicitly to 1 or 0 prior to
calling this function. See
[`SRTO_IPV6ONLY`](API-socket-options.md#SRTO_IPV6ONLY) for more details.

Binding is necessary for every socket to be used for communication. If the socket
is to be used to initiate a connection to a listener socket, which can be done,
Expand Down