Ice candidate events emitted a few times, not only one

47 views
Skip to first unread message

chi ngo

unread,
May 24, 2023, 1:01:56 AM5/24/23
to discuss-webrtc
Hi,

I'm a new one in webRtc and I'm trying some samples to get familiar + understand it


I call 2 tabs peer connections are pc1, pc2. Then when I start call in tab 1 first, then in tab 2, I debugged and see tab 1 got 2 messages with type 'candidate', tab 2 got 3 messages with type 'candidate', the last one message of 2 tabs has candidate property null.

So it means:
- pc1 got icecandidate event 3 times (sent 3 message type candidate to tab 2)
- pc2 got icecandidate event 2 times (sent 2 message type candidate to tab 1)

But icecandidate event is emitted only we call setLocalDescription on peer connection so I thought it only happens 1 time.

Can someone help me to explain why I got too many messages with type 'candidate' like this?

Screen Shot 2023-05-24 at 11.04.06.png

Harald Alvestrand

unread,
May 24, 2023, 3:17:09 AM5/24/23
to discuss...@googlegroups.com
You (almost) always get multiple candidates - one per interface on your computer, multiplied by the number of media-sections in offers unless you are bundling with max-bundle - and an empty candidate to indicate that "there are no more candidates coming".


--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/7ff28911-1381-4bf0-b48f-bbba59eb305en%40googlegroups.com.

chi ngo

unread,
May 24, 2023, 9:43:06 AM5/24/23
to discuss-webrtc
Hi @Harald Alvestrand

Thanks so much for your explaining!

Can you point me exactly meanings of the terms you mentioned: "interface", "media-sections in offers"?

I reads the document here  https://developer.mozilla.org/en-US/docs/Web/API/RTCIceCandidate and knows that we can have multiple icecandidates for one peer, depends on the best way to establish the connection to that peer via list icecandidates.

But I still don't know how to calculate exactly number of candidates for a peer. Example in my picture, why the left tab has 2 icecandidates while the right tab has only one.

Screen Shot 2023-05-24 at 16.32.14.png
Reply all
Reply to author
Forward
0 new messages