Skip to content

Commit d621a50

Browse files
committed
Define FFI messages for send bytes
1 parent ab2740d commit d621a50

File tree

3 files changed

+77
-5
lines changed

3 files changed

+77
-5
lines changed

livekit-ffi/protocol/data_stream.proto

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,28 @@ message StreamSendFileCallback {
156156
}
157157
}
158158

159+
// MARK: - Send bytes
160+
161+
// Sends bytes over a data stream.
162+
message StreamSendBytesRequest {
163+
required uint64 local_participant_handle = 1;
164+
165+
required StreamByteOptions options = 2;
166+
167+
// Bytes to send.
168+
required bytes bytes = 3;
169+
}
170+
message StreamSendBytesResponse {
171+
required uint64 async_id = 1;
172+
}
173+
message StreamSendBytesCallback {
174+
required uint64 async_id = 1;
175+
oneof result {
176+
ByteStreamInfo info = 2;
177+
StreamError error = 3;
178+
}
179+
}
180+
159181
// MARK: - Send text
160182

161183
// Sends text over a data stream.

livekit-ffi/protocol/ffi.proto

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ message FfiRequest {
148148
TextStreamWriterWriteRequest text_stream_write = 65;
149149
TextStreamWriterCloseRequest text_stream_close = 66;
150150

151-
// NEXT_ID: 67
151+
StreamSendBytesRequest send_bytes = 67;
152+
153+
// NEXT_ID: 68
152154
}
153155
}
154156

@@ -243,7 +245,9 @@ message FfiResponse {
243245
TextStreamWriterWriteResponse text_stream_write = 64;
244246
TextStreamWriterCloseResponse text_stream_close = 65;
245247

246-
// NEXT_ID: 66
248+
StreamSendBytesResponse send_bytes = 66;
249+
250+
// NEXT_ID: 67
247251
}
248252
}
249253

@@ -298,6 +302,7 @@ message FfiEvent {
298302
TextStreamWriterWriteCallback text_stream_writer_write = 38;
299303
TextStreamWriterCloseCallback text_stream_writer_close = 39;
300304
StreamSendTextCallback send_text = 40;
305+
StreamSendBytesCallback send_bytes = 41;
301306
}
302307
}
303308

livekit-ffi/src/livekit.proto.rs

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2447,6 +2447,45 @@ pub mod stream_send_file_callback {
24472447
Error(super::StreamError),
24482448
}
24492449
}
2450+
// MARK: - Send bytes
2451+
2452+
/// Sends bytes over a data stream.
2453+
#[allow(clippy::derive_partial_eq_without_eq)]
2454+
#[derive(Clone, PartialEq, ::prost::Message)]
2455+
pub struct StreamSendBytesRequest {
2456+
#[prost(uint64, required, tag="1")]
2457+
pub local_participant_handle: u64,
2458+
#[prost(message, required, tag="2")]
2459+
pub options: StreamByteOptions,
2460+
/// Bytes to send.
2461+
#[prost(bytes="vec", required, tag="3")]
2462+
pub bytes: ::prost::alloc::vec::Vec<u8>,
2463+
}
2464+
#[allow(clippy::derive_partial_eq_without_eq)]
2465+
#[derive(Clone, PartialEq, ::prost::Message)]
2466+
pub struct StreamSendBytesResponse {
2467+
#[prost(uint64, required, tag="1")]
2468+
pub async_id: u64,
2469+
}
2470+
#[allow(clippy::derive_partial_eq_without_eq)]
2471+
#[derive(Clone, PartialEq, ::prost::Message)]
2472+
pub struct StreamSendBytesCallback {
2473+
#[prost(uint64, required, tag="1")]
2474+
pub async_id: u64,
2475+
#[prost(oneof="stream_send_bytes_callback::Result", tags="2, 3")]
2476+
pub result: ::core::option::Option<stream_send_bytes_callback::Result>,
2477+
}
2478+
/// Nested message and enum types in `StreamSendBytesCallback`.
2479+
pub mod stream_send_bytes_callback {
2480+
#[allow(clippy::derive_partial_eq_without_eq)]
2481+
#[derive(Clone, PartialEq, ::prost::Oneof)]
2482+
pub enum Result {
2483+
#[prost(message, tag="2")]
2484+
Info(super::ByteStreamInfo),
2485+
#[prost(message, tag="3")]
2486+
Error(super::StreamError),
2487+
}
2488+
}
24502489
// MARK: - Send text
24512490

24522491
/// Sends text over a data stream.
@@ -4889,7 +4928,7 @@ pub struct RpcMethodInvocationEvent {
48894928
#[allow(clippy::derive_partial_eq_without_eq)]
48904929
#[derive(Clone, PartialEq, ::prost::Message)]
48914930
pub struct FfiRequest {
4892-
#[prost(oneof="ffi_request::Message", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 48, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66")]
4931+
#[prost(oneof="ffi_request::Message", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 48, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67")]
48934932
pub message: ::core::option::Option<ffi_request::Message>,
48944933
}
48954934
/// Nested message and enum types in `FfiRequest`.
@@ -5037,13 +5076,15 @@ pub mod ffi_request {
50375076
TextStreamWrite(super::TextStreamWriterWriteRequest),
50385077
#[prost(message, tag="66")]
50395078
TextStreamClose(super::TextStreamWriterCloseRequest),
5079+
#[prost(message, tag="67")]
5080+
SendBytes(super::StreamSendBytesRequest),
50405081
}
50415082
}
50425083
/// This is the output of livekit_ffi_request function.
50435084
#[allow(clippy::derive_partial_eq_without_eq)]
50445085
#[derive(Clone, PartialEq, ::prost::Message)]
50455086
pub struct FfiResponse {
5046-
#[prost(oneof="ffi_response::Message", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 47, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65")]
5087+
#[prost(oneof="ffi_response::Message", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 47, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66")]
50475088
pub message: ::core::option::Option<ffi_response::Message>,
50485089
}
50495090
/// Nested message and enum types in `FfiResponse`.
@@ -5189,6 +5230,8 @@ pub mod ffi_response {
51895230
TextStreamWrite(super::TextStreamWriterWriteResponse),
51905231
#[prost(message, tag="65")]
51915232
TextStreamClose(super::TextStreamWriterCloseResponse),
5233+
#[prost(message, tag="66")]
5234+
SendBytes(super::StreamSendBytesResponse),
51925235
}
51935236
}
51945237
/// To minimize complexity, participant events are not included in the protocol.
@@ -5197,7 +5240,7 @@ pub mod ffi_response {
51975240
#[allow(clippy::derive_partial_eq_without_eq)]
51985241
#[derive(Clone, PartialEq, ::prost::Message)]
51995242
pub struct FfiEvent {
5200-
#[prost(oneof="ffi_event::Message", tags="1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40")]
5243+
#[prost(oneof="ffi_event::Message", tags="1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41")]
52015244
pub message: ::core::option::Option<ffi_event::Message>,
52025245
}
52035246
/// Nested message and enum types in `FfiEvent`.
@@ -5285,6 +5328,8 @@ pub mod ffi_event {
52855328
TextStreamWriterClose(super::TextStreamWriterCloseCallback),
52865329
#[prost(message, tag="40")]
52875330
SendText(super::StreamSendTextCallback),
5331+
#[prost(message, tag="41")]
5332+
SendBytes(super::StreamSendBytesCallback),
52885333
}
52895334
}
52905335
/// Stop all rooms synchronously (Do we need async here?).

0 commit comments

Comments
 (0)