ICE select wrong pair
I meet an ICE problem between webrtc(controlling) and sfu using libnice.
The webrtc endpoint gathering three relay candidate with different priority and the sfu endpoint gathering one relay candidate.
But I analyze the logfile, I found when three pairs in sfu are frozen state, but receive a binding request(with use_candidate) with lowest priority, after create permission with turn, we select this lowest priority pair, then CANCELED another two pairs, then only send the binding response to another two pairs(No binding request sent). But the webrtc endpoint use the highest priority pairs which receive the binding request response.
webrtc Cand 1(high priority) ----------> SFU Cand
^
webrtc Cand 2(low priority) ------------------+
The flow is:
Cand 2 -- binding request -----------> SFU Cand (Pair 1 & 2 in FROZEN)
Set Cand 2 to IN_PROGRESS
SFU create permission with TURN
<- binding request response ---
<- binding request -------------
Cand 2 -- binding request response --->
SFU select pair with Cand 2
CANCELED pair 1
Cand 1 -- binding request ------------->
<- binding request response -----
WebRTC select pair with Cand 1
Then we use the different pair.
Question: When we initial the pair, always in FROZEN state and waiting for timer to set ONE pair to IN_PROGRESS, is that too slow for two sides state synchronize, Or should I set some property?