Skip to content

Commit d92705f

Browse files
committed
wip
1 parent 7bc90f8 commit d92705f

27 files changed

+518
-365
lines changed

client-sdk-rust

examples/basic_room/room.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,20 @@
88
async def main():
99
room = livekit.Room()
1010
await room.connect(URL, TOKEN)
11-
12-
@room.on("participant_connected")
13-
def on_participant_connected(participant: livekit.RemoteParticipant):
14-
print("participant connected: " + participant.identity)
11+
print("connected to room: " + room.name)
1512

1613
@room.on("track_subscribed")
1714
def on_track_subscribed(track: livekit.Track, publication: livekit.RemoteTrackPublication, participant: livekit.RemoteParticipant):
1815
if track.kind == livekit.TrackKind.KIND_VIDEO:
1916
video_stream = livekit.VideoStream(track)
2017

2118
@video_stream.on("frame_received")
22-
def on_video_frame(frame: livekit.VideoFrame, buffer: livekit.VideoFrameBuffer):
23-
argb = livekit.ArgbFrame(
24-
livekit.VideoFormatType.FORMAT_ABGR, buffer.width, buffer.height)
25-
buffer.to_argb(argb)
19+
def on_video_frame(frame: livekit.VideoFrame):
20+
print("received video frame")
21+
pass
2622

27-
print("Connected to room with sid: " + room.sid)
2823
await room.run()
2924

25+
3026
if __name__ == "__main__":
3127
asyncio.run(main())

livekit/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from ._proto.video_frame_pb2 import (
77
VideoRotation, VideoFormatType, VideoFrameBufferType)
88
from ._proto.track_pb2 import (TrackKind, TrackSource, StreamState)
9+
from ._proto.room_pb2 import (TrackPublishOptions)
910

1011
from .room import Room
1112
from .participant import (Participant, LocalParticipant, RemoteParticipant)
@@ -17,3 +18,4 @@
1718
from .video_frame import (ArgbFrame, VideoFrame, VideoFrameBuffer, NativeVideoFrameBuffer, PlanarYuvBuffer,
1819
PlanarYuv8Buffer, PlanarYuv16Buffer, I420Buffer, I420ABuffer, I422Buffer, I010Buffer, NV12Buffer)
1920
from .video_stream import VideoStream
21+
from .video_source import VideoSource

livekit/_proto/audio_frame_pb2.py

Lines changed: 32 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

livekit/_proto/audio_frame_pb2.pyi

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,12 @@ class AllocAudioBufferResponse(_message.Message):
3535
def __init__(self, buffer: _Optional[_Union[AudioFrameBufferInfo, _Mapping]] = ...) -> None: ...
3636

3737
class NewAudioStreamRequest(_message.Message):
38-
__slots__ = ["room_handle", "participant_sid", "track_sid", "type"]
39-
ROOM_HANDLE_FIELD_NUMBER: _ClassVar[int]
40-
PARTICIPANT_SID_FIELD_NUMBER: _ClassVar[int]
41-
TRACK_SID_FIELD_NUMBER: _ClassVar[int]
38+
__slots__ = ["track_handle", "type"]
39+
TRACK_HANDLE_FIELD_NUMBER: _ClassVar[int]
4240
TYPE_FIELD_NUMBER: _ClassVar[int]
43-
room_handle: _handle_pb2.FfiHandleId
44-
participant_sid: str
45-
track_sid: str
41+
track_handle: _handle_pb2.FfiHandleId
4642
type: AudioStreamType
47-
def __init__(self, room_handle: _Optional[_Union[_handle_pb2.FfiHandleId, _Mapping]] = ..., participant_sid: _Optional[str] = ..., track_sid: _Optional[str] = ..., type: _Optional[_Union[AudioStreamType, str]] = ...) -> None: ...
43+
def __init__(self, track_handle: _Optional[_Union[_handle_pb2.FfiHandleId, _Mapping]] = ..., type: _Optional[_Union[AudioStreamType, str]] = ...) -> None: ...
4844

