Skip to content

Commit

Permalink
check to avoid double-join
Browse files Browse the repository at this point in the history
  • Loading branch information
kwindla committed Dec 8, 2024
1 parent e9f5fe0 commit 315b7fc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/pipecat/transports/services/daily.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def __init__(
self._other_participant_has_joined = False

self._joined = False
self._joining = False
self._leave_counter = 0

self._executor = ThreadPoolExecutor(max_workers=5)
Expand Down Expand Up @@ -314,11 +315,12 @@ async def write_frame_to_camera(self, frame: OutputImageRawFrame):

async def join(self):
# Transport already joined, ignore.
if self._joined:
if self._joined or self._joining:
# Increment leave counter if we already joined.
self._leave_counter += 1
return

self._joining = True
logger.info(f"Joining {self._room_url}")

# For performance reasons, never subscribe to video streams (unless a
Expand Down Expand Up @@ -351,10 +353,11 @@ async def join(self):
error_msg = f"Time out joining {self._room_url}"
logger.error(error_msg)
await self._callbacks.on_error(error_msg)
self._joining = False

async def _start_transcription(self):
if not self._token:
logger.warning(f"Transcription can't be started without a room token")
logger.warning("Transcription can't be started without a room token")
return

logger.info(f"Enabling transcription with settings {self._params.transcription_settings}")
Expand Down

0 comments on commit 315b7fc

Please sign in to comment.