Skip to content

Expose Frame Packet Trailer (FrameMetadata) for video#286

Merged
MaxHeimbrock merged 5 commits into
mainfrom
max/frame-packet-trailer
May 21, 2026
Merged

Expose Frame Packet Trailer (FrameMetadata) for video#286
MaxHeimbrock merged 5 commits into
mainfrom
max/frame-packet-trailer

Conversation

@MaxHeimbrock
Copy link
Copy Markdown
Contributor

@MaxHeimbrock MaxHeimbrock commented May 19, 2026

Summary

Surfaces the Rust FFI Frame Packet Trailer feature on the Unity SDK so apps can attach FrameMetadata (user_timestamp, frame_id) to outgoing video frames and read it off incoming ones — matching the Python SDK.

  • SDK: RtcVideoSource.MetadataProvider populates CaptureVideoFrameRequest.Metadata per outgoing frame; VideoFrame.Metadata exposes the received trailer on VideoStream.FrameReceived.
  • Helper: TrackPublishOptionsExtensions.WithPacketTrailerFeatures(...) lets a Unity project's default Assembly-CSharp set PacketTrailerFeatures without referencing Google.Protobuf directly (the plugin is isExplicitlyReferenced, deliberately).
  • Sample: Meet attaches a monotonic frame_id + UnixTimeUs user_timestamp to outgoing camera frames and logs received trailer values (throttled to ~1s per stream) in the console / on-screen ScrollingLog.
  • Test: New PlayMode E2E test VideoFrameMetadataTests that publishes with both trailer features enabled, pushes frames with known metadata, and asserts the subscriber sees matching frame_id / user_timestamp.

Test plan

  • dotnet build of LiveKit Runtime, PlayModeTests, and Meet Assembly-CSharp — clean.
  • PlayMode E2E test passes against a local livekit-server --dev.
  • Meet sample: connect two clients, confirm the console shows [Meet RX <peer>] frame_id=… user_ts=… ~1×/sec per remote stream and the outgoing frame_id increases monotonically.

🤖 Generated with Claude Code

MaxHeimbrock and others added 3 commits May 19, 2026 17:36
Surfaces the Rust FFI Frame Packet Trailer feature in the Unity SDK:
attach FrameMetadata (user_timestamp, frame_id) to outgoing frames via
RtcVideoSource.MetadataProvider, and read it off VideoFrame.Metadata on
received frames. PacketTrailerFeatures on TrackPublishOptions is already
proto-passthrough so no wrapper change is needed there.

Adds a PlayMode E2E test that publishes with both packet-trailer features
enabled, attaches known metadata to outgoing frames, and asserts the
subscriber sees matching frame_id and user_timestamp.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Provides a Google.Protobuf-free entry point for enabling packet trailer
features on TrackPublishOptions. Required because the LiveKit SDK ships
Google.Protobuf.dll as an explicitly-referenced plugin (deliberate, to
avoid conflicts with com.unity.ai.assistant), so a Unity project's
default Assembly-CSharp cannot use the proto's repeated-field collection
initializer or call .Add on PacketTrailerFeatures directly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Publishes the local camera with PTF_USER_TIMESTAMP and PTF_FRAME_ID
packet trailers and attaches a monotonic frame_id plus UnixTimeUs
user_timestamp to each outgoing frame via the new MetadataProvider hook.

Logs received trailer values (throttled to ~1 second per stream) for
both main and extra-video tiles, so the Unity console / on-screen
ScrollingLog shows the metadata round-tripping from remote publishers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MaxHeimbrock MaxHeimbrock marked this pull request as draft May 19, 2026 15:51
MaxHeimbrock and others added 2 commits May 20, 2026 10:18
…oSource

Single test helper with a pushFrames flag covers both modes: signaling-only
publication propagation (default) and continuous media flow for round-trip
tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MaxHeimbrock MaxHeimbrock marked this pull request as ready for review May 20, 2026 08:50
@MaxHeimbrock MaxHeimbrock requested a review from ladvoc May 20, 2026 08:50
Comment thread Runtime/Scripts/Participant.cs
Copy link
Copy Markdown
Contributor

@ladvoc ladvoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

@MaxHeimbrock MaxHeimbrock merged commit a4223c7 into main May 21, 2026
15 checks passed
@MaxHeimbrock MaxHeimbrock deleted the max/frame-packet-trailer branch May 21, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants