Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
c8f978aa
Commit
c8f978aa
authored
Jul 02, 2008
by
Olivier Crête
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add function to component to force the selection of a remote candidate
parent
ac42e140
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
0 deletions
+67
-0
agent/component.c
agent/component.c
+63
-0
agent/component.h
agent/component.h
+4
-0
No files found.
agent/component.c
View file @
c8f978aa
...
...
@@ -243,3 +243,66 @@ component_find_remote_candidate (const Component *component, const NiceAddress *
return
NULL
;
}
/*
* Sets the desired remote candidate as the selected pair
*
* It will start sending on the highest priority pair available with
* this candidate.
*/
NiceCandidate
*
component_set_selected_remote_candidate
(
NiceAgent
*
agent
,
Component
*
component
,
NiceCandidate
*
candidate
)
{
NiceCandidate
*
local
=
NULL
;
NiceCandidate
*
remote
=
NULL
;
guint32
priority
=
0
;
GSList
*
item
=
NULL
;
for
(
item
=
component
->
local_candidates
;
item
;
item
=
g_slist_next
(
item
))
{
NiceCandidate
*
tmp
=
item
->
data
;
guint32
tmp_prio
=
0
;
if
(
tmp
->
transport
!=
candidate
->
transport
||
tmp
->
addr
.
s
.
addr
.
sa_family
!=
candidate
->
addr
.
s
.
addr
.
sa_family
||
tmp
->
type
!=
NICE_CANDIDATE_TYPE_HOST
)
continue
;
tmp_prio
=
agent_candidate_pair_priority
(
agent
,
tmp
,
candidate
);
if
(
tmp_prio
>
priority
)
{
priority
=
tmp_prio
;
local
=
tmp
;
}
}
if
(
local
==
NULL
)
return
NULL
;
remote
=
component_find_remote_candidate
(
component
,
&
candidate
->
addr
,
candidate
->
transport
);
if
(
!
remote
)
{
GSList
*
modified_list
=
NULL
;
remote
=
nice_candidate_copy
(
candidate
);
modified_list
=
g_slist_append
(
component
->
remote_candidates
,
remote
);
if
(
modified_list
)
{
component
->
remote_candidates
=
modified_list
;
agent_signal_new_remote_candidate
(
agent
,
remote
);
}
else
{
/* error: memory alloc / list */
nice_candidate_free
(
remote
),
remote
=
NULL
;
return
NULL
;
}
}
component
->
selected_pair
.
local
=
local
;
component
->
selected_pair
.
remote
=
remote
;
component
->
selected_pair
.
priority
=
priority
;
return
local
;
}
agent/component.h
View file @
c8f978aa
...
...
@@ -116,6 +116,10 @@ component_update_selected_pair (Component *component, const CandidatePair *pair)
NiceCandidate
*
component_find_remote_candidate
(
const
Component
*
component
,
const
NiceAddress
*
addr
,
NiceCandidateTransport
transport
);
NiceCandidate
*
component_set_selected_remote_candidate
(
NiceAgent
*
agent
,
Component
*
component
,
NiceCandidate
*
candidate
);
G_END_DECLS
#endif
/* _NICE_COMPONENT_H */
...
...
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