Skip to content

Commit b10c8d9

Browse files
committed
Agent: start audio producing task only when publishing audio
1 parent d720c6a commit b10c8d9

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • agents-core/vision_agents/core/agents

agents-core/vision_agents/core/agents/agents.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,10 @@ async def join(
529529
self._audio_consumer_task = asyncio.create_task(
530530
self._consume_incoming_audio()
531531
)
532-
self._audio_producer_task = asyncio.create_task(
533-
self._produce_audio_output()
534-
)
532+
if self.publish_audio:
533+
self._audio_producer_task = asyncio.create_task(
534+
self._produce_audio_output()
535+
)
535536

536537
# Start metrics broadcast if enabled
537538
if self._broadcast_metrics:
@@ -890,7 +891,7 @@ async def _consume_incoming_audio(self) -> None:
890891

891892
async def _produce_audio_output(self):
892893
if self._audio_track is None:
893-
raise ValueError("Output audio track is not set")
894+
return
894895

895896
try:
896897
while self._call_ended_event and not self._call_ended_event.is_set():

0 commit comments

Comments
 (0)