44from dataclasses import dataclass
55from typing import AsyncIterator , Optional
66from .audio_frame import AudioFrame
7- from .audio_stream import AudioFrameEvent
87from .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 )
0 commit comments