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
d81819dd
Commit
d81819dd
authored
Jul 31, 2012
by
Ghislain MARY
Browse files
Prevent adding duplicate ICE candidates.
parent
446e4058
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
src/ice.c
src/ice.c
+10
-0
No files found.
src/ice.c
View file @
d81819dd
...
...
@@ -105,6 +105,8 @@ extern void rtp_session_dispatch_event(RtpSession *session, OrtpEvent *ev);
static
void
ice_send_stun_server_binding_request
(
ortp_socket_t
sock
,
const
struct
sockaddr
*
server
,
socklen_t
addrlen
,
int
id
);
static
int
ice_compare_transport_addresses
(
const
IceTransportAddress
*
ta1
,
const
IceTransportAddress
*
ta2
);
static
int
ice_compare_pair_priorities
(
const
IceCandidatePair
*
p1
,
const
IceCandidatePair
*
p2
);
static
int
ice_compare_pairs
(
const
IceCandidatePair
*
p1
,
const
IceCandidatePair
*
p2
);
static
int
ice_compare_candidates
(
const
IceCandidate
*
c1
,
const
IceCandidate
*
c2
);
static
int
ice_find_host_candidate
(
const
IceCandidate
*
candidate
,
const
uint16_t
*
componentID
);
static
int
ice_find_nominated_valid_pair_from_componentID
(
const
IceValidCandidatePair
*
valid_pair
,
const
uint16_t
*
componentID
);
static
void
ice_pair_set_state
(
IceCandidatePair
*
pair
,
IceCandidatePairState
state
);
...
...
@@ -1543,6 +1545,7 @@ void ice_handle_stun_packet(IceCheckList *cl, RtpSession *rtp_session, const Ort
static
IceCandidate
*
ice_add_candidate
(
MSList
**
list
,
const
char
*
type
,
const
char
*
ip
,
int
port
,
uint16_t
componentID
)
{
MSList
*
elem
;
IceCandidate
*
candidate
;
IceCandidateType
candidate_type
;
int
iplen
;
...
...
@@ -1587,6 +1590,13 @@ static IceCandidate * ice_add_candidate(MSList **list, const char *type, const c
break
;
}
elem
=
ms_list_find_custom
(
*
list
,
(
MSCompareFunc
)
ice_compare_candidates
,
candidate
);
if
(
elem
!=
NULL
)
{
/* This candidate is already in the list, do not add it again. */
ms_free
(
candidate
);
return
NULL
;
}
*
list
=
ms_list_append
(
*
list
,
candidate
);
return
candidate
;
}
...
...
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