Skip to content
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

Add participant attributes to the FFI #367

Merged
merged 9 commits into from
Jul 15, 2024
Merged
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
85 changes: 44 additions & 41 deletions livekit-ffi/protocol/ffi.proto
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,30 @@ message FfiRequest {
UnpublishTrackRequest unpublish_track = 6;
PublishDataRequest publish_data = 7;
SetSubscribedRequest set_subscribed = 8;
UpdateLocalMetadataRequest update_local_metadata = 9;
UpdateLocalNameRequest update_local_name = 10;
GetSessionStatsRequest get_session_stats = 11;
PublishTranscriptionRequest publish_transcription = 12;
SetLocalMetadataRequest update_local_metadata = 9;
SetLocalNameRequest update_local_name = 10;
SetLocalAttributesRequest update_local_attributes = 11;
GetSessionStatsRequest get_session_stats = 12;
PublishTranscriptionRequest publish_transcription = 13;

// Track
CreateVideoTrackRequest create_video_track = 13;
CreateAudioTrackRequest create_audio_track = 14;
GetStatsRequest get_stats = 15;
CreateVideoTrackRequest create_video_track = 15;
CreateAudioTrackRequest create_audio_track = 16;
GetStatsRequest get_stats = 17;

// Video
NewVideoStreamRequest new_video_stream = 16;
NewVideoSourceRequest new_video_source = 17;
CaptureVideoFrameRequest capture_video_frame = 18;
VideoConvertRequest video_convert = 19;
NewVideoStreamRequest new_video_stream = 18;
NewVideoSourceRequest new_video_source = 19;
CaptureVideoFrameRequest capture_video_frame = 20;
VideoConvertRequest video_convert = 21;

// Audio
NewAudioStreamRequest new_audio_stream = 22;
NewAudioSourceRequest new_audio_source = 23;
CaptureAudioFrameRequest capture_audio_frame = 24;
NewAudioResamplerRequest new_audio_resampler = 25;
RemixAndResampleRequest remix_and_resample = 26;
E2eeRequest e2ee = 27;
NewAudioStreamRequest new_audio_stream = 23;
NewAudioSourceRequest new_audio_source = 24;
CaptureAudioFrameRequest capture_audio_frame = 25;
NewAudioResamplerRequest new_audio_resampler = 26;
RemixAndResampleRequest remix_and_resample = 27;
E2eeRequest e2ee = 28;
}
}

Expand All @@ -101,21 +102,22 @@ message FfiResponse {
UnpublishTrackResponse unpublish_track = 6;
PublishDataResponse publish_data = 7;
SetSubscribedResponse set_subscribed = 8;
UpdateLocalMetadataResponse update_local_metadata = 9;
UpdateLocalNameResponse update_local_name = 10;
GetSessionStatsResponse get_session_stats = 11;
PublishTranscriptionResponse publish_transcription = 12;
SetLocalMetadataResponse update_local_metadata = 9;
SetLocalNameResponse update_local_name = 10;
SetLocalAttributesResponse update_local_attributes = 11;
GetSessionStatsResponse get_session_stats = 12;
PublishTranscriptionResponse publish_transcription = 13;

// Track
CreateVideoTrackResponse create_video_track = 13;
CreateAudioTrackResponse create_audio_track = 14;
GetStatsResponse get_stats = 15;
CreateVideoTrackResponse create_video_track = 15;
CreateAudioTrackResponse create_audio_track = 16;
GetStatsResponse get_stats = 17;

// Video
NewVideoStreamResponse new_video_stream = 16;
NewVideoSourceResponse new_video_source = 17;
CaptureVideoFrameResponse capture_video_frame = 18;
VideoConvertResponse video_convert = 19;
NewVideoStreamResponse new_video_stream = 18;
NewVideoSourceResponse new_video_source = 19;
CaptureVideoFrameResponse capture_video_frame = 20;
VideoConvertResponse video_convert = 21;

// Audio
NewAudioStreamResponse new_audio_stream = 22;
Expand All @@ -137,19 +139,20 @@ message FfiEvent {
VideoStreamEvent video_stream_event = 3;
AudioStreamEvent audio_stream_event = 4;
ConnectCallback connect = 5;
DisconnectCallback disconnect = 6;
DisposeCallback dispose = 7;
PublishTrackCallback publish_track = 8;
UnpublishTrackCallback unpublish_track = 9;
PublishDataCallback publish_data = 10;
PublishTranscriptionCallback publish_transcription = 11;
CaptureAudioFrameCallback capture_audio_frame = 12;
UpdateLocalMetadataCallback update_local_metadata = 13;
UpdateLocalNameCallback update_local_name = 14;
GetStatsCallback get_stats = 15;
LogBatch logs = 16;
GetSessionStatsCallback get_session_stats = 17;
Panic panic = 18;
DisconnectCallback disconnect = 7;
DisposeCallback dispose = 8;
PublishTrackCallback publish_track = 9;
UnpublishTrackCallback unpublish_track = 10;
PublishDataCallback publish_data = 11;
PublishTranscriptionCallback publish_transcription = 12;
CaptureAudioFrameCallback capture_audio_frame = 13;
SetLocalMetadataCallback update_local_metadata = 14;
SetLocalNameCallback update_local_name = 15;
SetLocalAttributesCallback update_local_attributes = 16;
GetStatsCallback get_stats = 17;
LogBatch logs = 18;
GetSessionStatsCallback get_session_stats = 19;
Panic panic = 20;
}
}

