From a3038afa023b4a609fb62dffec21f4da3e780078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Wed, 7 May 2025 11:39:36 -0700 Subject: [PATCH] DailyTransport: fix multiple audio/video sources --- CHANGELOG.md | 3 +++ src/pipecat/transports/services/daily.py | 17 +++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 319dce632..16da15420 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed a `DailyTransport` issue that was causing issues when multiple audio or + video sources where being captured. + - Fixed a `UltravoxSTTService` issue that would cause the service to generate all tokens as one word. diff --git a/src/pipecat/transports/services/daily.py b/src/pipecat/transports/services/daily.py index 5d00e76bc..9118b2107 100644 --- a/src/pipecat/transports/services/daily.py +++ b/src/pipecat/transports/services/daily.py @@ -700,7 +700,7 @@ class DailyTransportClient(EventHandler): await self.update_subscriptions(participant_settings={participant_id: media}) - self._audio_renderers[participant_id] = {audio_source: callback} + self._audio_renderers.setdefault(participant_id, {})[audio_source] = callback self._client.set_audio_renderer( participant_id, @@ -724,7 +724,7 @@ class DailyTransportClient(EventHandler): await self.update_subscriptions(participant_settings={participant_id: media}) - self._video_renderers[participant_id] = {video_source: callback} + self._video_renderers.setdefault(participant_id, {})[video_source] = callback self._client.set_video_renderer( participant_id, @@ -1061,12 +1061,13 @@ class DailyInputTransport(BaseInputTransport): video_source: str = "camera", color_format: str = "RGB", ): - self._video_renderers[participant_id] = { - video_source: { - "framerate": framerate, - "timestamp": 0, - "render_next_frame": [], - } + if participant_id not in self._video_renderers: + self._video_renderers[participant_id] = {} + + self._video_renderers[participant_id][video_source] = { + "framerate": framerate, + "timestamp": 0, + "render_next_frame": [], } await self._client.capture_participant_video(