transports: allows update allow_interruptinos when receiving StartFrame

This commit is contained in:
Aleix Conchillo Flaqué
2024-05-17 14:15:37 -07:00
parent 57121338b1
commit 34762bf604
2 changed files with 10 additions and 2 deletions

View File

@@ -44,11 +44,15 @@ class BaseInputTransport(FrameProcessor):
self._create_push_task()
async def start(self, frame: StartFrame):
# Make sure we have the latest params. Note that this transport might
# have been started on another task that might not need interruptions,
# for example.
self._allow_interruptions = frame.allow_interruptions
if self._running:
return
self._running = True
self._allow_interruptions = frame.allow_interruptions
if self._params.audio_in_enabled or self._params.vad_enabled:
loop = self.get_event_loop()

View File

@@ -54,11 +54,15 @@ class BaseOutputTransport(FrameProcessor):
self._is_interrupted = threading.Event()
async def start(self, frame: StartFrame):
# Make sure we have the latest params. Note that this transport might
# have been started on another task that might not need interruptions,
# for example.
self._allow_interruptions = frame.allow_interruptions
if self._running:
return
self._running = True
self._allow_interruptions = frame.allow_interruptions
loop = self.get_event_loop()