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

Revised SND DROP and SND pacing logic #2180

Merged
merged 1 commit into from
Jan 31, 2022

Conversation

maxsharabayko
Copy link
Collaborator

@maxsharabayko maxsharabayko commented Oct 28, 2021

Sending Priority

In the live streaming configuration with TL Packet Drop enabled original packet must have priority over packet retransmission because:

  • The earlier the latest original packet reaches the receiver, the better the end-to-end latency constraint is kept as the receiver can detect too late packets earlier.
  • If original packets are accumulating in the sender buffer, there is a network congestion, and likely most of the packet retransmissions won't reach the receiver. Therefore it is better to prioritize a more up-to-date payload, preserve the end-to-end latency and keep the jitter low. Once congestion is over, the streaming can be restored quicker.
  • In-order but belated packets have a negative impact on jitter and end-to-end latency.

Proposed sending priority (for Live Configuration Only):

  1. Retransmit a lost packet only if there is no original packet available for sending (which happens when the current sending rate < MaxBW).
  2. Otherwise check if FEC packet can be sent.
  3. Otherwise send the next original packet (first time sending).

Extracted Changes

Prefer Using Source Time if Provided Everywhere (Moved to #2185)

If a source time is provided, it must be considered as the origin time of a message. Meaning that buffer timespan calculation and the TL packet drop logic must rely on this time instead.
Thus there is no need to save two timestamps (m_tsOriginTime and m_llSourceTime_us). Just use m_tsOriginTime everywhere.

Refactored CUDT::packData() (Moved to #2229)

The logic which extracts an original (not ever sent yet_ packet from the sender buffer has been moved to a dedicated function CUDT::packUniqueData(..). The encryption order has been changed.

  • Verify sending an encrypted does not have issues.

Fix SND Drop Logic (Moved to #2230)

Sender dropping logic is applied if the sender buffer timespan exceeds drop_threshold_ms.
Instead, the delay of the oldest packet in the buffer should be used (Tnow - OldestPacketTS).
This also correlates with the usage of the source time if provided to calculate the timestamp, which was not the case previously.

As before, only packets older than Tnow - drop_threshold_ms are dropped by the sender.

See issue #898, #1910.

Don't Suppress SND Pacing (Moved to #2232)

Don't allow to force sending if checkNeedDrop signals congestion.
Addresses #713.

@maxsharabayko maxsharabayko added Type: Bug Indicates an unexpected problem or unintended behavior [core] Area: Changes in SRT library core labels Oct 28, 2021
@maxsharabayko maxsharabayko added this to the v1.4.5 milestone Oct 28, 2021
@maxsharabayko maxsharabayko force-pushed the develop/snd-drop branch 2 times, most recently from 484d13b to 78a503d Compare November 25, 2021 15:38
@maxsharabayko
Copy link
Collaborator Author

maxsharabayko commented Jan 28, 2022

Test Environment

  • Two CentOS 7 test machines.
  • Congestion: rate limit (LanForge).
  • Sending rate (source bitrate): 7 Mbps.
  • Network throughput:
    • 8 Mbps (+14%);
    • 5 Mbps (-28%) from 20th to 30th second.
  • SRT Max BW limit: 8 Mbps (+14% from source bitrate).
  • Packet loss: No (only by rate limit).
  • RTT: 40 ms.
  • SRT Latency: 150 ms.
(receiver)
./srt-xtransmit receive srt://:4200 --statsfile stats-rcv.csv --statsfreq 1s --metricsfile stats-metrics.csv \
                --metricsfreq 1s -v --enable-metrics

(sender)
maxbw=1000000
sendrate=7Mbps
./srt-xtransmit generate "srt://ip:4200?maxbw=$maxbw&latency=150" --sendrate $rate --duration 60s \
                --statsfile stats-snd.csv --statsfreq 100ms --enable-metrics -v
Vertsion pktRecvTotal pktRcvDropTotal pktRecvBelatedTotal pktRecvAppTotal pktMissingAppTotal
this PR 37842 2229 196 36900 2229
master 38414 2397 935 36767 2397

Note. pktRecvAppTotal and pktMissingAppTotal are calculated by the receiving application (srt-xtransmit, stats-metrics.csv). Other statistics are calculated by SRT.

This PR

⚠️ 100 ms stats interval on the sender.

SRT master after PR #2232

⚠️ 100 ms stats interval on the sender.

@maxsharabayko maxsharabayko changed the title Revised SND DROP and SND pacing logic (WIP) Revised SND DROP and SND pacing logic Jan 28, 2022
@maxsharabayko maxsharabayko merged commit 08e6482 into Haivision:master Jan 31, 2022
@maxsharabayko maxsharabayko deleted the develop/snd-drop branch January 31, 2022 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[core] Area: Changes in SRT library core Type: Bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant