Skip to content

Commit 7a3e04b

Browse files
committed
revert changes to audio mixer as we no longer need it to handle AudioFrameEvent
1 parent 4a85e01 commit 7a3e04b

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

livekit-rtc/livekit/rtc/audio_mixer.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from dataclasses import dataclass
55
from typing import AsyncIterator, Optional
66
from .audio_frame import AudioFrame
7-
from .audio_stream import AudioFrameEvent
87
from .log import logger
98

109
_Stream = AsyncIterator[AudioFrame]
@@ -170,7 +169,7 @@ async def _mixer(self) -> None:
170169
await self._queue.put(None)
171170

172171
async def _get_contribution(
173-
self, stream: AsyncIterator[AudioFrame | AudioFrameEvent], buf: np.ndarray
172+
self, stream: AsyncIterator[AudioFrame], buf: np.ndarray
174173
) -> _Contribution:
175174
had_data = buf.shape[0] > 0
176175
exhausted = False
@@ -185,10 +184,6 @@ async def _get_contribution(
185184
except StopAsyncIteration:
186185
exhausted = True
187186
break
188-
# AudioStream may yield either AudioFrame or AudioFrameEvent; unwrap if needed
189-
if hasattr(frame, "frame"):
190-
frame = frame.frame # type: ignore[assignment]
191-
192187
new_data = np.frombuffer(frame.data.tobytes(), dtype=np.int16).reshape(
193188
-1, self._num_channels
194189
)
@@ -202,4 +197,4 @@ async def _get_contribution(
202197
np.concatenate((buf, pad), axis=0),
203198
np.empty((0, self._num_channels), dtype=np.int16),
204199
)
205-
return _Contribution(stream, contrib, buf, had_data, exhausted)
200+
return _Contribution(stream, contrib, buf, had_data, exhausted)

livekit-rtc/livekit/rtc/media_devices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from typing import Any, Optional
2020

2121
import numpy as np
22-
import sounddevice as sd
22+
import sounddevice as sd # type: ignore[import-untyped]
2323
import threading
2424

2525
from . import AudioSource

0 commit comments

Comments
 (0)