-
Notifications
You must be signed in to change notification settings - Fork 32
Data track schema metadata #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ladvoc
wants to merge
16
commits into
main
Choose a base branch
from
ladvoc/schema-metadata
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
627f48b
Pin rust-sdks
ladvoc 92cbf56
Expose schema metadata
ladvoc a25cd4e
E2E test
ladvoc 586ca82
Expose new data track fields
ladvoc b7d7ec1
Test publish with schema and frame encoding
ladvoc 17a3b46
Pin rust-sdks
ladvoc 4d41fc7
Support custom encodings
ladvoc ec277f6
Fixes to local build
alan-george-lk c8812f0
Merge branch 'main' of github.com:livekit/client-sdk-cpp into ladvoc/…
alan-george-lk 23bcd0e
Fixing CI issues
alan-george-lk 7d1c4fd
Point e2e tests at livekit/dev-server-action version pin PR.
alan-george-lk ea2641f
Update dev-server-action pin for source builds.
alan-george-lk ea4ca54
Try latest dev-server-action
alan-george-lk 053ecb8
Try latest version just in case
alan-george-lk 93c4041
Merge branch 'main' of github.com:livekit/client-sdk-cpp into ladvoc/…
alan-george-lk c137684
Use latest dev-server-action tag
alan-george-lk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule client-sdk-rust
updated
from dad794 to 51a3ad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /* | ||
| * Copyright 2026 LiveKit | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <optional> | ||
| #include <string> | ||
|
|
||
| #include "livekit/data_track_schema.h" | ||
|
|
||
| namespace livekit { | ||
|
|
||
| /** | ||
| * Options for publishing a data track. | ||
| * | ||
| * The schema and frame encoding are optional metadata advertised to | ||
| * subscribers; they are surfaced on the subscriber side via DataTrackInfo. | ||
| */ | ||
| struct DataTrackPublishOptions { | ||
| /// Track name used to identify the track to other participants. | ||
| /// | ||
| /// Must not be empty and must be unique per publisher. | ||
| std::string name; | ||
|
|
||
| /// Schema describing frames sent on the track, if any. | ||
| std::optional<DataTrackSchemaId> schema; | ||
|
|
||
| /// Encoding of frames sent on the track, if any. | ||
| std::optional<DataTrackFrameEncoding> frame_encoding; | ||
| }; | ||
|
|
||
| } // namespace livekit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,189 @@ | ||
| /* | ||
| * Copyright 2026 LiveKit | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <string> | ||
| #include <utility> | ||
|
|
||
| namespace livekit { | ||
|
|
||
| /** | ||
| * Encoding used to interpret a data track schema definition. | ||
| * | ||
| * Identifies the interface definition language the schema is written in (e.g. a | ||
| * `.proto` file for \ref DataTrackSchemaEncoding::Protobuf), which in turn | ||
| * dictates the wire format of the frames the schema describes. | ||
| * | ||
| * Almost all schemas use a well-known encoding, which converts implicitly: | ||
| * \code | ||
| * DataTrackSchemaEncoding encoding = DataTrackSchemaEncoding::Protobuf; | ||
| * \endcode | ||
| * For the uncommon case of an encoding outside the well-known set, use | ||
| * \ref DataTrackSchemaEncoding::custom. | ||
| */ | ||
| class DataTrackSchemaEncoding { | ||
| public: | ||
| /** Well-known schema encodings. */ | ||
| enum WellKnown { | ||
| /** Protocol Buffer IDL. */ | ||
| Protobuf, | ||
| /** FlatBuffer IDL. */ | ||
| Flatbuffer, | ||
| /** ROS 1 Message. */ | ||
| Ros1Msg, | ||
| /** ROS 2 Message. */ | ||
| Ros2Msg, | ||
| /** ROS 2 IDL. */ | ||
| Ros2Idl, | ||
| /** OMG IDL. */ | ||
| OmgIdl, | ||
| /** JSON Schema. */ | ||
| JsonSchema, | ||
| /** Another well-known encoding not known to this client version. */ | ||
| Other, | ||
| }; | ||
|
|
||
| /** Constructs a well-known encoding. Implicit by design, for the common case. */ | ||
| DataTrackSchemaEncoding(WellKnown wellKnown) : well_known_(wellKnown) {} | ||
|
|
||
| /** | ||
| * Constructs a custom, application-defined encoding. | ||
| * | ||
| * Prefer a well-known encoding wherever one applies. The identifier must be | ||
| * non-empty and no longer than 25 characters. | ||
| */ | ||
| static DataTrackSchemaEncoding custom(std::string identifier) { | ||
| DataTrackSchemaEncoding encoding; | ||
| encoding.custom_ = std::move(identifier); | ||
| return encoding; | ||
| } | ||
|
|
||
| /** Whether this is a custom encoding rather than a well-known one. */ | ||
| bool isCustom() const { return !custom_.empty(); } | ||
|
|
||
| /** The well-known encoding. Only meaningful when \ref isCustom is false. */ | ||
| WellKnown wellKnown() const { return well_known_; } | ||
|
|
||
| /** The custom identifier. Empty when \ref isCustom is false. */ | ||
| const std::string& customIdentifier() const { return custom_; } | ||
|
|
||
| private: | ||
| DataTrackSchemaEncoding() = default; | ||
|
|
||
| WellKnown well_known_ = Other; | ||
| std::string custom_; | ||
| }; | ||
|
|
||
| inline bool operator==(const DataTrackSchemaEncoding& a, const DataTrackSchemaEncoding& b) { | ||
| if (a.isCustom() || b.isCustom()) { | ||
| return a.customIdentifier() == b.customIdentifier(); | ||
| } | ||
| return a.wellKnown() == b.wellKnown(); | ||
| } | ||
| inline bool operator!=(const DataTrackSchemaEncoding& a, const DataTrackSchemaEncoding& b) { return !(a == b); } | ||
|
|
||
| /** | ||
| * Encoding used for frames sent on a data track. | ||
| * | ||
| * The serialization format of the frame bytes (e.g. | ||
| * \ref DataTrackFrameEncoding::Protobuf); the structure of those bytes is | ||
| * described by a schema (see \ref DataTrackSchemaEncoding). | ||
| * | ||
| * Almost all tracks use a well-known encoding, which converts implicitly: | ||
| * \code | ||
| * options.frame_encoding = DataTrackFrameEncoding::Json; | ||
| * \endcode | ||
| * For the uncommon case of an encoding outside the well-known set, use | ||
| * \ref DataTrackFrameEncoding::custom. | ||
| */ | ||
| class DataTrackFrameEncoding { | ||
| public: | ||
| /** Well-known frame encodings. */ | ||
| enum WellKnown { | ||
| /** ROS 1, described by a Ros1Msg schema. */ | ||
| Ros1, | ||
| /** CDR, described by a Ros2Msg, Ros2Idl, or OmgIdl schema. */ | ||
| Cdr, | ||
| /** Protocol Buffer, described by a Protobuf schema. */ | ||
| Protobuf, | ||
| /** FlatBuffer, described by a Flatbuffer schema. */ | ||
| Flatbuffer, | ||
| /** CBOR, self-describing. */ | ||
| Cbor, | ||
| /** MessagePack, self-describing. */ | ||
| Msgpack, | ||
| /** JSON, self-describing or described by a JsonSchema schema. */ | ||
| Json, | ||
| /** Another well-known encoding not known to this client version. */ | ||
| Other, | ||
| }; | ||
|
|
||
| /** Constructs a well-known encoding. Implicit by design, for the common case. */ | ||
| DataTrackFrameEncoding(WellKnown wellKnown) : well_known_(wellKnown) {} | ||
|
|
||
| /** | ||
| * Constructs a custom, application-defined encoding. | ||
| * | ||
| * Prefer a well-known encoding wherever one applies. The identifier must be | ||
| * non-empty and no longer than 25 characters. | ||
| */ | ||
| static DataTrackFrameEncoding custom(std::string identifier) { | ||
| DataTrackFrameEncoding encoding; | ||
| encoding.custom_ = std::move(identifier); | ||
| return encoding; | ||
| } | ||
|
|
||
| /** Whether this is a custom encoding rather than a well-known one. */ | ||
| bool isCustom() const { return !custom_.empty(); } | ||
|
|
||
| /** The well-known encoding. Only meaningful when \ref isCustom is false. */ | ||
| WellKnown wellKnown() const { return well_known_; } | ||
|
|
||
| /** The custom identifier. Empty when \ref isCustom is false. */ | ||
| const std::string& customIdentifier() const { return custom_; } | ||
|
|
||
| private: | ||
| DataTrackFrameEncoding() = default; | ||
|
|
||
| WellKnown well_known_ = Other; | ||
| std::string custom_; | ||
| }; | ||
|
|
||
| inline bool operator==(const DataTrackFrameEncoding& a, const DataTrackFrameEncoding& b) { | ||
| if (a.isCustom() || b.isCustom()) { | ||
| return a.customIdentifier() == b.customIdentifier(); | ||
| } | ||
| return a.wellKnown() == b.wellKnown(); | ||
| } | ||
| inline bool operator!=(const DataTrackFrameEncoding& a, const DataTrackFrameEncoding& b) { return !(a == b); } | ||
|
|
||
| /** | ||
| * Uniquely identifies a data track schema. | ||
| * | ||
| * A compound identifier with two components: a name and an encoding. Two IDs are | ||
| * equal only if both components match; the same name with a different encoding | ||
| * refers to a distinct schema. | ||
| */ | ||
| struct DataTrackSchemaId { | ||
| /** Name component of the schema identifier. */ | ||
| std::string name; | ||
|
|
||
| /** Encoding of the schema definition. */ | ||
| DataTrackSchemaEncoding encoding = DataTrackSchemaEncoding::Other; | ||
| }; | ||
|
|
||
| } // namespace livekit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /* | ||
| * Copyright 2026 LiveKit | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "data_track.pb.h" | ||
| #include "livekit/data_track_info.h" | ||
| #include "livekit/data_track_schema.h" | ||
|
|
||
| namespace livekit { | ||
|
|
||
| proto::DataTrackSchemaEncoding toProto(const DataTrackSchemaEncoding& in); | ||
| DataTrackSchemaEncoding fromProto(const proto::DataTrackSchemaEncoding& in); | ||
|
|
||
| proto::DataTrackFrameEncoding toProto(const DataTrackFrameEncoding& in); | ||
| DataTrackFrameEncoding fromProto(const proto::DataTrackFrameEncoding& in); | ||
|
|
||
| proto::DataTrackSchemaId toProto(const DataTrackSchemaId& in); | ||
| DataTrackSchemaId fromProto(const proto::DataTrackSchemaId& in); | ||
|
|
||
| // Converts an FFI data track info message into the public DataTrackInfo struct. | ||
| DataTrackInfo fromProto(const proto::DataTrackInfo& in); | ||
|
|
||
| } // namespace livekit |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Holding off on merging until this is a full release