feat: add ffi datachannel & mute events (#88)
This commit is contained in:
@@ -18,15 +18,16 @@ message AllocAudioBufferResponse { AudioFrameBufferInfo buffer = 1; }
|
||||
// Create a new AudioStream
|
||||
// AudioStream is used to receive audio frames from a track
|
||||
message NewAudioStreamRequest {
|
||||
FfiHandleId room_handle = 1;
|
||||
string participant_sid = 2;
|
||||
string track_sid = 3;
|
||||
AudioStreamType type = 4;
|
||||
FfiHandleId track_handle = 1;
|
||||
AudioStreamType type = 2;
|
||||
}
|
||||
message NewAudioStreamResponse { AudioStreamInfo stream = 1; }
|
||||
|
||||
// Create a new AudioSource
|
||||
message NewAudioSourceRequest { AudioSourceType type = 1; }
|
||||
message NewAudioSourceRequest {
|
||||
AudioSourceType type = 1;
|
||||
optional AudioSourceOptions options = 2;
|
||||
}
|
||||
message NewAudioSourceResponse { AudioSourceInfo source = 1; }
|
||||
|
||||
// Push a frame to an AudioSource
|
||||
@@ -78,7 +79,6 @@ enum AudioStreamType {
|
||||
message AudioStreamInfo {
|
||||
FfiHandleId handle = 1;
|
||||
AudioStreamType type = 2;
|
||||
string track_sid = 3;
|
||||
}
|
||||
|
||||
message AudioStreamEvent {
|
||||
@@ -94,6 +94,12 @@ message AudioFrameReceived {
|
||||
/// AudioSource ///
|
||||
///
|
||||
|
||||
message AudioSourceOptions {
|
||||
bool echo_cancellation = 1;
|
||||
bool noise_suppression = 2;
|
||||
bool auto_gain_control = 3;
|
||||
}
|
||||
|
||||
enum AudioSourceType {
|
||||
AUDIO_SOURCE_NATIVE = 0;
|
||||
}
|
||||
|
||||
@@ -22,26 +22,27 @@ message FfiRequest {
|
||||
DisconnectRequest disconnect = 4;
|
||||
PublishTrackRequest publish_track = 5;
|
||||
UnpublishTrackRequest unpublish_track = 6;
|
||||
PublishDataRequest publish_data = 7;
|
||||
|
||||
// Track
|
||||
CreateVideoTrackRequest create_video_track = 7;
|
||||
CreateAudioTrackRequest create_audio_track = 8;
|
||||
CreateVideoTrackRequest create_video_track = 8;
|
||||
CreateAudioTrackRequest create_audio_track = 9;
|
||||
|
||||
// Video
|
||||
AllocVideoBufferRequest alloc_video_buffer = 9;
|
||||
NewVideoStreamRequest new_video_stream = 10;
|
||||
NewVideoSourceRequest new_video_source = 11;
|
||||
CaptureVideoFrameRequest capture_video_frame = 12;
|
||||
ToI420Request to_i420 = 13;
|
||||
ToArgbRequest to_argb = 14;
|
||||
AllocVideoBufferRequest alloc_video_buffer = 10;
|
||||
NewVideoStreamRequest new_video_stream = 11;
|
||||
NewVideoSourceRequest new_video_source = 12;
|
||||
CaptureVideoFrameRequest capture_video_frame = 13;
|
||||
ToI420Request to_i420 = 14;
|
||||
ToArgbRequest to_argb = 15;
|
||||
|
||||
// Audio
|
||||
AllocAudioBufferRequest alloc_audio_buffer = 15;
|
||||
NewAudioStreamRequest new_audio_stream = 16;
|
||||
NewAudioSourceRequest new_audio_source = 17;
|
||||
CaptureAudioFrameRequest capture_audio_frame = 18;
|
||||
NewAudioResamplerRequest new_audio_resampler = 19;
|
||||
RemixAndResampleRequest remix_and_resample = 20;
|
||||
AllocAudioBufferRequest alloc_audio_buffer = 16;
|
||||
NewAudioStreamRequest new_audio_stream = 17;
|
||||
NewAudioSourceRequest new_audio_source = 18;
|
||||
CaptureAudioFrameRequest capture_audio_frame = 19;
|
||||
NewAudioResamplerRequest new_audio_resampler = 20;
|
||||
RemixAndResampleRequest remix_and_resample = 21;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,26 +57,27 @@ message FfiResponse {
|
||||
DisconnectResponse disconnect = 4;
|
||||
PublishTrackResponse publish_track = 5;
|
||||
UnpublishTrackResponse unpublish_track = 6;
|
||||
PublishDataResponse publish_data = 7;
|
||||
|
||||
// Track
|
||||
CreateVideoTrackResponse create_video_track = 7;
|
||||
CreateAudioTrackResponse create_audio_track = 8;
|
||||
CreateVideoTrackResponse create_video_track = 8;
|
||||
CreateAudioTrackResponse create_audio_track = 9;
|
||||
|
||||
// Video
|
||||
AllocVideoBufferResponse alloc_video_buffer = 9;
|
||||
NewVideoStreamResponse new_video_stream = 10;
|
||||
NewVideoSourceResponse new_video_source = 11;
|
||||
CaptureVideoFrameResponse capture_video_frame = 12;
|
||||
ToI420Response to_i420 = 13;
|
||||
ToArgbResponse to_argb = 14;
|
||||
AllocVideoBufferResponse alloc_video_buffer = 10;
|
||||
NewVideoStreamResponse new_video_stream = 11;
|
||||
NewVideoSourceResponse new_video_source = 12;
|
||||
CaptureVideoFrameResponse capture_video_frame = 13;
|
||||
ToI420Response to_i420 = 14;
|
||||
ToArgbResponse to_argb = 15;
|
||||
|
||||
// Audio
|
||||
AllocAudioBufferResponse alloc_audio_buffer = 15;
|
||||
NewAudioStreamResponse new_audio_stream = 16;
|
||||
NewAudioSourceResponse new_audio_source = 17;
|
||||
CaptureAudioFrameResponse capture_audio_frame = 18;
|
||||
NewAudioResamplerResponse new_audio_resampler = 19;
|
||||
RemixAndResampleResponse remix_and_resample = 20;
|
||||
AllocAudioBufferResponse alloc_audio_buffer = 16;
|
||||
NewAudioStreamResponse new_audio_stream = 17;
|
||||
NewAudioSourceResponse new_audio_source = 18;
|
||||
CaptureAudioFrameResponse capture_audio_frame = 19;
|
||||
NewAudioResamplerResponse new_audio_resampler = 20;
|
||||
RemixAndResampleResponse remix_and_resample = 21;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,8 +89,10 @@ message FfiEvent {
|
||||
VideoStreamEvent video_stream_event = 4;
|
||||
AudioStreamEvent audio_stream_event = 5;
|
||||
ConnectCallback connect = 6;
|
||||
DisposeCallback dispose = 7;
|
||||
PublishTrackCallback publish_track = 8;
|
||||
DisconnectCallback disconnect = 7;
|
||||
DisposeCallback dispose = 8;
|
||||
PublishTrackCallback publish_track = 9;
|
||||
PublishDataCallback publish_data = 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,10 @@ option csharp_namespace = "LiveKit.Proto";
|
||||
/// # Safety
|
||||
/// The foreign language is responsable for disposing handles
|
||||
/// Forgetting to dispose the handle may lead to memory leaks
|
||||
/// Messages in this file can contain an FFIHandle
|
||||
///
|
||||
/// A handle means that the foreign language may still use the corresponding object
|
||||
/// Dropping a handle doesn't necessarily mean that the object is destroyed if it is still used
|
||||
/// on the FfiServer (Rust)
|
||||
message FfiHandleId {
|
||||
uint64 id = 1;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ option csharp_namespace = "LiveKit.Proto";
|
||||
//import "handle.proto";
|
||||
import "track.proto";
|
||||
|
||||
// Seems like we don't need a FfiHandle for participants (atm at least)
|
||||
message ParticipantInfo {
|
||||
string sid = 1;
|
||||
string name = 2;
|
||||
|
||||
@@ -26,7 +26,7 @@ message ConnectCallback {
|
||||
// Disconnect from the a room
|
||||
message DisconnectRequest { FfiHandleId room_handle = 1; }
|
||||
message DisconnectResponse { FfiAsyncId async_id = 1; }
|
||||
message DisconnectCallback { }
|
||||
message DisconnectCallback { FfiAsyncId async_id = 1; }
|
||||
|
||||
// Publish a track to the room
|
||||
message PublishTrackRequest {
|
||||
@@ -53,9 +53,27 @@ message UnpublishTrackResponse {
|
||||
FfiAsyncId async_id = 1;
|
||||
}
|
||||
message UnpublishTrackCallback {
|
||||
optional string error = 1;
|
||||
FfiAsyncId async_id = 1;
|
||||
optional string error = 2;
|
||||
}
|
||||
|
||||
// Publish data to other participants
|
||||
message PublishDataRequest {
|
||||
FfiHandleId room_handle = 1;
|
||||
uint64 data_ptr = 2;
|
||||
uint64 data_size = 3;
|
||||
DataPacketKind kind = 4;
|
||||
repeated string destination_sids = 5; // destination
|
||||
}
|
||||
message PublishDataResponse {
|
||||
FfiAsyncId async_id = 1;
|
||||
}
|
||||
message PublishDataCallback {
|
||||
FfiAsyncId async_id = 1;
|
||||
optional string error = 2;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Options
|
||||
///
|
||||
@@ -77,13 +95,13 @@ message TrackPublishOptions {
|
||||
bool dtx = 4;
|
||||
bool red = 5;
|
||||
bool simulcast = 6;
|
||||
string name = 7;
|
||||
TrackSource source = 8;
|
||||
TrackSource source = 7;
|
||||
}
|
||||
|
||||
message RoomOptions {
|
||||
bool auto_subscribe = 1;
|
||||
bool adaptive_stream = 2;
|
||||
bool dynacast = 3;
|
||||
}
|
||||
|
||||
///
|
||||
@@ -104,7 +122,7 @@ enum ConnectionState {
|
||||
}
|
||||
|
||||
enum DataPacketKind {
|
||||
KIND_UNRELIABLE = 0;
|
||||
KIND_LOSSY = 0;
|
||||
KIND_RELIABLE = 1;
|
||||
}
|
||||
|
||||
@@ -141,7 +159,7 @@ message RoomInfo {
|
||||
|
||||
message DataReceived {
|
||||
FfiHandleId handle = 1;
|
||||
optional string participant_sid = 2;
|
||||
optional string participant_sid = 2; // Can be empty if the data is sent a server SDK
|
||||
uint64 data_ptr = 3;
|
||||
uint64 data_size = 4;
|
||||
DataPacketKind kind = 5;
|
||||
@@ -196,4 +214,4 @@ message ConnectionStateChanged { ConnectionState state = 1; }
|
||||
message Connected {}
|
||||
message Disconnected {}
|
||||
message Reconnecting {}
|
||||
message Reconnected {}
|
||||
message Reconnected {}
|
||||
@@ -7,21 +7,10 @@ import "handle.proto";
|
||||
import "video_frame.proto";
|
||||
import "audio_frame.proto";
|
||||
|
||||
message VideoCaptureOptions {
|
||||
VideoResolution resolution = 1;
|
||||
}
|
||||
|
||||
message AudioCaptureOptions {
|
||||
bool echo_cancellation = 1;
|
||||
bool noise_suppression = 2;
|
||||
bool auto_gain_control = 3;
|
||||
}
|
||||
|
||||
// Create a new VideoTrack from a VideoSource
|
||||
message CreateVideoTrackRequest {
|
||||
string name = 1;
|
||||
VideoCaptureOptions options = 2;
|
||||
FfiHandleId source_handle = 3;
|
||||
FfiHandleId source_handle = 2;
|
||||
}
|
||||
message CreateVideoTrackResponse {
|
||||
TrackInfo track = 1;
|
||||
@@ -30,8 +19,7 @@ message CreateVideoTrackResponse {
|
||||
// Create a new AudioTrack from a AudioSource
|
||||
message CreateAudioTrackRequest {
|
||||
string name = 1;
|
||||
AudioCaptureOptions options = 2;
|
||||
FfiHandleId source_handle = 3;
|
||||
FfiHandleId source_handle = 2;
|
||||
}
|
||||
message CreateAudioTrackResponse {
|
||||
TrackInfo track = 1;
|
||||
@@ -79,8 +67,7 @@ message TrackPublicationInfo {
|
||||
}
|
||||
|
||||
message TrackInfo {
|
||||
// Tracks created/owned by the client will have a handle
|
||||
FfiHandleId opt_handle = 1;
|
||||
FfiHandleId handle = 1;
|
||||
string sid = 2;
|
||||
string name = 3;
|
||||
TrackKind kind = 4;
|
||||
|
||||
@@ -16,16 +16,19 @@ message AllocVideoBufferResponse { VideoFrameBufferInfo buffer = 1; }
|
||||
// Create a new VideoStream
|
||||
// VideoStream is used to receive video frames from a track
|
||||
message NewVideoStreamRequest {
|
||||
FfiHandleId room_handle = 1;
|
||||
string participant_sid = 2;
|
||||
string track_sid = 3;
|
||||
VideoStreamType type = 4;
|
||||
FfiHandleId track_handle = 1;
|
||||
VideoStreamType type = 2;
|
||||
}
|
||||
message NewVideoStreamResponse { VideoStreamInfo stream = 1; }
|
||||
|
||||
// Create a new VideoSource
|
||||
// VideoSource is used to send video frame to a track
|
||||
message NewVideoSourceRequest { VideoSourceType type = 1; }
|
||||
message NewVideoSourceRequest {
|
||||
VideoSourceType type = 1;
|
||||
// Used to determine which encodings to use + simulcast layers
|
||||
// Most of the time it corresponds to the source resolution
|
||||
optional VideoSourceResolution resolution = 2;
|
||||
}
|
||||
message NewVideoSourceResponse { VideoSourceInfo source = 1; }
|
||||
|
||||
// Push a frame to a VideoSource
|
||||
@@ -110,7 +113,7 @@ message ARGBBufferInfo {
|
||||
}
|
||||
|
||||
message VideoFrameInfo {
|
||||
int64 timestamp = 1;
|
||||
int64 timestamp_us = 1; // In microseconds
|
||||
VideoRotation rotation = 2;
|
||||
}
|
||||
|
||||
@@ -168,7 +171,6 @@ enum VideoStreamType {
|
||||
message VideoStreamInfo {
|
||||
FfiHandleId handle = 1;
|
||||
VideoStreamType type = 2;
|
||||
string track_sid = 3;
|
||||
}
|
||||
|
||||
message VideoStreamEvent {
|
||||
@@ -185,6 +187,11 @@ message VideoFrameReceived {
|
||||
/// VideoSource ///
|
||||
///
|
||||
|
||||
message VideoSourceResolution {
|
||||
uint32 width = 1;
|
||||
uint32 height = 2;
|
||||
}
|
||||
|
||||
enum VideoSourceType {
|
||||
VIDEO_SOURCE_NATIVE = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user