Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client-sdk-rust
17 changes: 17 additions & 0 deletions include/livekit/room_event_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,19 @@ struct AudioEncodingOptions {
std::uint64_t max_bitrate = 0;
};

/// Controls how the encoder degrades quality when bandwidth is constrained.
enum class DegradationPreference {
/// Balance between framerate and resolution degradation.
Balanced = 0,
/// Degrade resolution to maintain framerate (prioritize smooth motion).
MaintainFramerate = 1,
/// Degrade framerate to maintain resolution (prioritize image clarity).
MaintainResolution = 2,
/// Maintain both framerate and resolution. Frames may be dropped before
/// encoding if necessary to avoid overusing network and encoder resources.
MaintainFramerateAndResolution = 4,
};

/// Optional RTP packet-trailer features for published video tracks.
struct PacketTrailerFeatures {
/// Embed a user-supplied wall-clock timestamp.
Expand Down Expand Up @@ -313,6 +326,10 @@ struct TrackPublishOptions {

/// Optional packet-trailer features to enable for published video.
PacketTrailerFeatures packet_trailer_features{};

/// Controls how the encoder trades off between resolution and framerate
/// when bandwidth is constrained. Default is MaintainResolution.
std::optional<DegradationPreference> degradation_preference;
};

// ---------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions src/room_proto_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
return std::string(reinterpret_cast<const char*>(bytes.data()), bytes.size());
}