Expand Down
1 change: 1 addition & 0 deletions livekit-ffi/protocol/participant.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ message ParticipantInfo {
string name = 2;
string identity = 3;
string metadata = 4;
map<string, string> attributes = 5;
}

message OwnedParticipant {
Expand Down
54 changes: 38 additions & 16 deletions livekit-ffi/protocol/room.proto
Original file line number Diff line number Diff line change
Expand Up @@ -117,27 +117,42 @@ message PublishTranscriptionCallback {
}

// Change the local participant's metadata
message UpdateLocalMetadataRequest {
message SetLocalMetadataRequest {
uint64 local_participant_handle = 1;
string metadata = 2;
}
message UpdateLocalMetadataResponse {
message SetLocalMetadataResponse {
uint64 async_id = 1;
}
message UpdateLocalMetadataCallback {
message SetLocalMetadataCallback {
uint64 async_id = 1;
optional string error = 2;
}

// Change the local participant's attributes
message SetLocalAttributesRequest {
uint64 local_participant_handle = 1;
map<string, string> attributes = 2;
}
message SetLocalAttributesResponse {
uint64 async_id = 1;
}
message SetLocalAttributesCallback {
uint64 async_id = 1;
keepingitneil marked this conversation as resolved.
Show resolved Hide resolved
optional string error = 2;
}

// Change the local participant's name
message UpdateLocalNameRequest {
message SetLocalNameRequest {
uint64 local_participant_handle = 1;
string name = 2;
}
message UpdateLocalNameResponse {
message SetLocalNameResponse {
uint64 async_id = 1;
}
message UpdateLocalNameCallback {
message SetLocalNameCallback {
uint64 async_id = 1;
optional string error = 2;
}

// Change the "desire" to subs2ribe to a track
Expand Down Expand Up @@ -276,20 +291,21 @@ message RoomEvent {
RoomSidChanged room_sid_changed = 15;
ParticipantMetadataChanged participant_metadata_changed = 16;
ParticipantNameChanged participant_name_changed = 17;
ConnectionQualityChanged connection_quality_changed = 18;
keepingitneil marked this conversation as resolved.
Show resolved Hide resolved
ConnectionStateChanged connection_state_changed = 19;
// Connected connected = 20;
Disconnected disconnected = 21;
Reconnecting reconnecting = 22;
Reconnected reconnected = 23;
E2eeStateChanged e2ee_state_changed = 24;
RoomEOS eos = 25; // The stream of room events has ended
DataPacketReceived data_packet_received = 26;
ParticipantAttributesChanged participant_attributes_changed = 18;
ConnectionQualityChanged connection_quality_changed = 19;
ConnectionStateChanged connection_state_changed = 20;
// Connected connected = 21;
Disconnected disconnected = 22;
Reconnecting reconnecting = 23;
Reconnected reconnected = 24;
E2eeStateChanged e2ee_state_changed = 25;
RoomEOS eos = 26; // The stream of room events has ended
DataPacketReceived data_packet_received = 27;
}
}

message RoomInfo {
string sid = 1;
optional string sid = 1;
string name = 2;
string metadata = 3;
}
Expand Down Expand Up @@ -374,6 +390,12 @@ message ParticipantMetadataChanged {
string metadata = 2;
}

message ParticipantAttributesChanged {
string participant_sid = 1;
map<string, string> old_attributes = 2;
map<string, string> attributes = 3;
}

message ParticipantNameChanged {
string participant_sid = 1;
string name = 2;
Expand Down
1 change: 1 addition & 0 deletions livekit-ffi/src/conversion/participant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ impl From<&FfiParticipant> for proto::ParticipantInfo {
name: participant.name(),
identity: participant.identity().into(),
metadata: participant.metadata(),
attributes: participant.attributes(),
}
}
}
2 changes: 1 addition & 1 deletion livekit-ffi/src/conversion/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl From<&FfiRoom> for proto::RoomInfo {
fn from(value: &FfiRoom) -> Self {
let room = &value.inner.room;
Self {
sid: room.maybe_sid().unwrap_or_default().into(),
sid: room.maybe_sid().map(|x| x.to_string()),
name: room.name(),
metadata: room.metadata(),
}
Expand Down
Loading