From 8edfd2679622750dd51351fc9fda8fd089b46bcb Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 4 Sep 2024 11:11:04 +0800 Subject: [PATCH] bugfix --- rtcllm/rtc.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/rtcllm/rtc.py b/rtcllm/rtc.py index 737107e..4fc1197 100644 --- a/rtcllm/rtc.py +++ b/rtcllm/rtc.py @@ -22,13 +22,17 @@ from aav import MyAudioTrack, MyVideoTrack videos = ['./1.mp4', './2.mp4'] async def pc_get_local_candidates(pc, peer): - await pc.__gather() + ts = pc.getTransceivers() + coros = map(lambda t: t.iceGatherer.gather(), ts) + await asyncio.gather(*coros) + if not peer.l_candidates: peer.l_candidates = [] - for c in pc.__iceTransports.local_candidates(): - if c not in peer.l_candidates: - peer.l_candidates.append(c) - pc.emit('icecandidate', c) + for t in ts: + for c in t.local_candidates(): + if c not in peer.l_candidates: + peer.l_candidates.append(c) + pc.emit('icecandidate', c) RTCPeerConnection.get_local_candidates = pc_get_local_candidates