-
Notifications
You must be signed in to change notification settings - Fork 33
Data track schema metadata #214
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
Merged
Merged
Changes from 22 commits
Commits
Show all changes
31 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 b199b35
Merge branch 'main' of github.com:livekit/client-sdk-cpp into ladvoc/…
alan-george-lk e8c358e
API doc cleanup/latest Rust version/new tests
alan-george-lk 6a569bf
Cleanup doxgen
alan-george-lk 1f25c0f
Use rebased rust sdk
alan-george-lk 74d55ca
Merge branch 'main' of github.com:livekit/client-sdk-cpp into feature…
alan-george-lk 80e91b1
Dont publish docs on prerelease
alan-george-lk 169174e
Potential fix for pull request finding 'CodeQL / Workflow does not co…
alan-george-lk e560df9
Merge branch 'main' of github.com:livekit/client-sdk-cpp into feature…
alan-george-lk 4c62bfe
Add error types
alan-george-lk d384bce
Merge branch 'main' of github.com:livekit/client-sdk-cpp into feature…
alan-george-lk 3f24f0f
Bump to rust release, add invalid schema option
alan-george-lk d3c2bdb
Merge branch 'main' of github.com:livekit/client-sdk-cpp into feature…
alan-george-lk f67952d
Fix devin AI comment
alan-george-lk 781d6a5
Fix missing doc comment
alan-george-lk a496a73
Remove [[nodiscard]], undo comment change
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
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 da3ee0 to 02dcf5
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,43 @@ | ||
| /* | ||
| * 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. | ||
|
alan-george-lk marked this conversation as resolved.
Outdated
|
||
| /// | ||
| /// 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,206 @@ | ||
| /* | ||
| * 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. | ||
|
alan-george-lk marked this conversation as resolved.
Outdated
|
||
| /// | ||
| /// Identifies the interface definition language the schema is written in (for | ||
| /// example, 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, | ||
| }; | ||
|
|
||
| /// Construct a well-known encoding. | ||
| /// | ||
| /// The constructor is intentionally implicit for the common well-known case. | ||
| DataTrackSchemaEncoding(WellKnown wellKnown) : well_known_(wellKnown) {} | ||
|
alan-george-lk marked this conversation as resolved.
Outdated
|
||
|
|
||
| /// Construct 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. | ||
| /// | ||
| /// @param identifier Custom encoding identifier. | ||
| /// @return Custom schema encoding. | ||
| static DataTrackSchemaEncoding custom(std::string identifier) { | ||
| DataTrackSchemaEncoding encoding; | ||
| encoding.custom_ = std::move(identifier); | ||
| return encoding; | ||
| } | ||
|
|
||
| /// Check whether this is a custom encoding. | ||
| /// | ||
| /// @return true if this is a custom encoding rather than a well-known one. | ||
| bool isCustom() const { return !custom_.empty(); } | ||
|
|
||
| /// Get the well-known encoding. | ||
| /// | ||
| /// @return The well-known encoding. Only meaningful when @ref isCustom is false. | ||
| WellKnown wellKnown() const { return well_known_; } | ||
|
|
||
| /// Get the custom identifier. | ||
| /// | ||
| /// @return 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. | ||
|
alan-george-lk marked this conversation as resolved.
Outdated
|
||
| /// | ||
| /// The serialization format of the frame bytes (for example, | ||
| /// @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, | ||
| }; | ||
|
|
||
| /// Construct a well-known encoding. | ||
| /// | ||
| /// The constructor is intentionally implicit for the common well-known case. | ||
| DataTrackFrameEncoding(WellKnown wellKnown) : well_known_(wellKnown) {} | ||
|
alan-george-lk marked this conversation as resolved.
Outdated
|
||
|
|
||
| /// Construct 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. | ||
| /// | ||
| /// @param identifier Custom encoding identifier. | ||
| /// @return Custom frame encoding. | ||
| static DataTrackFrameEncoding custom(std::string identifier) { | ||
| DataTrackFrameEncoding encoding; | ||
| encoding.custom_ = std::move(identifier); | ||
| return encoding; | ||
| } | ||
|
|
||
| /// Check whether this is a custom encoding. | ||
| /// | ||
| /// @return true if this is a custom encoding rather than a well-known one. | ||
| bool isCustom() const { return !custom_.empty(); } | ||
|
|
||
| /// Get the well-known encoding. | ||
| /// | ||
| /// @return The well-known encoding. Only meaningful when @ref isCustom is false. | ||
| WellKnown wellKnown() const { return well_known_; } | ||
|
|
||
| /// Get the custom identifier. | ||
| /// | ||
| /// @return 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. | ||
|
alan-george-lk marked this conversation as resolved.
Outdated
|
||
| /// | ||
| /// 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; | ||
| }; | ||
|
|
||
| inline bool operator==(const DataTrackSchemaId& a, const DataTrackSchemaId& b) { | ||
| return a.name == b.name && a.encoding == b.encoding; | ||
| } | ||
| inline bool operator!=(const DataTrackSchemaId& a, const DataTrackSchemaId& b) { return !(a == b); } | ||
|
|
||
| } // 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.
Uh oh!
There was an error while loading. Please reload this page.