Update TSBPD base time and clock drift on an idle connection.#2408
Conversation
Experiment
This PRWith the fix on updating TSBPD base using KEEPALIVE packets, the receiver starts streaming at the expected end-to-end latency of 1 second. The expected transmission delay (system clock delta) is above 3 seconds in this case. Drift correction of ~20ms happens after 15 seconds of streaming. The correction is not that big, meaning that drift adjustments were also handled properly on keepalive packets, although not as accurate as they could have been if RTT could be estimated. SRT v1.5.0Without the fix after around 1 hour 11 minutes the TSBPD base time resets back to zero, and the receiver is not aware of it. SRT v1.5.0 CBRTo compare to the expected transmission delay (system clock delta) here are the results of 1Mbps streaming for the whole duration of the experiment (2 hours). |
c772429 to
9168550
Compare



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
timestampfield 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