From c19f24a88a73d8e28e141b96fb2dca328d092a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Monnom?= Date: Mon, 1 Apr 2024 00:27:52 +0200 Subject: [PATCH] expose sample_rate & num_channels of AudioSource (#183) --- livekit-rtc/livekit/rtc/audio_source.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/livekit-rtc/livekit/rtc/audio_source.py b/livekit-rtc/livekit/rtc/audio_source.py index 25d0dc47..4419062a 100644 --- a/livekit-rtc/livekit/rtc/audio_source.py +++ b/livekit-rtc/livekit/rtc/audio_source.py @@ -27,10 +27,21 @@ def __init__(self, sample_rate: int, num_channels: int) -> None: req.new_audio_source.sample_rate = sample_rate req.new_audio_source.num_channels = num_channels + self._sample_rate = sample_rate + self._num_channels = num_channels + resp = FfiClient.instance.request(req) self._info = resp.new_audio_source.source self._ffi_handle = FfiHandle(self._info.handle.id) + @property + def sample_rate(self) -> int: + return self._sample_rate + + @property + def num_channels(self) -> int: + return self._num_channels + async def capture_frame(self, frame: AudioFrame) -> None: """Captures an AudioFrame.