Skip to main content

4.1.19. addIceCandidate

4.1.19. addIceCandidate

The addIceCandidate method provides an update to the ICE agent via an IceCandidate object (Section 3.5.2.1). If the IceCandidate's candidate field is non-null, the IceCandidate is treated as a new remote ICE candidate, which will be added to the current and/or pending remote description according to the rules defined for Trickle ICE. Otherwise, the IceCandidate is treated as an end-of-candidates indication, as defined in [RFC8838], Section 14.

In either case, the "m=" section index, MID, and ufrag fields from the supplied IceCandidate are used to determine which "m=" section and ICE candidate generation the IceCandidate belongs to, as described in Section 3.5.2.1 above. In the case of an end-of-candidates indication, null values for the "m=" section index and MID fields are interpreted to mean that the indication applies to all "m=" sections in the specified ICE candidate generation. However, if both fields are null for a new remote candidate, this MUST be treated as an invalid condition, as specified below.

If any IceCandidate fields contain invalid values or an error occurs during the processing of the IceCandidate object, the supplied IceCandidate MUST be ignored and an error MUST be returned.

Otherwise, the new remote candidate or end-of-candidates indication is supplied to the ICE agent. In the case of a new remote candidate, connectivity checks will be sent to the new candidate, assuming setLocalDescription has already been called to initialize the ICE gathering process.