6. ICE Candidate Processing
This section describes how an ICE agent processes candidate information received from the peer.
6.1. Procedures for Full Implementation
6.1.1. Determining Role
For each session, each ICE agent takes on a role. There are two roles -- controlling and controlled. The controlling agent is responsible for the choice of the final candidate pairs used for communications.
The initiating agent that started the ICE processing MUST take the controlling role, and the other MUST take the controlled role.
6.1.2. Forming Candidate Pairs
The ICE agent forms candidate pairs by pairing its own candidates (local candidates) with the candidates it received from the peer (remote candidates).
6.1.3. Computing Pair Priority and Ordering Pairs
The priority for a candidate pair is computed using the formula:
pair priority = 2^32 * MIN(G,D) + 2 * MAX(G,D) + (G>D?1:0)
Where G is the priority of the controlling agent's candidate and D is the priority of the controlled agent's candidate.
6.1.4. Pruning the Pairs
The agent will prune the candidate pair list to eliminate redundancy and limit the number of connectivity checks to be performed.