Skip to content

[FR] Add the scheduled sending mode for live mode sending#3198

Draft
ethouris wants to merge 37 commits into
Haivision:devfrom
ethouris:dev-sender-schedule
Draft

[FR] Add the scheduled sending mode for live mode sending#3198
ethouris wants to merge 37 commits into
Haivision:devfrom
ethouris:dev-sender-schedule

Conversation

@ethouris
Copy link
Copy Markdown
Collaborator

@ethouris ethouris commented Aug 12, 2025

The new scheduled sending mode should work the following way:

  1. As packets are being added to the sender buffer, the sending time will be assigned to them. The first in the schedule will get the last sending time plus interval, next ones will get sending times as calculated for the current situation, mainly basing on the current bandwidth limit, but possibly also with the current maximum availble bandwidth, if it's lower than the limit.
  2. Packet loss will be scheduled for the whole range of packets and they will be scheduled for sending with regard to maximum bandwidth and overhead.
  3. If the current schedule time for the next element is in the past, the base time is cut after exceeding 1 second ("forfeited time").

To use this mode, add the SRTO_SENDMODE option with value 1. sendmode can be used in the applications in the URI.

Development phases:

  1. Implement the scheduling mechanism. Use the m_tdSendInterval as the sending interval base and then just forfeit time exceeding 1 second. The m_tdSendInterval in case of live mode is using the "virtually unlimited" value or MAXBW can control the limit, as well as INPUTBW/OHEADBW. The "forfeit" mechanism means simply that you may potentially send packets that fast, but you don't because the packets scheduled for sending at the input (the srt_sendmsg2 calls) are sent slower than that. This means simply that packets are sent immediately, like before.
  2. Add the groupwise packet sending for the speed measurement mechanism. This should allow the application to schedule all packets "at once", just their delivery time declared in the time still holds.
  3. Add the speed measurement mechanism used for the measurement group and use it to distribute packets within the measurement group. This will dictate the times when packets should be physically sent, although their play time will be modified according to the required bandwidth.

Copy link
Copy Markdown

@github-advanced-security github-advanced-security AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Comment thread srtcore/common.h
namespace srt
{

// export import .api default;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
Comment thread srtcore/core.cpp
Comment on lines +9078 to +9081
// Will be used to determine rexmit packets to schedule.
// If remain with this value, there's nothing to schedule.
int32_t sched_lo = SRT_SEQNO_NONE, sched_hi = SRT_SEQNO_NONE;

Check notice

Code scanning / CodeQL

Futile conditional Note

If-statement with an empty then-branch and no else-branch.
Comment thread srtcore/buffer_tools.h
typedef sync::steady_clock::time_point time_point;
typedef sync::steady_clock::duration duration;
CShaper (double min_tokens_capacity):
m_BurstPeriod(sync::milliseconds_from(BURSTPERIOD_DEFAULT())),

Check warning

Code scanning / CodeQL

Lossy function result cast Warning

Return value of type double is implicitly converted to signed long.
Comment thread srtcore/core.cpp
// for measurement the speed may also increase in time). Note that the LAST
// packet in the group must be sent at time not earlier than RTT + LATENCY + EAT.
// - In flush time, usually set when difference frames are to be scheduled,
// the step time should be defined as:

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable distance is not used.
Comment thread srtcore/buffer_rcv.h Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants