Skip to content

Commit 289b036

Browse files
authored
Add option to enable audio preconnect buffer in SDK & FFI (#700)
* add preconnect buffer option to ffi room proto * set AudioTrackFeatures on AddTrackRequest * add preconect to conversion from proto to TrackPublishOptions
1 parent 553047a commit 289b036

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

livekit-ffi/protocol/room.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ message TrackPublishOptions {
261261
optional bool simulcast = 6;
262262
optional TrackSource source = 7;
263263
optional string stream = 8;
264+
optional bool preconnect_buffer = 9;
264265
}
265266

266267
enum IceTransportType {

livekit-ffi/src/conversion/room.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ impl From<proto::TrackPublishOptions> for TrackPublishOptions {
232232
red: opts.red.unwrap_or(default_publish_options.red),
233233
simulcast: opts.simulcast.unwrap_or(default_publish_options.simulcast),
234234
stream: opts.stream.unwrap_or(default_publish_options.stream),
235+
preconnect_buffer: opts
236+
.preconnect_buffer
237+
.unwrap_or(default_publish_options.preconnect_buffer),
235238
}
236239
}
237240
}

livekit-ffi/src/livekit.proto.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3256,6 +3256,8 @@ pub struct TrackPublishOptions {
32563256
pub source: ::core::option::Option<i32>,
32573257
#[prost(string, optional, tag="8")]
32583258
pub stream: ::core::option::Option<::prost::alloc::string::String>,
3259+
#[prost(bool, optional, tag="9")]
3260+
pub preconnect_buffer: ::core::option::Option<bool>,
32593261
}
32603262
#[allow(clippy::derive_partial_eq_without_eq)]
32613263
#[derive(Clone, PartialEq, ::prost::Message)]

livekit/src/room/options.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ pub struct TrackPublishOptions {
8585
// pub name: String,
8686
pub source: TrackSource,
8787
pub stream: String,
88+
pub preconnect_buffer: bool,
8889
}
8990

9091
impl Default for TrackPublishOptions {
@@ -98,6 +99,7 @@ impl Default for TrackPublishOptions {
9899
simulcast: true,
99100
source: TrackSource::Unknown,
100101
stream: "".to_string(),
102+
preconnect_buffer: false,
101103
}
102104
}
103105
}

livekit/src/room/participant/local_participant.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ impl LocalParticipant {
245245
..Default::default()
246246
};
247247

248+
if options.preconnect_buffer {
249+
req.audio_features.push(proto::AudioTrackFeature::TfPreconnectBuffer as i32);
250+
}
251+
248252
let mut encodings = Vec::default();
249253
match &track {
250254
LocalTrack::Video(video_track) => {

0 commit comments

Comments
 (0)