Skip to content

Commit de3a3e1

Browse files
authored
Bump protocol to v1.37.1 and add audio_features handling (#634)
1 parent 0773bce commit de3a3e1

File tree

20 files changed

+2303
-266
lines changed

20 files changed

+2303
-266
lines changed

livekit-api/src/services/egress.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ impl EgressClient {
153153
image_outputs,
154154
output: None, // Deprecated
155155
await_start_signal: options.await_start_signal,
156+
..Default::default()
156157
},
157158
self.base
158159
.auth_header(VideoGrants { room_record: true, ..Default::default() }, None)?,
@@ -184,6 +185,7 @@ impl EgressClient {
184185
stream_outputs,
185186
segment_outputs,
186187
image_outputs,
188+
..Default::default()
187189
},
188190
self.base
189191
.auth_header(VideoGrants { room_record: true, ..Default::default() }, None)?,
@@ -215,6 +217,7 @@ impl EgressClient {
215217
segment_outputs,
216218
image_outputs,
217219
output: None, // Deprecated
220+
..Default::default()
218221
},
219222
self.base
220223
.auth_header(VideoGrants { room_record: true, ..Default::default() }, None)?,
@@ -244,6 +247,7 @@ impl EgressClient {
244247
}
245248
},
246249
track_id: track_id.to_string(),
250+
..Default::default()
247251
},
248252
self.base
249253
.auth_header(VideoGrants { room_record: true, ..Default::default() }, None)?,

livekit-api/src/services/sip.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,7 @@ impl SIPClient {
354354
hide_phone_number: options.hide_phone_number,
355355
rule: Some(proto::SipDispatchRule { rule: Some(rule.to_owned()) }),
356356

357-
// TODO: support these attributes
358-
room_preset: Default::default(),
359-
room_config: Default::default(),
357+
..Default::default()
360358
},
361359
self.base.auth_header(
362360
Default::default(),

livekit-ffi/protocol/participant.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,5 @@ enum DisconnectReason {
7070
USER_REJECTED = 12;
7171
// SIP protocol failure or unexpected response
7272
SIP_TRUNK_FAILURE = 13;
73+
CONNECTION_TIMEOUT = 14;
7374
}

livekit-ffi/protocol/track.proto

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ message TrackPublicationInfo {
8989
required bool muted = 9;
9090
required bool remote = 10;
9191
required EncryptionType encryption_type = 11;
92+
repeated AudioTrackFeature audio_features = 12;
9293
}
9394

9495
message OwnedTrackPublication {
@@ -147,3 +148,13 @@ message ParticipantTrackPermission {
147148

148149
message SetTrackSubscriptionPermissionsResponse {
149150
}
151+
152+
enum AudioTrackFeature {
153+
TF_STEREO = 0;
154+
TF_NO_DTX = 1;
155+
TF_AUTO_GAIN_CONTROL = 2;
156+
TF_ECHO_CANCELLATION = 3;
157+
TF_NOISE_SUPPRESSION = 4;
158+
TF_ENHANCED_NOISE_CANCELLATION = 5;
159+
TF_PRECONNECT_BUFFER = 6; // client will buffer audio once available and send it to the server via bytes stream once connected
160+
}

livekit-ffi/src/conversion/participant.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ impl From<DisconnectReason> for proto::DisconnectReason {
6161
DisconnectReason::UserUnavailable => proto::DisconnectReason::UserUnavailable,
6262
DisconnectReason::UserRejected => proto::DisconnectReason::UserRejected,
6363
DisconnectReason::SipTrunkFailure => proto::DisconnectReason::SipTrunkFailure,
64+
DisconnectReason::ConnectionTimeout => proto::DisconnectReason::ConnectionTimeout,
6465
}
6566
}
6667
}

livekit-ffi/src/conversion/room.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ impl From<DisconnectReason> for proto::DisconnectReason {
9898
DisconnectReason::UserUnavailable => Self::UserUnavailable,
9999
DisconnectReason::UserRejected => Self::UserRejected,
100100
DisconnectReason::SipTrunkFailure => Self::SipTrunkFailure,
101+
DisconnectReason::ConnectionTimeout => Self::ConnectionTimeout,
101102
}
102103
}
103104
}

