task: don't use push queue to send a heartbeat

This is because we might be waiting for the EndFrame. Currently, if we push an
EndFrame to the task, the task will block until the EndFrame traverses all the
pipeline.
This commit is contained in:
Aleix Conchillo Flaqué
2025-01-17 10:04:24 -08:00
parent da0c4cfd99
commit 4b3c776f58

View File

@@ -338,7 +338,10 @@ class PipelineTask:
"""
while True:
try:
await self.queue_frame(HeartbeatFrame(timestamp=self._clock.get_time()))
# Don't use `queue_frame()` because if an EndFrame is queued the
# task will just stop waiting for the pipeline to finish not
# allowing more frames to be pushed.
await self._source.queue_frame(HeartbeatFrame(timestamp=self._clock.get_time()))
await asyncio.sleep(HEARTBEAT_SECONDS)
except asyncio.CancelledError:
break