Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
05e0666
Added base utilities and implementation for sender schedule (untested)
ethouris-hv Jun 16, 2025
700eb7f
Merged-in dev-rework-multiplexer, post-fixed
ethouris-hv Jun 25, 2025
371606f
Added SocketKeeper tracking. Added speed stats recording
ethouris-hv Jul 9, 2025
85daec8
Merged und fixed
ethouris-hv Jul 10, 2025
6a94985
Added stop handling and muxer config entry. STILL NOT TESTED.
ethouris-hv Jul 11, 2025
5b4cb49
Fixed bug: twice locking in wait. STILL TESTS FAIL
ethouris-hv Jul 11, 2025
ddc6ab2
Merged latest changes from dev and dev-rework-multiplexer
ethouris-hv Aug 12, 2025
c5b1e2c
Added HeapSet::find_next function
ethouris-hv Aug 13, 2025
c7e85ad
Some log fixes
ethouris-hv Aug 14, 2025
25a6027
Updated from dev and post-fixed
ethouris-hv Nov 6, 2025
b4943f1
Cleared a compile warning
ethouris-hv Nov 6, 2025
34c46ea
Updated to latest dev
ethouris-hv Nov 6, 2025
12c4285
Removed another warning error
ethouris-hv Nov 6, 2025
4f60162
Extracted CiBuffer from CRcvBuffer. Removed offset-dep from CSndBuffe…
ethouris-hv Nov 12, 2025
1fbe6b4
Added alternative sender buffer
ethouris-hv Nov 21, 2025
86bc2c9
Implemented per-packet busy flags and locker object for sending packets
ethouris-hv Nov 25, 2025
1213952
Fixed build break
ethouris-hv Nov 25, 2025
97c005f
Fixed bug: missing setting srctime when extracting. Fixed bug: missin…
ethouris-hv Nov 26, 2025
16d3f20
Rewritten insert_loss. Reshaped the code to collect all SndPktArray m…
ethouris-hv Dec 4, 2025
e1162dd
Updated with latest cutoff-dev
ethouris-hv Dec 4, 2025
c9d1ec6
Fixed some build breaks
ethouris-hv Dec 4, 2025
5fc7180
Fixed some build breaks (test)
ethouris-hv Dec 4, 2025
05a4f03
Restored working code with the old CSndBuffer
ethouris-hv Dec 4, 2025
ee5ef58
Fixed preallocation and maximum storage capacity parameters
ethouris-hv Dec 4, 2025
a76e5b1
Tracking a CI failure on Ubuntu
ethouris-hv Dec 4, 2025
5d3c5be
[BUG] Fixed std::shared_mutex usage for C++17. Removed external clone…
ethouris-hv Dec 8, 2025
eb255c1
Merge branch 'dev-fix-shared-mutex-selection' into dev-new-sender-buffer
ethouris-hv Dec 8, 2025
0144e17
Logging: no passing string by value. Removed verbose entries for RcvB…
ethouris-hv Dec 8, 2025
3455f5c
Unified rexmit extraction. Removed old implementation
ethouris-hv Dec 10, 2025
7444735
Merge branch 'dev' into dev-new-sender-buffer
ethouris-hv Dec 11, 2025
f17d9b9
Fixed bug in CRcvBuf: m_iEndOff incorrectly updated after removal. Re…
ethouris-hv Dec 12, 2025
bad3676
Fixed build break on pedantic configurations
ethouris-hv Dec 12, 2025
8396cf4
Merge branch 'dev' into dev-sender-schedule
ethouris-hv Dec 12, 2025
a6e9cfd
Merged the changes with the new sender buffer
ethouris-hv Dec 15, 2025
f1e5b89
Literal in comment
ethouris-hv Dec 15, 2025
db168ac
Updated to latest dev
ethouris-hv Apr 9, 2026
9468f92
Fixed: deleted outdated doc file
ethouris-hv Apr 9, 2026
a05855b
(large) Improvements in scheduling (no more chain). Improvements in o…
ethouris-hv Aug 24, 2026
27334b9
Fixes for the previous changes
ethouris-hv Aug 24, 2026
64bb57c
Improvements for ofmt, added fmt that accepts iomanip
ethouris-hv Aug 25, 2026
79bf45c
Updated after extracted ofmt changes
ethouris-hv Aug 27, 2026
1d6bbe1
Fixed improvement for FormatTime
ethouris-hv Aug 27, 2026
d2bb03c
Updated to dev
ethouris-hv Aug 28, 2026
9735cef
Back-merged BSTOW stuff from dev
ethouris-hv Aug 31, 2026
fa5553e
Updated from latest upstream
ethouris-hv Sep 14, 2026
efe3425
Merge branch 'dev' into dev-sender-schedule
ethouris-hv Sep 16, 2026
3a7e164
Removed unused seqno_hi
ethouris-hv Sep 17, 2026
a00cf9d
Reimplemented task rep to avoid cross-list iterator comparison
ethouris-hv Sep 30, 2026
7d36231
Smaller fixes
ethouris-hv Sep 30, 2026
6e08d9d
Merge branch 'dev' into dev-sender-schedule
ethouris-hv Sep 30, 2026
5d9b0d1
Added missing header file to filelist
ethouris-hv Sep 30, 2026
d7ef873
Merged and post-fixed. Fixed bugs in extractLoss. Added length check …
ethouris-hv Oct 14, 2026
3ccbac3
Removed extra line
ethouris-hv Oct 14, 2026
9847748
Merged and fixed
ethouris-hv Oct 14, 2026
70343ae
Merge branch 'dev' into dev-sender-schedule
ethouris-hv Oct 14, 2026
2287d1f
Fixes for invalid scheduling by Copilot
ethouris Oct 15, 2026
5a3972d
Changed checks of full flight window to preschedule update. Split dir…
ethouris Oct 16, 2026
b14b9b1
Copi: added monotonic verification for srctime in send functions
ethouris Oct 19, 2026
44cefc7
Fixed vulnerability of SocketKeeper. Behave as unique pointer
ethouris Oct 19, 2026
a797927
Fixed description. Applied missing doc comment
ethouris-hv Oct 19, 2026
9c6e520
Merged with the latest changes from dev and master
ethouris-hv Oct 21, 2026
5e61a59
Intermediate merge version (build breaking)
ethouris-hv Oct 21, 2026
a7a6988
Adapt PR 3387 for independent encryption keys
ethouris Oct 22, 2026
8a2f3c0
Merge commit 'a7a69889f83e91716a68439856a2880e9b2cd4b7' into ethouris…
ethouris Oct 22, 2026
9751eb8
Integrate scheduled sending with independent key readiness
ethouris Oct 22, 2026
1d8b464
Merged with latest dev changes
ethouris-hv Oct 23, 2026
f2c5337
Merge branch 'dev' into dev-sender-schedule
ethouris-hv Oct 23, 2026
a99feda
(Copilot) remove wrong init/destroy for sync module
ethouris Oct 26, 2026
9afdcbc
Merge branch 'local-scheduled-sender-key-integration' into ethouris-h…
ethouris Oct 26, 2026
fb25531
(Copilot) restored the use of futures in test
ethouris Oct 26, 2026
a14b399
Restored releaseCond in empty version. Fixed POSIX sync. srt-test-sto…
ethouris-hv Oct 26, 2026
b958c83
Merge branch 'dev' into dev-scheduled-sender-fixes
ethouris-hv Oct 26, 2026
ceb7ed8
Merge branch 'ethouris-hv-scheduled-sender-key-integration' into dev-…
ethouris-hv Oct 26, 2026
2f8d4b6
Merge branch 'dev-scheduled-sender-fixes' into dev-sender-schedule
ethouris-hv Oct 26, 2026
f123ef1
Fixed help handling for hvu::options
ethouris-hv Oct 26, 2026
7eb3d04
Updated the latest
ethouris-hv Oct 26, 2026
564e71e
Updated to latest dev
ethouris-hv Nov 4, 2026
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
3 changes: 2 additions & 1 deletion apps/socketoptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ const SocketOption srt_options [] {
{ "bindtodevice", 0, SRTO_BINDTODEVICE, SocketOption::PRE, SocketOption::STRING, nullptr},
{ "retransmitalgo", 0, SRTO_RETRANSMITALGO, SocketOption::PRE, SocketOption::INT, nullptr },
{ "cryptomode", 0, SRTO_CRYPTOMODE, SocketOption::PRE, SocketOption::INT, nullptr },
{ "maxrexmitbw", 0, SRTO_MAXREXMITBW, SocketOption::POST, SocketOption::INT64, nullptr }
{ "maxrexmitbw", 0, SRTO_MAXREXMITBW, SocketOption::POST, SocketOption::INT64, nullptr },
{ "sendmode", 0, SRTO_SENDMODE, SocketOption::PRE, SocketOption::INT, nullptr }
};
}

