Skip to content

Commit

Permalink
fix pb2
Browse files Browse the repository at this point in the history
  • Loading branch information
bcherry committed Oct 21, 2024
1 parent 35e7985 commit 17093bb
Show file tree
Hide file tree
Showing 13 changed files with 1,342 additions and 606 deletions.
133 changes: 68 additions & 65 deletions livekit-ffi/protocol/audio_frame.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";
syntax = "proto2";

package livekit.proto;
option csharp_namespace = "LiveKit.Proto";
Expand All @@ -23,106 +23,109 @@ import "track.proto";
// Create a new AudioStream
// AudioStream is used to receive audio frames from a track
message NewAudioStreamRequest {
uint64 track_handle = 1;
AudioStreamType type = 2;
uint32 sample_rate = 3;
uint32 num_channels = 4;
required uint64 track_handle = 1;
required AudioStreamType type = 2;
required uint32 sample_rate = 3;
required uint32 num_channels = 4;
}
message NewAudioStreamResponse { OwnedAudioStream stream = 1; }
message NewAudioStreamResponse { required OwnedAudioStream stream = 1; }

message AudioStreamFromParticipantRequest {
uint64 participant_handle = 1;
AudioStreamType type = 2;
required uint64 participant_handle = 1;
required AudioStreamType type = 2;
optional TrackSource track_source = 3;
uint32 sample_rate = 5;
uint32 num_channels = 6;
required uint32 sample_rate = 5;
required uint32 num_channels = 6;
}

message AudioStreamFromParticipantResponse { OwnedAudioStream stream = 1; }
message AudioStreamFromParticipantResponse { required OwnedAudioStream stream = 1; }

// Create a new AudioSource
message NewAudioSourceRequest {
AudioSourceType type = 1;
required AudioSourceType type = 1;
optional AudioSourceOptions options = 2;
uint32 sample_rate = 3;
uint32 num_channels = 4;
uint32 queue_size_ms = 5;
required uint32 sample_rate = 3;
required uint32 num_channels = 4;
required uint32 queue_size_ms = 5;
}
message NewAudioSourceResponse { OwnedAudioSource source = 1; }
message NewAudioSourceResponse { required OwnedAudioSource source = 1; }

// Push a frame to an AudioSource
// The data provided must be available as long as the client receive the callback.
message CaptureAudioFrameRequest {
uint64 source_handle = 1;
AudioFrameBufferInfo buffer = 2;
required uint64 source_handle = 1;
required AudioFrameBufferInfo buffer = 2;
}
message CaptureAudioFrameResponse {
uint64 async_id = 1;
required uint64 async_id = 1;
}
message CaptureAudioFrameCallback {
uint64 async_id = 1;
required uint64 async_id = 1;
optional string error = 2;
}

message ClearAudioBufferRequest {
uint64 source_handle = 1;
required uint64 source_handle = 1;
}
message ClearAudioBufferResponse {}

// Create a new AudioResampler
message NewAudioResamplerRequest {}
message NewAudioResamplerResponse {
OwnedAudioResampler resampler = 1;
required OwnedAudioResampler resampler = 1;
}

// Remix and resample an audio frame
message RemixAndResampleRequest {
uint64 resampler_handle = 1;
AudioFrameBufferInfo buffer = 2;
uint32 num_channels = 3;
uint32 sample_rate = 4;
required uint64 resampler_handle = 1;
required AudioFrameBufferInfo buffer = 2;
required uint32 num_channels = 3;
required uint32 sample_rate = 4;
}

message RemixAndResampleResponse {
OwnedAudioFrameBuffer buffer = 1;
required OwnedAudioFrameBuffer buffer = 1;
}


// New resampler using SoX (much better quality)

