Skip to content

Commit 6357407

Browse files
committed
Expose data track pipeline options
1 parent 2a38ec0 commit 6357407

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

livekit-rtc/livekit/rtc/data_track.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,29 @@ def is_published(self) -> bool:
183183
resp = FfiClient.instance.request(req)
184184
return bool(resp.remote_data_track_is_published.is_published)
185185

186+
def set_pipeline_options(self, *, max_partial_frames: Optional[int] = None) -> None:
187+
"""Configures options for the pipeline handling incoming packets for this track.
188+
189+
These options apply to all current and future subscriptions of this track, and
190+
may be set at any time. New options take effect with the next received packet.
191+
192+
Args:
193+
max_partial_frames: Maximum number of partial frames the depacketizer will
194+
track concurrently for this track. Defaults to 1. Higher values give more
195+
out-of-order tolerance for high-frequency senders at the cost of additional
196+
buffering. Zero is not a valid value; if a value of zero is provided, it
197+
will be clamped to one. When ``None``, the current value is kept.
198+
"""
199+
opts = proto_data_track.RemoteDataTrackPipelineOptions()
200+
if max_partial_frames is not None:
201+
opts.max_partial_frames = max_partial_frames
202+
203+
req = proto_ffi.FfiRequest()
204+
req.remote_data_track_set_pipeline_options.track_handle = self._ffi_handle.handle
205+
req.remote_data_track_set_pipeline_options.options.CopyFrom(opts)
206+
207+
FfiClient.instance.request(req)
208+
186209
def __repr__(self) -> str:
187210
return (
188211
f"rtc.RemoteDataTrack(sid={self._info.sid}, name={self._info.name}, "

0 commit comments

Comments
 (0)