[core] Update TSBPD base time and clock drift on sender. #2435
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.
Once an SRT connection is established, the payload can be sent bi-directionally.
However, only the receiver tracks TSBPD base time carryover and clock drift. If a sender starts receiving payload one hour (01:11:35) after a connection has been established, the base might be already different, and receiving would be problematic in the aspect of keeping the proper end-to-end latency.
SRT sender must keep track of peer's base time and clock drift based on incoming ACK packets. Sadly, an RTT sample is also not available in this case (only smoothed RTT value). Thus clock drift would not be compensated for it.
The update would happen every 10ms (Lite ACK may come more frequently), thus there would be enough drift samples to update the drift value with a good frequency.
Only Full ACK is used to do the update not more frequently than every 10 ms.
Addresses #1936.
Extracted from #2408 (expect the PR to be merged first).
TODO