Skip to content

Commit

Permalink
expose sample_rate & num_channels of AudioSource (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
theomonnom authored Mar 31, 2024
1 parent 75d0367 commit c19f24a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions livekit-rtc/livekit/rtc/audio_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit c19f24a

Please sign in to comment.