Commit 93db1aac authored by aymeric's avatar aymeric

cont work on role and tie-break value

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@292 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent d8af85a4
......@@ -435,9 +435,14 @@ int ice_process_stun_message(RtpSession *session, struct CandidatePair *remote_c
int pos;
for (pos=0;pos<10 && remote_candidates[pos].remote_candidate.conn_addr[0]!='\0';pos++)
{
/* controller agent */
int G = remote_candidates[pos].remote_candidate.priority;
/* controlled agent */
int D = remote_candidates[pos].local_candidate.priority;
remote_candidates[pos].pair_priority = (UInt64)pow((double)2,(double)32)*MIN(G,D) + 2*MAX(G,D) + (G>D?1:0);
remote_candidates[pos].rem_controlling = 1;
}
/* TODO: compute again priority */
}
}
......@@ -450,9 +455,14 @@ int ice_process_stun_message(RtpSession *session, struct CandidatePair *remote_c
int pos;
for (pos=0;pos<10 && remote_candidates[pos].remote_candidate.conn_addr[0]!='\0';pos++)
{
/* controller agent */
int G = remote_candidates[pos].local_candidate.priority;
/* controlled agent */
int D = remote_candidates[pos].remote_candidate.priority;
remote_candidates[pos].pair_priority = (UInt64)pow((double)2,(double)32)*MIN(G,D) + 2*MAX(G,D) + (G>D?1:0);
remote_candidates[pos].rem_controlling = 0;
}
/* TODO: compute again priority */
}
else {
char buf[STUN_MAX_MESSAGE_SIZE];
......@@ -614,11 +624,34 @@ int ice_process_stun_message(RtpSession *session, struct CandidatePair *remote_c
if (resp.hasErrorCode==TRUE && resp.errorCode.errorClass==4 && resp.errorCode.number==87)
{
/* change role */
if (remote_candidates[0].rem_controlling==1)
remote_candidates[0].rem_controlling=0;
if (remote_candidates[pos].rem_controlling==1)
{
int pos2;
for (pos2=0;pos2<10 && remote_candidates[pos2].remote_candidate.conn_addr[0]!='\0';pos2++)
{
/* controller agent */
int G = remote_candidates[pos2].local_candidate.priority;
/* controlled agent */
int D = remote_candidates[pos2].remote_candidate.priority;
remote_candidates[pos2].pair_priority = (UInt64)pow((double)2,(double)32)*MIN(G,D) + 2*MAX(G,D) + (G>D?1:0);
remote_candidates[pos2].rem_controlling=0;
}
}
else
remote_candidates[0].rem_controlling=1;
/* TODO: compute again priority */
{
int pos2;
for (pos2=0;pos2<10 && remote_candidates[pos2].remote_candidate.conn_addr[0]!='\0';pos2++)
{
/* controller agent */
int G = remote_candidates[pos2].remote_candidate.priority;
/* controlled agent */
int D = remote_candidates[pos2].local_candidate.priority;
remote_candidates[pos2].pair_priority = (UInt64)pow((double)2,(double)32)*MIN(G,D) + 2*MAX(G,D) + (G>D?1:0);
remote_candidates[pos2].rem_controlling=1;
}
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment