Skip to content

Commit 9e8a09b

Browse files
authored
add user_data to AudioFrame (#456)
1 parent 30ac4e9 commit 9e8a09b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

livekit-rtc/livekit/rtc/audio_frame.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def __init__(
6464
self._sample_rate = sample_rate
6565
self._num_channels = num_channels
6666
self._samples_per_channel = samples_per_channel
67+
self._userdata: dict[str, Any] = {}
6768

6869
@staticmethod
6970
def create(sample_rate: int, num_channels: int, samples_per_channel: int) -> "AudioFrame":
@@ -100,6 +101,13 @@ def _proto_info(self) -> proto_audio.AudioFrameBufferInfo:
100101
audio_info.samples_per_channel = self.samples_per_channel
101102
return audio_info
102103

104+
@property
105+
def userdata(self) -> dict[str, Any]:
106+
"""
107+
Returns the user data associated with the audio frame.
108+
"""
109+
return self._userdata
110+
103111
@property
104112
def data(self) -> memoryview:
105113
"""

0 commit comments

Comments
 (0)