@@ -149,13 +149,14 @@ def add_transport_description(
149
149
media .dtls .fingerprints = dtlsTransport .getLocalParameters ().fingerprints
150
150
151
151
152
- def add_remote_candidates (
152
+ async def add_remote_candidates (
153
153
iceTransport : RTCIceTransport , media : sdp .MediaDescription
154
154
) -> None :
155
- for candidate in media .ice_candidates :
156
- iceTransport .addRemoteCandidate (candidate )
155
+ coros = map (iceTransport .addRemoteCandidate , media .ice_candidates )
156
+ await asyncio .gather (* coros )
157
+
157
158
if media .ice_candidates_complete :
158
- iceTransport .addRemoteCandidate (None )
159
+ await iceTransport .addRemoteCandidate (None )
159
160
160
161
161
162
def allocate_mid (mids : Set [str ]) -> str :
@@ -335,7 +336,7 @@ def sctp(self) -> Optional[RTCSctpTransport]:
335
336
def signalingState (self ):
336
337
return self .__signalingState
337
338
338
- def addIceCandidate (self , candidate : RTCIceCandidate ) -> None :
339
+ async def addIceCandidate (self , candidate : RTCIceCandidate ) -> None :
339
340
"""
340
341
Add a new :class:`RTCIceCandidate` received from the remote peer.
341
342
@@ -349,7 +350,7 @@ def addIceCandidate(self, candidate: RTCIceCandidate) -> None:
349
350
for transceiver in self .__transceivers :
350
351
if candidate .sdpMid == transceiver .mid and not transceiver ._bundled :
351
352
iceTransport = transceiver ._transport .transport
352
- iceTransport .addRemoteCandidate (candidate )
353
+ await iceTransport .addRemoteCandidate (candidate )
353
354
return
354
355
355
356
if (
@@ -358,7 +359,7 @@ def addIceCandidate(self, candidate: RTCIceCandidate) -> None:
358
359
and not self .__sctp ._bundled
359
360
):
360
361
iceTransport = self .__sctp .transport .transport
361
- iceTransport .addRemoteCandidate (candidate )
362
+ await iceTransport .addRemoteCandidate (candidate )
362
363
363
364
def addTrack (self , track : MediaStreamTrack ) -> RTCRtpSender :
364
365
"""
@@ -835,7 +836,7 @@ async def setRemoteDescription(
835
836
if dtlsTransport is not None :
836
837
# add ICE candidates
837
838
iceTransport = dtlsTransport .transport
838
- add_remote_candidates (iceTransport , media )
839
+ await add_remote_candidates (iceTransport , media )
839
840
840
841
# set ICE role
841
842
if description .type == "offer" and not iceTransport ._role_set :
0 commit comments