message NewSoxResamplerRequest {
double input_rate = 1;
double output_rate = 2;
uint32 num_channels = 3;
SoxResamplerDataType input_data_type = 4;
SoxResamplerDataType output_data_type = 5;
SoxQualityRecipe quality_recipe = 6;
uint32 flags = 7;
required double input_rate = 1;
required double output_rate = 2;
required uint32 num_channels = 3;
required SoxResamplerDataType input_data_type = 4;
required SoxResamplerDataType output_data_type = 5;
required SoxQualityRecipe quality_recipe = 6;
required uint32 flags = 7;
}
message NewSoxResamplerResponse {
OwnedSoxResampler resampler = 1;
optional string error = 2;
oneof message {
OwnedSoxResampler resampler = 1;
string error = 2;
}

}

message PushSoxResamplerRequest {
uint64 resampler_handle = 1;
uint64 data_ptr = 2; // *const i16
uint32 size = 3; // in bytes
required uint64 resampler_handle = 1;
required uint64 data_ptr = 2; // *const i16
required uint32 size = 3; // in bytes
}

message PushSoxResamplerResponse {
uint64 output_ptr = 1; // *const i16 (could be null)
uint32 size = 2; // in bytes
required uint64 output_ptr = 1; // *const i16 (could be null)
required uint32 size = 2; // in bytes
optional string error = 3;
}

message FlushSoxResamplerRequest {
uint64 resampler_handle = 1;
required uint64 resampler_handle = 1;
}

message FlushSoxResamplerResponse {
uint64 output_ptr = 1; // *const i16 (could be null)
uint32 size = 2; // in bytes
required uint64 output_ptr = 1; // *const i16 (could be null)
required uint32 size = 2; // in bytes
optional string error = 3;
}