Expand Down
97 changes: 64 additions & 33 deletions docs/API/API-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2061,7 +2061,8 @@ the [`SRT_MSGCTRL::msgttl`](#SRT_MSGCTRL) field.
* `inorder`: Required to be received in the order of sending. See
[`SRT_MSGCTRL::inorder`](#SRT_MSGCTRL).
* `mctrl`: An object of [`SRT_MSGCTRL`](#SRT_MSGCTRL) type that contains extra
parameters, including `ttl` and `inorder`.
parameters, including `ttl` and `inorder`. See details of this structure for
additional important details concerning these parameters.

The way this function works is determined by the mode set in options, and it has
specific requirements:
Expand Down Expand Up @@ -2811,55 +2812,85 @@ The sender can pass the timestamp in `MSGCTRL::srctime` of the `srt_sendmsg2(..)
function together with the packet being submitted to SRT. If the `srctime` value
is not provided (the default value of 0 is set), SRT will use the internal clock
and assign packet submission time as the packet timestamp. If the sender wants to
explicitly assign a timestamp to a certain packet this timestamp MUST be taken
from SRT Time Access functions. The time value provided MUST equal or exceed the
connection start time (`srt_connection_time(..)`) of the SRT socket passed
to `srt_sendmsg2(..)`.
explicitly specify a timestamp for a packet, this value must be monotonic against
the time used by SRT, that is, this time value must be later (greater) than:

* the value obtained by `srt_connection_time()` for the same socket

* the value specified in any earlier call of `srt_sendmsg2` for the same socket

otherwise the call to `srt_sendmsg2` will fail.

This time value must be in the same domain as the time values used by SRT. The
values obtained by `srt_connection_time()` and `srt_time_now()` are in this
domain.

The current time value of the SRT internal clock can be retrieved using
the `srt_time_now()` function.

There are two known cases where you might want to use `srctime`:

1. SRT passthrough (for stream gateways).
You may wish to simply retrieve packets from an SRT source and pass them transparently
to an SRT output (possibly re-encrypting). In that case, every packet you read should
preserve the original value of `srctime` as obtained from [`srt_recvmsg2`](#srt_recvmsg2),
and the original `srctime` for each packet should be then passed to [`srt_sendmsg2`](#srt_sendmsg).
This mechanism could be used to avoid jitter resulting from varying differences between
the time of receiving and sending the same packet.

2. Stable timing source.
In the case of a live streaming procedure, when spreading packets evenly into the stream,
you might want to predefine times for every single packet to keep time intervals perfectly equal.
Or, if you believe that your input signal delivers packets at the exact times that should be
assigned to them, you might want to preserve these times at the SRT receiving side
to avoid jitter that may result from varying time differences between the packet arrival
and the moment when sending it over SRT. In such cases you might do the following:
You may wish to simply retrieve packets from an SRT source and pass them
transparently to an SRT output (possibly re-encrypting). In that case, every
packet you read should preserve the original value of `srctime` as obtained
from [`srt_recvmsg2`](#srt_recvmsg2), and the original `srctime` for each
packet should be then passed to [`srt_sendmsg2`](#srt_sendmsg). This mechanism
could be used to avoid jitter resulting from varying differences between the
time of receiving and sending the same packet.

- At the packet arrival time, grab the current time at that moment using `srt_time_now()`.
2. Stable timing source.

- When you want a pre-calculated packet time, use a private relative time counter
set at the moment when the connection was made. From the moment when your first packet
is ready, start pre-calculating packet times relative to the connection start time obtained
from `srt_connection_time()`. Although you still have to synchronize sending times with these
predefined times, by explicitly specifying the source time you avoid the jitter
resulting from a lost accuracy due to waiting time and unfortunate thread scheduling.
In the case of a live streaming procedure, when spreading packets evenly into
the stream, you might want to predefine times for every single packet to keep
time intervals perfectly equal. Or, if you believe that your input signal
delivers packets at the exact times that should be assigned to them, you might
want to preserve these times at the SRT receiving side to avoid jitter that may
result from varying time differences between the packet arrival
and the moment when sending it over SRT. In such cases you might do the following:

Note that `srctime` uses an internally defined clock that is intended to be monotonic
(the definition depends on the build flags, see below). Because of that **the application
should not define this time basing on values obtained from the system functions for getting
the current system time** (such as `time`, `ftime` or `gettimeofday`). To avoid problems and
misunderstanding you should rely exclusively on time values provided by the
`srt_time_now()` and `srt_connection_time()` functions.
* At the packet arrival time, grab the current time at that moment using
`srt_time_now()`.

* When you want a pre-calculated packet time, use a private relative time
counter set at the moment when the connection was made. From the moment when
your first packet is ready, start pre-calculating packet times relative to the
connection start time obtained from `srt_connection_time()`. Although you still
have to synchronize sending times with these predefined times, by explicitly
specifying the source time you avoid the jitter resulting from a lost accuracy
due to waiting time and unfortunate thread scheduling.

3. STOW mode

In the STOW mode with eager sending the application is allowed to supply
packets faster than it is legitimate for the live mode. In this case the
packets can remain in the sender buffer until the time comes for them to
be sent, while the timestamp still defines the rhythm in which they should
be sent. This timestamp then defines the relative time between packets to
be kept when then receiver application will receive them, as well as it will
be the ultimate time to keep in the receiver buffer (to wait for recovery)
and the ultimate time to send in the eager mode.

XXX NOT IMPLEMENTED YET: the time may be supplied automatically in STOW mode
basing on the bandwidth specified by `SRTO_INPUTBW`. Until this is implemented
supplying the timestamps in STOW mode is obligatory.

Note that `srctime` uses an internally defined clock that is intended to be
monotonic (the definition depends on the build flags, see below). Because of
that **the application should not define this time basing on values obtained
from the system functions for getting the current system time** (such as
`time`, `ftime` or `gettimeofday`). To avoid problems and misunderstanding you
should rely exclusively on time values provided by the `srt_time_now()` and
`srt_connection_time()` functions.

The clock used by the SRT internal clock is determined by the following build flags:
- `ENABLE_MONOTONIC` makes use of `CLOCK_MONOTONIC` with `clock_gettime` function.
- `ENABLE_STDXXX_SYNC` makes use of `std::chrono::steady_clock`.

The default is currently to use the system clock as the internal SRT clock,
although it's highly recommended to use one of the above monotonic clocks,
as system clock is vulnerable to time modifications during transmission.
although it's highly recommended to use one of the above monotonic clocks, as
system clock is vulnerable to time modifications during transmission.

### srt_time_now

Expand Down
8 changes: 8 additions & 0 deletions docs/features/encryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ To avoid this, each direction uses its own SEK and Salt:

Two older versions connected together still share the same key in both directions.

With scheduled sending, application data enters the preschedule queue while the
initial refresh is pending. A regular packet receives its send time only after
the encryption gate opens and flight-window capacity is available. The
`CUDT::checkSndTimers` key-management state machine drives the refresh and retries;
acknowledging the refreshed key wakes the multiplexer scheduler. Invalid responses
or delayed acknowledgments of the original handshake key do not open the gate.
Blocked sockets do not prevent other sockets or retransmissions from progressing.

The cryptographic usage limit of the KEK is 2<sup>48</sup> wraps (AESKW) which means virtual infinity at the expected SEK rekeying rate (90000 years to rekey 100 keys every second).

[figure1]: images/srt-encryption-1.png
Expand Down
Loading
Loading