Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mediastreamer2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
External Wiki
External Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BC
public
mediastreamer2
Commits
074d897e
Commit
074d897e
authored
Jul 24, 2012
by
Ghislain MARY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add function to eliminate ICE redundant candidates.
parent
91bc2e61
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
ice.h
include/mediastreamer2/ice.h
+10
-0
ice.c
src/ice.c
+46
-0
No files found.
include/mediastreamer2/ice.h
View file @
074d897e
...
...
@@ -466,6 +466,16 @@ void ice_session_set_base_for_srflx_candidates(IceSession *session);
*/
MS2_PUBLIC
void
ice_session_compute_candidates_foundations
(
IceSession
*
session
);
/**
* Eliminate the redundant candidates of an ICE session.
*
* @param session A pointer to a session
*
* This function is to be called at the end of the local candidates gathering process, before sending
* the SDP to the remote agent.
*/
MS2_PUBLIC
void
ice_session_eliminate_redundant_candidates
(
IceSession
*
session
);
/**
* Choose the default candidates of an ICE session.
*
...
...
src/ice.c
View file @
074d897e
...
...
@@ -1469,6 +1469,52 @@ void ice_session_compute_candidates_foundations(IceSession *session)
}
/******************************************************************************
* ELIMINATE REDUNDANT CANDIDATES *
*****************************************************************************/
static
int
ice_find_redundant_candidate
(
const
IceCandidate
*
c1
,
const
IceCandidate
*
c2
)
{
if
(
c1
==
c2
)
return
1
;
return
!
(
!
ice_compare_transport_addresses
(
&
c1
->
taddr
,
&
c2
->
taddr
)
&&
(
c1
->
base
==
c2
->
base
));
}
static
void
ice_check_list_eliminate_redundant_candidates
(
IceCheckList
*
cl
)
{
MSList
*
elem
;
MSList
*
other_elem
;
IceCandidate
*
candidate
;
IceCandidate
*
other_candidate
;
bool_t
elem_removed
;
do
{
elem_removed
=
FALSE
;
/* Do not use ms_list_for_each2() here, we may remove list elements. */
for
(
elem
=
cl
->
local_candidates
;
elem
!=
NULL
;
elem
=
elem
->
next
)
{
candidate
=
(
IceCandidate
*
)
elem
->
data
;
other_elem
=
ms_list_find_custom
(
cl
->
local_candidates
,
(
MSCompareFunc
)
ice_find_redundant_candidate
,
candidate
);
if
(
other_elem
!=
NULL
)
{
other_candidate
=
(
IceCandidate
*
)
other_elem
->
data
;
if
(
other_candidate
->
priority
<
candidate
->
priority
)
{
ice_free_candidate
(
other_candidate
);
cl
->
local_candidates
=
ms_list_remove_link
(
cl
->
local_candidates
,
other_elem
);
}
else
{
ice_free_candidate
(
candidate
);
cl
->
local_candidates
=
ms_list_remove_link
(
cl
->
local_candidates
,
elem
);
}
elem_removed
=
TRUE
;
break
;
}
}
}
while
(
elem_removed
);
}
void
ice_session_eliminate_redundant_candidates
(
IceSession
*
session
)
{
ms_list_for_each
(
session
->
streams
,
(
void
(
*
)(
void
*
))
ice_check_list_eliminate_redundant_candidates
);
}
/******************************************************************************
* CHOOSE DEFAULT CANDIDATES *
*****************************************************************************/
...
...
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