From 754c1c677539bd8384aa3c1c6e02f0a6a5d7f32d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Tue, 14 May 2024 19:05:30 -0700 Subject: [PATCH] services: fixed DailyTransport output camera and audio --- CHANGELOG.md | 3 +++ src/pipecat/transports/services/daily.py | 24 ++++++++---------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f90ad29e..f5ab2475d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed an issue with `DailyInputTransport` and `DailyOutputTransport` that + could cause some threads to not start properly. + - Fixed `STTService`. Add `max_silence_secs` and `max_buffer_secs` to handle better what's being passed to the STT service. Also add exponential smoothing to the RMS. diff --git a/src/pipecat/transports/services/daily.py b/src/pipecat/transports/services/daily.py index 02b5d9028..df899cc50 100644 --- a/src/pipecat/transports/services/daily.py +++ b/src/pipecat/transports/services/daily.py @@ -165,7 +165,7 @@ class DailySession(EventHandler): sample_rate=self._params.audio_in_sample_rate, num_channels=self._params.audio_in_channels) - @ property + @property def participant_id(self) -> str: return self._participant_id @@ -416,23 +416,18 @@ class DailyInputTransport(BaseInputTransport): self._camera_in_thread = threading.Thread(target=self._camera_in_thread_handler) async def start(self): - if self._running: - return - + await super().start() self._camera_in_thread.start() await self._session.join() - await super().start() async def stop(self): - await self._session.leave() await super().stop() + await self._session.leave() async def cleanup(self): - self._camera_in_thread.join() - - await self._session.cleanup() - await super().cleanup() + self._camera_in_thread.join() + await self._session.cleanup() def vad_analyze(self, audio_frames: bytes) -> VADState: return self._session.vad_analyze(audio_frames) @@ -523,19 +518,16 @@ class DailyOutputTransport(BaseOutputTransport): self._session = session async def start(self): - if self._running: - return - - await self._session.join() await super().start() + await self._session.join() async def stop(self): - await self._session.leave() await super().stop() + await self._session.leave() async def cleanup(self): - await self._session.cleanup() await super().cleanup() + await self._session.cleanup() def write_raw_audio_frames(self, frames: bytes): self._session.write_raw_audio_frames(frames)