livekit-ffi/src/conversion/track.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ impl From<&FfiPublication> for proto::TrackPublicationInfo {
3434
muted: publication.is_muted(),
3535
remote: publication.is_remote(),
3636
encryption_type: proto::EncryptionType::from(publication.encryption_type()).into(),
37+
audio_features: publication
38+
.audio_features()
39+
.into_iter()
40+
.map(|i| proto::AudioTrackFeature::from(i).into())
41+
.collect(),
3742
}
3843
}
3944
}
@@ -121,3 +126,35 @@ impl From<proto::ParticipantTrackPermission> for ParticipantTrackPermission {
121126
}
122127
}
123128
}
129+
130+
impl From<proto::AudioTrackFeature> for AudioTrackFeature {
131+
fn from(value: proto::AudioTrackFeature) -> Self {
132+
match value {
133+
proto::AudioTrackFeature::TfStereo => AudioTrackFeature::TfStereo,
134+
proto::AudioTrackFeature::TfNoDtx => AudioTrackFeature::TfNoDtx,
135+
proto::AudioTrackFeature::TfAutoGainControl => AudioTrackFeature::TfAutoGainControl,
136+
proto::AudioTrackFeature::TfEchoCancellation => AudioTrackFeature::TfEchoCancellation,
137+
proto::AudioTrackFeature::TfNoiseSuppression => AudioTrackFeature::TfNoiseSuppression,
138+
proto::AudioTrackFeature::TfEnhancedNoiseCancellation => {
139+
AudioTrackFeature::TfEnhancedNoiseCancellation
140+
}
141+
proto::AudioTrackFeature::TfPreconnectBuffer => AudioTrackFeature::TfPreconnectBuffer,
142+
}
143+
}
144+
}
145+
146+
impl From<AudioTrackFeature> for proto::AudioTrackFeature {
147+
fn from(value: AudioTrackFeature) -> Self {
148+
match value {
149+
AudioTrackFeature::TfStereo => proto::AudioTrackFeature::TfStereo,
150+
AudioTrackFeature::TfNoDtx => proto::AudioTrackFeature::TfNoDtx,
151+
AudioTrackFeature::TfAutoGainControl => proto::AudioTrackFeature::TfAutoGainControl,
152+
AudioTrackFeature::TfEchoCancellation => proto::AudioTrackFeature::TfEchoCancellation,
153+
AudioTrackFeature::TfNoiseSuppression => proto::AudioTrackFeature::TfNoiseSuppression,
154+
AudioTrackFeature::TfEnhancedNoiseCancellation => {
155+
proto::AudioTrackFeature::TfEnhancedNoiseCancellation
156+
}
157+
AudioTrackFeature::TfPreconnectBuffer => proto::AudioTrackFeature::TfPreconnectBuffer,
158+
}
159+
}
160+
}

