[FR] Add the scheduled sending mode for live mode sending - #3198
[FR] Add the scheduled sending mode for live mode sending#3198ethouris wants to merge 43 commits into
Conversation
There was a problem hiding this comment.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
| namespace srt | ||
| { | ||
|
|
||
| // export import .api default; |
Check notice
Code scanning / CodeQL
Commented-out code Note
| 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
…r. Put CSndLossList to CSndBuffer. Explicit save/restore for SndRateMeasurement
…g destructor for CSndBuffer internal container
…ethods in one place. Added unit tests for sender loss handling.
…implemented walkEntries and added test for it. Some fixes from CodeQL reports
…fmt. Extracted and improved option utility.
| /* XXX ProcessOptions not implemented to handle this; | ||
| may be added in the future. | ||
| void process(const std::vector<std::string>& args) | ||
| { | ||
| m_params = ProcessOptions(args); | ||
| } | ||
| */ |
Check notice
Code scanning / CodeQL
Commented-out code Note
|
|
||
| int getAvgBufSize(int& bytes, int& timespan); | ||
|
|
||
| // bool getPacketRangeSize(int32_t seqlo, int32_t seqhi, int& w_packets, int& w_bytes); |
Check notice
Code scanning / CodeQL
Commented-out code Note
|
|
||
| // For schedule mode sending | ||
| sync::steady_clock::time_point lastSchedTime() const { return m_LastSched.lastTime(); } | ||
| //sync::steady_clock::duration lastSendInterval() const { return m_LastSched.lastInterval(); } |
Check notice
Code scanning / CodeQL
Commented-out code Note
| if (!have_task_ready()) | ||
| { | ||
| m_TaskReadyCond.notify_all(); | ||
| //IF_HEAVY_LOGGING(notif = " [NOTIFIED]"); |
Check notice
Code scanning / CodeQL
Commented-out code Note
| /* | ||
| SendTask::taskiter_t SendScheduler::enqueue_task(socket_t id, const SchedPacket& proto, const clock_time& when, const clock_time& delivery) | ||
| { | ||
| if (m_bBroken) | ||
| { | ||
| HLOGC(qslog.Debug, log << "Schedule: ENQ: DENIED, schedule is broken"); | ||
| return SendTask::none(); | ||
| } | ||
|
|
||
| sync::ScopedLock lk (m_Lock); | ||
| SendTask::taskiter_t itask = create_task(proto, when, delivery); | ||
|
|
||
| bool was_ready = have_task_ready(); | ||
|
|
||
| size_t pos = m_TaskQueue.insert(itask); | ||
|
|
||
| IF_HEAVY_LOGGING(bool was_first = false); | ||
| IF_HEAVY_LOGGING(bool now_ready = false); | ||
| if (pos == 0) // earliest task | ||
| { | ||
| m_tsAboutTime = m_TaskQueue.top()->m_tsSendTime; // INSERTED: will not be empty | ||
| IF_HEAVY_LOGGING(was_first = true); | ||
| } | ||
|
|
||
| // XXX Shouldn't it update always if m_tsAboutTime was updated? | ||
| if (!was_ready && have_task_ready()) | ||
| { | ||
| m_TaskReadyCond.notify_all(); | ||
| IF_HEAVY_LOGGING(now_ready = true); | ||
| } | ||
|
|
||
| HLOGC(qslog.Debug, log << "Schedule: ENQ: new" | ||
| << fmt_if(now_ready, " READY") | ||
| << " task at T=" << FormatTime(itask->m_tsSendTime) | ||
| << fmt_if(was_first, " (NEW TOP)") | ||
| << fmt_if(was_ready, " (NOW READY)", " (ONLY ADDED)") | ||
| << fmt_if(now_ready, " - NOTIFY")); | ||
|
|
||
| return itask; | ||
| } | ||
| // */ |
Check notice
Code scanning / CodeQL
Commented-out code Note
| return !m_bBroken; | ||
| } | ||
|
|
||
| // SendTask::taskiter_t enqueue_task(socket_t id, const SendTask& proto); |
Check notice
Code scanning / CodeQL
Commented-out code Note
The new scheduled sending mode should work the following way:
To use this mode, add the
SRTO_SENDMODEoption with value 1.sendmodecan be used in the applications in the URI.Development phases:
m_tdSendIntervalas the sending interval base and then just forfeit time exceeding 1 second. Them_tdSendIntervalin 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 (thesrt_sendmsg2calls) are sent slower than that. This means simply that packets are sent immediately, like before.