std::vector<proto::PacketTrailerFeature> toProto(const PacketTrailerFeatures& features) {

Check failure on line 31 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / C++ Checks / clang-tidy

clang-tidy (clang-diagnostic-error)

no member named 'PacketTrailerFeature' in namespace 'livekit::proto'

Check failure on line 31 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Tests / Test (windows-x64)

'livekit::`anonymous-namespace'::toProto' uses undefined class 'std::vector' [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 31 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Tests / Test (windows-x64)

'std::vector': use of class template requires template argument list [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 31 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Tests / Test (windows-x64)

'std::vector': too few template arguments [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 31 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Tests / Test (windows-x64)

'std::vector': 'PacketTrailerFeature' is not a valid template type argument for parameter '_Ty' [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 31 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Tests / Test (windows-x64)

'PacketTrailerFeature': undeclared identifier [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 31 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Tests / Test (windows-x64)

'PacketTrailerFeature': is not a member of 'livekit::proto' [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 31 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Builds / Build (windows-x64)

'livekit::`anonymous-namespace'::toProto' uses undefined class 'std::vector' [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 31 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Builds / Build (windows-x64)

'std::vector': use of class template requires template argument list [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 31 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Builds / Build (windows-x64)

'std::vector': too few template arguments [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 31 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Builds / Build (windows-x64)

'std::vector': 'PacketTrailerFeature' is not a valid template type argument for parameter '_Ty' [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 31 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Builds / Build (windows-x64)

'PacketTrailerFeature': undeclared identifier [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 31 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Builds / Build (windows-x64)

'PacketTrailerFeature': is not a member of 'livekit::proto' [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]
std::vector<proto::PacketTrailerFeature> out;

Check failure on line 32 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / C++ Checks / clang-tidy

clang-tidy (clang-diagnostic-error)

no member named 'PacketTrailerFeature' in namespace 'livekit::proto'

Check failure on line 32 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Tests / Test (windows-x64)

'std::vector': too few template arguments [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 32 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Tests / Test (windows-x64)

'std::vector': 'PacketTrailerFeature' is not a valid template type argument for parameter '_Ty' [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 32 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Tests / Test (windows-x64)

'PacketTrailerFeature': undeclared identifier [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 32 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Tests / Test (windows-x64)

'PacketTrailerFeature': is not a member of 'livekit::proto' [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 32 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Builds / Build (windows-x64)

'std::vector': too few template arguments [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 32 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Builds / Build (windows-x64)

'std::vector': 'PacketTrailerFeature' is not a valid template type argument for parameter '_Ty' [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 32 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Builds / Build (windows-x64)

'PacketTrailerFeature': undeclared identifier [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]

Check failure on line 32 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / Builds / Build (windows-x64)

'PacketTrailerFeature': is not a member of 'livekit::proto' [D:\a\client-sdk-cpp\client-sdk-cpp\build-release\livekit.vcxproj]
out.reserve(2);
if (features.user_timestamp) {
out.push_back(proto::PacketTrailerFeature::PTF_USER_TIMESTAMP);

Check failure on line 35 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / C++ Checks / clang-tidy

clang-tidy (clang-diagnostic-error)

no member named 'PacketTrailerFeature' in namespace 'livekit::proto'; did you mean 'PacketTrailerFeatures'?

Check failure on line 35 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / C++ Checks / clang-tidy

clang-tidy (clang-diagnostic-error)

no member named 'PTF_USER_TIMESTAMP' in 'livekit::PacketTrailerFeatures'; did you mean 'proto::FMF_USER_TIMESTAMP'?
}
if (features.frame_id) {
out.push_back(proto::PacketTrailerFeature::PTF_FRAME_ID);

Check failure on line 38 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / C++ Checks / clang-tidy

clang-tidy (clang-diagnostic-error)

no member named 'PacketTrailerFeature' in namespace 'livekit::proto'; did you mean 'PacketTrailerFeatures'?

Check failure on line 38 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / C++ Checks / clang-tidy

clang-tidy (clang-diagnostic-error)

no member named 'PTF_FRAME_ID' in 'livekit::PacketTrailerFeatures'; did you mean 'proto::FMF_FRAME_ID'?
}
return out;
}
Expand All @@ -44,10 +44,10 @@
PacketTrailerFeatures out{};
for (const int feature : features) {
switch (feature) {
case proto::PacketTrailerFeature::PTF_USER_TIMESTAMP:

Check failure on line 47 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / C++ Checks / clang-tidy

clang-tidy (clang-diagnostic-error)

no member named 'PacketTrailerFeature' in namespace 'livekit::proto'; did you mean 'PacketTrailerFeatures'?

Check failure on line 47 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / C++ Checks / clang-tidy

clang-tidy (clang-diagnostic-error)

no member named 'PTF_USER_TIMESTAMP' in 'livekit::PacketTrailerFeatures'; did you mean 'proto::FMF_USER_TIMESTAMP'?
out.user_timestamp = true;
break;
case proto::PacketTrailerFeature::PTF_FRAME_ID:

Check failure on line 50 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / C++ Checks / clang-tidy

clang-tidy (clang-diagnostic-error)

no member named 'PacketTrailerFeature' in namespace 'livekit::proto'; did you mean 'PacketTrailerFeatures'?

Check failure on line 50 in src/room_proto_converter.cpp

View workflow job for this annotation

GitHub Actions / C++ Checks / clang-tidy

clang-tidy (clang-diagnostic-error)

no member named 'PTF_FRAME_ID' in 'livekit::PacketTrailerFeatures'; did you mean 'proto::FMF_FRAME_ID'?
out.frame_id = true;
break;
default:
Expand Down Expand Up @@ -505,6 +505,9 @@
for (const proto::PacketTrailerFeature feature : toProto(in.packet_trailer_features)) {
msg.add_packet_trailer_features(feature);
}
if (in.degradation_preference) {
msg.set_degradation_preference(static_cast<proto::DegradationPreference>(*in.degradation_preference));
}
return msg;
}

Expand Down Expand Up @@ -538,6 +541,9 @@
out.preconnect_buffer = in.preconnect_buffer();
}
out.packet_trailer_features = fromProto(in.packet_trailer_features());
if (in.has_degradation_preference()) {
out.degradation_preference = static_cast<DegradationPreference>(in.degradation_preference());
}
return out;
}

Expand Down
Loading