livekit-ffi/src/livekit.proto.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,6 +1392,8 @@ pub struct TrackPublicationInfo {
13921392
pub remote: bool,
13931393
#[prost(enumeration="EncryptionType", required, tag="11")]
13941394
pub encryption_type: i32,
1395+
#[prost(enumeration="AudioTrackFeature", repeated, packed="false", tag="12")]
1396+
pub audio_features: ::prost::alloc::vec::Vec<i32>,
13951397
}
13961398
#[allow(clippy::derive_partial_eq_without_eq)]
13971399
#[derive(Clone, PartialEq, ::prost::Message)]
@@ -1575,6 +1577,48 @@ impl StreamState {
15751577
}
15761578
}
15771579
}
1580+
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1581+
#[repr(i32)]
1582+
pub enum AudioTrackFeature {
1583+
TfStereo = 0,
1584+
TfNoDtx = 1,
1585+
TfAutoGainControl = 2,
1586+
TfEchoCancellation = 3,
1587+
TfNoiseSuppression = 4,
1588+
TfEnhancedNoiseCancellation = 5,
1589+
/// client will buffer audio once available and send it to the server via bytes stream once connected
1590+
TfPreconnectBuffer = 6,
1591+
}
1592+
impl AudioTrackFeature {
1593+
/// String value of the enum field names used in the ProtoBuf definition.
1594+
///
1595+
/// The values are not transformed in any way and thus are considered stable
1596+
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
1597+
pub fn as_str_name(&self) -> &'static str {
1598+
match self {
1599+
AudioTrackFeature::TfStereo => "TF_STEREO",
1600+
AudioTrackFeature::TfNoDtx => "TF_NO_DTX",
1601+
AudioTrackFeature::TfAutoGainControl => "TF_AUTO_GAIN_CONTROL",
1602+
AudioTrackFeature::TfEchoCancellation => "TF_ECHO_CANCELLATION",
1603+
AudioTrackFeature::TfNoiseSuppression => "TF_NOISE_SUPPRESSION",
1604+
AudioTrackFeature::TfEnhancedNoiseCancellation => "TF_ENHANCED_NOISE_CANCELLATION",
1605+
AudioTrackFeature::TfPreconnectBuffer => "TF_PRECONNECT_BUFFER",
1606+
}
1607+
}
1608+
/// Creates an enum from field names used in the ProtoBuf definition.
1609+
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1610+
match value {
1611+
"TF_STEREO" => Some(Self::TfStereo),
1612+
"TF_NO_DTX" => Some(Self::TfNoDtx),
1613+
"TF_AUTO_GAIN_CONTROL" => Some(Self::TfAutoGainControl),
1614+
"TF_ECHO_CANCELLATION" => Some(Self::TfEchoCancellation),
1615+
"TF_NOISE_SUPPRESSION" => Some(Self::TfNoiseSuppression),
1616+
"TF_ENHANCED_NOISE_CANCELLATION" => Some(Self::TfEnhancedNoiseCancellation),
1617+
"TF_PRECONNECT_BUFFER" => Some(Self::TfPreconnectBuffer),
1618+
_ => None,
1619+
}
1620+
}
1621+
}
15781622
/// Enable/Disable a remote track publication
15791623
#[allow(clippy::derive_partial_eq_without_eq)]
15801624
#[derive(Clone, PartialEq, ::prost::Message)]
@@ -1694,6 +1738,7 @@ pub enum DisconnectReason {
16941738
UserRejected = 12,
16951739
/// SIP protocol failure or unexpected response
16961740
SipTrunkFailure = 13,
1741+
ConnectionTimeout = 14,
16971742
}
16981743
impl DisconnectReason {
16991744
/// String value of the enum field names used in the ProtoBuf definition.
@@ -1716,6 +1761,7 @@ impl DisconnectReason {
17161761
DisconnectReason::UserUnavailable => "USER_UNAVAILABLE",
17171762
DisconnectReason::UserRejected => "USER_REJECTED",
17181763
DisconnectReason::SipTrunkFailure => "SIP_TRUNK_FAILURE",
1764+
DisconnectReason::ConnectionTimeout => "CONNECTION_TIMEOUT",
17191765
}
17201766
}
17211767
/// Creates an enum from field names used in the ProtoBuf definition.
@@ -1735,6 +1781,7 @@ impl DisconnectReason {
17351781
"USER_UNAVAILABLE" => Some(Self::UserUnavailable),
17361782
"USER_REJECTED" => Some(Self::UserRejected),
17371783
"SIP_TRUNK_FAILURE" => Some(Self::SipTrunkFailure),
1784+
"CONNECTION_TIMEOUT" => Some(Self::ConnectionTimeout),
17381785
_ => None,
17391786
}
17401787
}

livekit-protocol/protocol

Submodule protocol updated 95 files

0 commit comments

Comments
 (0)