fix: bound data-track buffering under downlink congestion (targetLatency) (#4667)
* fix: bound data-track buffering under downlink congestion The SFU data-track down-channel writer was constructed with targetLatency=0, which disables the buffered-amount/latency-based drop in writeUnreliable. Under subscriber downlink congestion, frames were queued unbounded and in order in the per-subscriber SCTP send buffer instead of being dropped, so end-to-end latency grew without limit and only drained once congestion cleared. This contradicts data tracks being a low-latency, lossy transport. Wire a dedicated `datachannel_data_track_target_latency` config through to both data-track writer call sites (mirroring how `datachannel_lossy_target_latency` controls the lossy publishData channel), reusing lossyDataChannelMinBufferedAmount as the drop floor. Defaults to 100ms so data tracks are latency-bounded out of the box; set to 0 to restore the previous unbounded behavior. Fixes #4666 * fix: track drained bytes on successful unreliable data channel writes writeUnreliable only called BitrateCalculator.AddBytes when a write failed, so on the common success path the calculator never received samples. As a result Bitrate() had no data and the latency-based drop threshold collapsed to the static minBufferedAmount floor, making the per-subscriber latency control (datachannel_lossy_target_latency and the new datachannel_data_track_target_latency) effectively inert. Call AddBytes after every write, matching writeReliable.
This commit is contained in:
@@ -166,6 +166,10 @@ rtc:
|
||||
# # max number of bytes to buffer for data channel. 0 means unlimited.
|
||||
# # when this limit is breached, data messages will be dropped till the buffered amount drops below this limit.
|
||||
# data_channel_max_buffered_amount: 0
|
||||
# # target latency for data track channels. under downlink congestion, frames are dropped
|
||||
# # to keep the per-subscriber buffer bounded (a fresh frame is preferable to a stale queued one).
|
||||
# # 0 disables buffering control (unbounded buffering). defaults to 100ms.
|
||||
# datachannel_data_track_target_latency: 100ms
|
||||
|
||||
# when enabled, LiveKit will expose prometheus metrics on :6789/metrics
|
||||
# prometheus_port: 6789
|
||||
|
||||
Reference in New Issue
Block a user