Update TSBPD base time and clock drift on an idle connection. #2408
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Normally the TSBPD base time is updated on the receiver side based on timestamps of incoming SRT data packets.
Clock drift estimate is updated based on ACK-ACKACK packet pairs, on the receiver side.
Note
TSBPD base time update with this PR happens only if the new receiver buffer is used.
1. Idle Connection
In case of an idle connection only KEEPALIVE packets are being sent to the peer. They must be used to track the TSBPD base time carryover. The carryover happens every 01:11:35 (HH:MM::SS) hours once the
timestamp
field of an SRT packet no longer has enough bits to represent a packet timestamp based on the current TSBPD time base.A keepalive packet is sent every 1 second if a connection is idle. The TSBPD wrapping period starts 30 seconds before reaching the maximum timestamp value of a packet and ends once the packet with timestamp within (30, 60) seconds interval is delivered (read from the buffer). Therefore the keepalive period should be enough to properly handle the carryover of the timestamp.
Clock drift also has to be updated. In case of KEEPALIVE packets there is not RTT estimate available, thus deviations in network delay may affect the tracing.
Also currently drift tracer accumulated 1k samples to perform an update. In case of keepalive packets a new sample is added every 1 second, and drift update would take quite a long time.
2. SRT Sender
Addressed in PR #2435.
TODO
Addresses #1936