Skip to content

twcc: Handle wrapping of reference time

Johan Sternerup requested to merge johast/gstreamer:twcc_wrap_fix into main

Previously the wrapping of the 24-bit reference time was not handled correctly when transforming it into GstClockTime. Given the unit of 64ms the span that could be represented by 24 bits is 12 days and depending on the start value we could get a wrapping problem anytime within this time frame. This turned out to be particularly problematic for the GCC algorithm in gst-plugins-rs which tried to evict old packages based on the "oldest" timestamp, which due to wrapping problems could be in the future. Thus, the container managing the packets could grow without limits for a long time thereby creating both CPU and memory problems.

This commit handles the wrapping by introducing a window around the wrapping point where we assume that numbers slightly larger than 0 are ahead of the values that are close to the maximum value of a 24-bit number.

Merge request reports