Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
mediastreamer2
Commits
8203e8ad
Commit
8203e8ad
authored
Jul 11, 2012
by
Ghislain MARY
Browse files
Update ICE candidate pair states when receiving binding response.
parent
098e6704
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
src/ice.c
src/ice.c
+27
-0
No files found.
src/ice.c
View file @
8203e8ad
...
...
@@ -886,6 +886,32 @@ static IceCandidatePair * ice_construct_valid_pair(IceCheckList *cl, RtpSession
return
pair
;
}
static
int
ice_compare_pair_foundations
(
IceCandidatePair
*
p1
,
IceCandidatePair
*
p2
)
{
return
!
((
strlen
(
p1
->
local
->
foundation
)
==
strlen
(
p2
->
local
->
foundation
))
&&
(
strcmp
(
p1
->
local
->
foundation
,
p2
->
local
->
foundation
)
==
0
)
&&
((
strlen
(
p1
->
remote
->
foundation
)
==
strlen
(
p2
->
remote
->
foundation
))
&&
(
strcmp
(
p1
->
remote
->
foundation
,
p2
->
remote
->
foundation
)
==
0
)));
}
static
void
ice_change_state_of_frozen_pairs_to_waiting
(
IceCandidatePair
*
pair
,
IceCandidatePair
*
succeeded_pair
)
{
if
((
pair
!=
succeeded_pair
)
&&
(
pair
->
state
==
ICP_Frozen
)
&&
(
ice_compare_pair_foundations
(
pair
,
succeeded_pair
)
==
0
))
{
ms_message
(
"Change state of pair %p from Frozen to Waiting"
,
pair
);
ice_pair_set_state
(
pair
,
ICP_Waiting
);
}
}
/* Update the pair states according to 7.1.3.2.3. */
static
void
ice_update_pair_states_on_binding_response
(
IceCheckList
*
cl
,
IceCandidatePair
*
pair
)
{
/* Set the state of the pair that generated the check to Succeeded. */
ice_pair_set_state
(
pair
,
ICP_Succeeded
);
/* Change the state of all Frozen pairs with the same foundation to Waiting. */
ms_list_for_each2
(
cl
->
pairs
,
(
void
(
*
)(
void
*
,
void
*
))
ice_change_state_of_frozen_pairs_to_waiting
,
pair
);
// TODO: If there is a pair in the valid list for every component of this media stream, unfreeze checks for other media streams
}
static
void
ice_handle_received_binding_response
(
IceCheckList
*
cl
,
RtpSession
*
rtp_session
,
const
StunMessage
*
msg
,
const
StunAddress4
*
remote_addr
)
{
IceCandidatePair
*
pair
;
...
...
@@ -906,6 +932,7 @@ static void ice_handle_received_binding_response(IceCheckList *cl, RtpSession *r
}
else
{
ice_construct_valid_pair
(
cl
,
rtp_session
,
NULL
,
pair
->
remote
);
}
ice_update_pair_states_on_binding_response
(
cl
,
pair
);
}
static
void
ice_handle_received_error_response
(
IceCheckList
*
cl
,
const
StunMessage
*
msg
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment