-
Notifications
You must be signed in to change notification settings - Fork 856
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
[BUG] Negotiated SRT link latency is unknown due to 1/2 RTT addition #2016
Comments
Hi @leio Thank you for a good question! It is a very interesting topic with a high capacity for future improvements of the protocol. Configuring SRT LatencyCurrent behavior. It is recommended to set SRT latency at least 3 × RTT. It means that to configure SRT for reliable live streaming you already need to know at least roughly the average RTT of the connection. Handshake-based RTTFuture Improvement One of the future improvements of SRT backlogged is to calculate RTT on the stage of handshake exchange. Then as a user, you could specify the actual target end-to-end latency (the latency between sending and receiving application). SRT will use the handshake-based RTT to adjust the buffering delay accordingly to configure the target end-to-end latency. There are certain technical difficulties needed to be addressed to enable this use case. But in general, this is something that could be done in the future versions of SRT. Certain improvements of RTT calculation and tracking were done, e.g., in #1957. Knowing the Actual LatencyCan be done in the current version of SRT. While there is no handshake-based RTT and latency correction, it might be useful to provide a way for a user to know the actual end-to-end delay in the connection. Then a socket option to get the actual latency could be added, e.g., Configure Latency as a Multiple of RTTFuture Improvement If SRT can estimate RTT from handshakes, then it could configure the effective latency as a multiple of this value, instead of some pre-defined amount of milliseconds. E.g., you could say I want my end-to-end latency be 2×RTT, and after the connection you could find out the actual latency negotiated. |
The reply given here is full of deep SRT protocol and implementation specifics that makes it very hard to figure out what can actually be done today to get to know how much the packets are delayed. To my understanding, SRT is meant to have a constant latency - what you put into Would I need to somehow hook into the SRT stats and quickly figure out the first msRTT value it reports? Something else? Talking about the "Knowing the Actual Latency - Can be done in the current version of SRT." part here. You say "the very first RTT estimate can be considered as the closest estimation of the RTT0", but how can I actually reliably retrieve that? That all said, the full technical explanation and description given was also very insightful and welcome, thanks! |
I am afraid there is no reliable way to get this value. But this can be added as a feature request. Two read-only socket options to get actual latencies in the receiving and sending directions. With what is currently available via the API, one way would be to take Another way to estimate the actual latency on the receiver side is: To sum up, I think the actual latency would be useful information, so it might make sense to add it to SRT API. |
Yes, we need this information for other purposes than SRT really. For example if you know what the actual latency is for sure, you can start making better estimations on calculating your encoding and/or decoding latency. My big issue has been that msRTT value is As far as feature request goes - then this ticket I filed was intended as such, really :) At least if it's not already possible and I just didn't know how. |
Describe the bug
It appears impossible to know the actual SRT link latency programmatically, as the socket options and stats report the negotiated latency (the highest of the requested latency between the two sides), but there appears to be no way to find out what the half-RTT was at the time of the handshake, and thus what the actual effective SRT link latency is after handshake.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
There should be some way to get to know the effective latency after the handshake is done with clear documentation about it
Desktop (please provide the following information):
Additional context
Tickets like #984 and the SRT cookbook reference the half-RTT addition based on RTT value at time of handshake, but there appears no way to really know what that value actually ended up being during handshake, which can be important for some use cases.
The text was updated successfully, but these errors were encountered: