transports(daily): avoid locking if no participant has joined yet

This commit is contained in:
Aleix Conchillo Flaqué
2024-05-15 15:23:24 -07:00
parent acf6dc0a30
commit 349fc526d7
2 changed files with 11 additions and 1 deletions

View File

@@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed an issue in `DailyTransport` that would not allow the processor to
shutdown if no participant ever joined the room.
- Fixed transport start and stop. In some situation processors would halt or not
shutdown properly.

View File

@@ -182,7 +182,14 @@ class DailyTransportClient(EventHandler):
self._client.send_app_message(frame.message, frame.participant_id)
def read_raw_audio_frames(self, frame_count: int) -> bytes:
return self._speaker.read_frames(frame_count)
if self._other_participant_has_joined:
return self._speaker.read_frames(frame_count)
else:
# If no one has ever joined the meeting `read_frames()` would block,
# instead we just wait a bit. daily-python should probably return
# silence instead.
time.sleep(0.01)
return b''
def write_raw_audio_frames(self, frames: bytes):
self._mic.write_frames(frames)