From eb81cb554a767d4b538e8fb80aa1811ba9ebf2f8 Mon Sep 17 00:00:00 2001 From: Jacob Gelman <3182119+ladvoc@users.noreply.github.com> Date: Mon, 29 Jun 2026 14:42:40 -0700 Subject: [PATCH] Expose data track pipeline options --- Runtime/Scripts/DataStreams/DataTrack.cs | 43 +++++++++++++++++++ .../Internal/FFI/FfiRequestExtensions.cs | 3 ++ 2 files changed, 46 insertions(+) diff --git a/Runtime/Scripts/DataStreams/DataTrack.cs b/Runtime/Scripts/DataStreams/DataTrack.cs index a6bd9fcc..de97ff6a 100644 --- a/Runtime/Scripts/DataStreams/DataTrack.cs +++ b/Runtime/Scripts/DataStreams/DataTrack.cs @@ -74,6 +74,27 @@ public class DataTrackSubscribeOptions public uint? BufferSize { get; set; } } + /// + /// Track-level options that configure how the incoming-frame pipeline reassembles packets + /// for a remote data track. + /// + /// + /// Applied via . + /// + public class RemoteDataTrackPipelineOptions + { + /// + /// Maximum number of partial frames the depacketizer will track concurrently for this + /// track. + /// + /// + /// Defaults to 1. Higher values give more out-of-order tolerance for high-frequency + /// senders at the cost of additional buffering. Zero is not a valid value; if a value + /// of zero is provided, it will be clamped to one. Leave unset to keep the current value. + /// + public uint? MaxPartialFrames { get; set; } + } + /// /// A frame published on a data track, consisting of a payload and optional metadata. /// @@ -323,6 +344,28 @@ public bool IsPublished() FfiResponse res = response; return res.RemoteDataTrackIsPublished.IsPublished; } + + /// + /// Configures options for the pipeline handling incoming packets for this track. + /// + /// + /// These options apply to all current and future subscriptions of this track, and may be + /// set at any time. New options take effect with the next received packet. + /// + /// The pipeline options to apply. + public void SetPipelineOptions(RemoteDataTrackPipelineOptions options) + { + using var request = FFIBridge.Instance.NewRequest(); + var pipelineReq = request.request; + pipelineReq.TrackHandle = (ulong)_handle.DangerousGetHandle(); + + var protoOptions = new Proto.RemoteDataTrackPipelineOptions(); + if (options.MaxPartialFrames.HasValue) + protoOptions.MaxPartialFrames = options.MaxPartialFrames.Value; + pipelineReq.Options = protoOptions; + + request.Send(); + } } /// diff --git a/Runtime/Scripts/Internal/FFI/FfiRequestExtensions.cs b/Runtime/Scripts/Internal/FFI/FfiRequestExtensions.cs index b054cfad..b31f4dc0 100644 --- a/Runtime/Scripts/Internal/FFI/FfiRequestExtensions.cs +++ b/Runtime/Scripts/Internal/FFI/FfiRequestExtensions.cs @@ -258,6 +258,9 @@ public static void Inject(this FfiRequest ffiRequest, T request) case DataTrackStreamReadRequest dataTrackStreamReadRequest: ffiRequest.DataTrackStreamRead = dataTrackStreamReadRequest; break; + case RemoteDataTrackSetPipelineOptionsRequest remoteDataTrackSetPipelineOptionsRequest: + ffiRequest.RemoteDataTrackSetPipelineOptions = remoteDataTrackSetPipelineOptionsRequest; + break; default: throw new Exception($"Unknown request type: {request?.GetType().FullName ?? "null"}"); }