4945
class NewAudioStreamResponse(_message.Message):
5046
__slots__ = ["stream"]
@@ -53,10 +49,12 @@ class NewAudioStreamResponse(_message.Message):
5349
def __init__(self, stream: _Optional[_Union[AudioStreamInfo, _Mapping]] = ...) -> None: ...
5450

5551
class NewAudioSourceRequest(_message.Message):
56-
__slots__ = ["type"]
52+
__slots__ = ["type", "options"]
5753
TYPE_FIELD_NUMBER: _ClassVar[int]
54+
OPTIONS_FIELD_NUMBER: _ClassVar[int]
5855
type: AudioSourceType
59-
def __init__(self, type: _Optional[_Union[AudioSourceType, str]] = ...) -> None: ...
56+
options: AudioSourceOptions
57+
def __init__(self, type: _Optional[_Union[AudioSourceType, str]] = ..., options: _Optional[_Union[AudioSourceOptions, _Mapping]] = ...) -> None: ...
6058

6159
class NewAudioSourceResponse(_message.Message):
6260
__slots__ = ["source"]
@@ -119,14 +117,12 @@ class AudioFrameBufferInfo(_message.Message):
119117
def __init__(self, handle: _Optional[_Union[_handle_pb2.FfiHandleId, _Mapping]] = ..., data_ptr: _Optional[int] = ..., num_channels: _Optional[int] = ..., sample_rate: _Optional[int] = ..., samples_per_channel: _Optional[int] = ...) -> None: ...
120118

121119
class AudioStreamInfo(_message.Message):
122-
__slots__ = ["handle", "type", "track_sid"]
120+
__slots__ = ["handle", "type"]
123121
HANDLE_FIELD_NUMBER: _ClassVar[int]
124122
TYPE_FIELD_NUMBER: _ClassVar[int]
125-
TRACK_SID_FIELD_NUMBER: _ClassVar[int]
126123
handle: _handle_pb2.FfiHandleId
127124
type: AudioStreamType
128-
track_sid: str
129-
def __init__(self, handle: _Optional[_Union[_handle_pb2.FfiHandleId, _Mapping]] = ..., type: _Optional[_Union[AudioStreamType, str]] = ..., track_sid: _Optional[str] = ...) -> None: ...
125+
def __init__(self, handle: _Optional[_Union[_handle_pb2.FfiHandleId, _Mapping]] = ..., type: _Optional[_Union[AudioStreamType, str]] = ...) -> None: ...
130126

131127
class AudioStreamEvent(_message.Message):
132128
__slots__ = ["handle", "frame_received"]
@@ -142,6 +138,16 @@ class AudioFrameReceived(_message.Message):
142138
frame: AudioFrameBufferInfo
143139
def __init__(self, frame: _Optional[_Union[AudioFrameBufferInfo, _Mapping]] = ...) -> None: ...
144140

141+
class AudioSourceOptions(_message.Message):
142+
__slots__ = ["echo_cancellation", "noise_suppression", "auto_gain_control"]
143+
ECHO_CANCELLATION_FIELD_NUMBER: _ClassVar[int]
144+
NOISE_SUPPRESSION_FIELD_NUMBER: _ClassVar[int]
145+
AUTO_GAIN_CONTROL_FIELD_NUMBER: _ClassVar[int]
146+
echo_cancellation: bool
147+
noise_suppression: bool
148+
auto_gain_control: bool
149+
def __init__(self, echo_cancellation: bool = ..., noise_suppression: bool = ..., auto_gain_control: bool = ...) -> None: ...
150+
145151
class AudioSourceInfo(_message.Message):
146152
__slots__ = ["handle", "type"]
147153
HANDLE_FIELD_NUMBER: _ClassVar[int]

0 commit comments

Comments
 (0)