Skip to content

Commit

Permalink
ffi: force VideoEncoding bitrate and framerate (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbsp authored Aug 23, 2024
1 parent 0465fec commit 6816a32
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion livekit-ffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "livekit-ffi"
version = "0.8.1"
version = "0.8.2"
edition = "2021"
license = "Apache-2.0"
description = "FFI interface for bindings in other languages"
Expand Down
10 changes: 10 additions & 0 deletions livekit-ffi/src/server/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,16 @@ impl RoomInner {
let track = LocalTrack::try_from(ffi_track.track.clone())
.map_err(|_| FfiError::InvalidRequest("track is not a LocalTrack".into()))?;

// protobuf 3 doesn't let us require fields, instead defaulting to zero.
if publish.options.clone().is_some_and(|opts| {
opts.video_encoding
.is_some_and(|enc| enc.max_framerate == 0.0 || enc.max_bitrate == 0)
}) {
return Err(FfiError::InvalidRequest(
"VideoEncoding must specify both max_framerate and max_bitrate".into(),
));
}

let publication = inner
.room
.local_participant()
Expand Down

0 comments on commit 6816a32

Please sign in to comment.