Expand Down Expand Up @@ -156,15 +159,15 @@ enum SoxFlagBits {
//

message AudioFrameBufferInfo {
uint64 data_ptr = 1; // *const i16
uint32 num_channels = 2;
uint32 sample_rate = 3;
uint32 samples_per_channel = 4;
required uint64 data_ptr = 1; // *const i16
required uint32 num_channels = 2;
required uint32 sample_rate = 3;
required uint32 samples_per_channel = 4;
}

message OwnedAudioFrameBuffer {
FfiOwnedHandle handle = 1;
AudioFrameBufferInfo info = 2;
required FfiOwnedHandle handle = 1;
required AudioFrameBufferInfo info = 2;
}

//
Expand All @@ -177,24 +180,24 @@ enum AudioStreamType {
}

message AudioStreamInfo {
AudioStreamType type = 1;
required AudioStreamType type = 1;
}

message OwnedAudioStream {
FfiOwnedHandle handle = 1;
AudioStreamInfo info = 2;
required FfiOwnedHandle handle = 1;
required AudioStreamInfo info = 2;
}

message AudioStreamEvent {
uint64 stream_handle = 1;
required uint64 stream_handle = 1;
oneof message {
AudioFrameReceived frame_received = 2;
AudioStreamEOS eos = 3;
}
}

message AudioFrameReceived {
OwnedAudioFrameBuffer frame = 1;
required OwnedAudioFrameBuffer frame = 1;
}

message AudioStreamEOS {}
Expand All @@ -204,22 +207,22 @@ message AudioStreamEOS {}
//

message AudioSourceOptions {
bool echo_cancellation = 1;
bool noise_suppression = 2;
bool auto_gain_control = 3;
required bool echo_cancellation = 1;
required bool noise_suppression = 2;
required bool auto_gain_control = 3;
}

enum AudioSourceType {
AUDIO_SOURCE_NATIVE = 0;
}

message AudioSourceInfo {
AudioSourceType type = 2;
required AudioSourceType type = 2;
}

message OwnedAudioSource {
FfiOwnedHandle handle = 1;
AudioSourceInfo info = 2;
required FfiOwnedHandle handle = 1;
required AudioSourceInfo info = 2;
}

//
Expand All @@ -229,8 +232,8 @@ message OwnedAudioSource {
message AudioResamplerInfo { }

message OwnedAudioResampler {
FfiOwnedHandle handle = 1;
AudioResamplerInfo info = 2;
required FfiOwnedHandle handle = 1;
required AudioResamplerInfo info = 2;
}


Expand All @@ -243,6 +246,6 @@ message OwnedAudioResampler {
message SoxResamplerInfo {}

message OwnedSoxResampler {
FfiOwnedHandle handle = 1;
SoxResamplerInfo info = 2;
required FfiOwnedHandle handle = 1;
required SoxResamplerInfo info = 2;
}
64 changes: 32 additions & 32 deletions livekit-ffi/protocol/e2ee.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";
syntax = "proto2";

package livekit.proto;
option csharp_namespace = "LiveKit.Proto";
Expand All @@ -26,23 +26,23 @@ enum EncryptionType {
}

message FrameCryptor {
string participant_identity = 1;
string track_sid = 2;
int32 key_index = 3;
bool enabled = 4;
required string participant_identity = 1;
required string track_sid = 2;
required int32 key_index = 3;
required bool enabled = 4;
}

message KeyProviderOptions {
// Only specify if you want to use a shared_key
optional bytes shared_key = 1;
int32 ratchet_window_size = 2;
bytes ratchet_salt = 3;
int32 failure_tolerance = 4; // -1 = no tolerence
required int32 ratchet_window_size = 2;
required bytes ratchet_salt = 3;
required int32 failure_tolerance = 4; // -1 = no tolerance
}

message E2eeOptions {
EncryptionType encryption_type = 1;
KeyProviderOptions key_provider_options = 2;
required EncryptionType encryption_type = 1;
required KeyProviderOptions key_provider_options = 2;
}

enum EncryptionState {
Expand All @@ -56,7 +56,7 @@ enum EncryptionState {
}

message E2eeManagerSetEnabledRequest {
bool enabled = 1;
required bool enabled = 1;
}
message E2eeManagerSetEnabledResponse {}

Expand All @@ -66,64 +66,64 @@ message E2eeManagerGetFrameCryptorsResponse {
}

message FrameCryptorSetEnabledRequest {
string participant_identity = 1;
string track_sid = 2;
bool enabled = 3;
required string participant_identity = 1;
required string track_sid = 2;
required bool enabled = 3;
}
message FrameCryptorSetEnabledResponse { }
message FrameCryptorSetEnabledResponse {}

message FrameCryptorSetKeyIndexRequest {
string participant_identity = 1;
string track_sid = 2;
int32 key_index = 3;
required string participant_identity = 1;
required string track_sid = 2;
required int32 key_index = 3;
}
message FrameCryptorSetKeyIndexResponse { }
message FrameCryptorSetKeyIndexResponse {}

message SetSharedKeyRequest {
bytes shared_key = 1;
int32 key_index = 2;
required bytes shared_key = 1;
required int32 key_index = 2;
}
message SetSharedKeyResponse { }
message SetSharedKeyResponse {}

message RatchetSharedKeyRequest {
int32 key_index = 1;
required int32 key_index = 1;
}
message RatchetSharedKeyResponse {
optional bytes new_key = 1;
}

message GetSharedKeyRequest {
int32 key_index = 1;
required int32 key_index = 1;
}
message GetSharedKeyResponse {
optional bytes key = 1;
}

message SetKeyRequest {
string participant_identity = 1;
bytes key = 2;
int32 key_index = 3;
required string participant_identity = 1;
required bytes key = 2;
required int32 key_index = 3;
}
message SetKeyResponse {}

message RatchetKeyRequest {
string participant_identity = 1;
int32 key_index = 2;
required string participant_identity = 1;
required int32 key_index = 2;
}
message RatchetKeyResponse {
optional bytes new_key = 1;
}

message GetKeyRequest {
string participant_identity = 1;
int32 key_index = 2;
required string participant_identity = 1;
required int32 key_index = 2;
}
message GetKeyResponse {
optional bytes key = 1;
}

message E2eeRequest {
uint64 room_handle = 1;
required uint64 room_handle = 1;
oneof message {
E2eeManagerSetEnabledRequest manager_set_enabled = 2;
E2eeManagerGetFrameCryptorsRequest manager_get_frame_cryptors = 3;
Expand Down
Loading

0 comments on commit 17093bb

Please sign in to comment.