bugfix
This commit is contained in:
parent
201687718d
commit
6e151f9399
@ -21,6 +21,17 @@ from aav import MyAudioTrack, MyVideoTrack
|
|||||||
|
|
||||||
videos = ['./1.mp4', './2.mp4']
|
videos = ['./1.mp4', './2.mp4']
|
||||||
|
|
||||||
|
async def pc_get_local_candidates(pc, peer):
|
||||||
|
await pc.__gather()
|
||||||
|
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)
|
||||||
|
|
||||||
|
RTCPeerConnection.get_local_candidates = pc_get_local_candidates
|
||||||
|
|
||||||
class RTCLLM:
|
class RTCLLM:
|
||||||
def __init__(self, ws_url, iceServers):
|
def __init__(self, ws_url, iceServers):
|
||||||
self.stt_model = WhisperModel('large-v3', device="cuda", compute_type="float16")
|
self.stt_model = WhisperModel('large-v3', device="cuda", compute_type="float16")
|
||||||
@ -152,6 +163,7 @@ class RTCLLM:
|
|||||||
|
|
||||||
async def response_offer(self, data):
|
async def response_offer(self, data):
|
||||||
pc = self.get_pc(data)
|
pc = self.get_pc(data)
|
||||||
|
peer = self.peers[data['from'].id]
|
||||||
if pc is None:
|
if pc is None:
|
||||||
print(f'{self.peers=}, {data=}')
|
print(f'{self.peers=}, {data=}')
|
||||||
return
|
return
|
||||||
@ -169,7 +181,7 @@ class RTCLLM:
|
|||||||
'answer':{'type':pc.localDescription.type, 'sdp':pc.localDescription.sdp},
|
'answer':{'type':pc.localDescription.type, 'sdp':pc.localDescription.sdp},
|
||||||
'to':data['from']
|
'to':data['from']
|
||||||
}))
|
}))
|
||||||
cands = await pc.gather_candidates()
|
cands = await pc.get_local_candidates(peer)
|
||||||
for c in cands:
|
for c in cands:
|
||||||
await self.send_candidate(data['from'], c)
|
await self.send_candidate(data['from'], c)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user