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
29a33974
Commit
29a33974
authored
Nov 04, 2008
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change msn/jingle priority into a guint32 instead of a float that we * 1000 later
parent
e3d8fbf9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
27 deletions
+25
-27
agent/candidate.c
agent/candidate.c
+13
-15
agent/candidate.h
agent/candidate.h
+2
-2
agent/discovery.c
agent/discovery.c
+9
-9
agent/test-priority.c
agent/test-priority.c
+1
-1
No files found.
agent/candidate.c
View file @
29a33974
...
...
@@ -83,30 +83,30 @@ nice_candidate_free (NiceCandidate *candidate)
}
NICEAPI_EXPORT
gfloat
guint32
nice_candidate_jingle_priority
(
NiceCandidate
*
candidate
)
{
switch
(
candidate
->
type
)
{
case
NICE_CANDIDATE_TYPE_HOST
:
return
1
.
0
;
case
NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE
:
return
0
.
9
;
case
NICE_CANDIDATE_TYPE_PEER_REFLEXIVE
:
return
0
.
9
;
case
NICE_CANDIDATE_TYPE_RELAYED
:
return
0
.
5
;
case
NICE_CANDIDATE_TYPE_HOST
:
return
1
00
0
;
case
NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE
:
return
900
;
case
NICE_CANDIDATE_TYPE_PEER_REFLEXIVE
:
return
900
;
case
NICE_CANDIDATE_TYPE_RELAYED
:
return
500
;
}
/* appease GCC */
return
0
;
}
NICEAPI_EXPORT
gfloat
guint32
nice_candidate_msn_priority
(
NiceCandidate
*
candidate
)
{
switch
(
candidate
->
type
)
{
case
NICE_CANDIDATE_TYPE_HOST
:
return
0
.
830
;
case
NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE
:
return
0
.
550
;
case
NICE_CANDIDATE_TYPE_PEER_REFLEXIVE
:
return
0
.
550
;
case
NICE_CANDIDATE_TYPE_RELAYED
:
return
0
.
450
;
case
NICE_CANDIDATE_TYPE_HOST
:
return
830
;
case
NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE
:
return
550
;
case
NICE_CANDIDATE_TYPE_PEER_REFLEXIVE
:
return
550
;
case
NICE_CANDIDATE_TYPE_RELAYED
:
return
450
;
}
/* appease GCC */
...
...
@@ -118,8 +118,7 @@ nice_candidate_msn_priority (NiceCandidate *candidate)
* ICE 4.1.2.1. "Recommended Formula" (ID-19):
* returns number between 1 and 0x7effffff
*/
G_GNUC_CONST
NICEAPI_EXPORT
guint32
guint32
nice_candidate_ice_priority_full
(
// must be ∈ (0, 126) (max 2^7 - 2)
guint
type_preference
,
...
...
@@ -135,8 +134,7 @@ nice_candidate_ice_priority_full (
}
G_GNUC_CONST
NICEAPI_EXPORT
guint32
guint32
nice_candidate_ice_priority
(
const
NiceCandidate
*
candidate
)
{
guint8
type_preference
=
0
;
...
...
@@ -161,7 +159,7 @@ nice_candidate_ice_priority (const NiceCandidate *candidate)
* Calculates the pair priority as specified in ICE
* sect 5.7.2. "Computing Pair Priority and Ordering Pairs" (ID-19).
*/
NICEAPI_EXPORT
guint64
guint64
nice_candidate_pair_priority
(
guint32
o_prio
,
guint32
a_prio
)
{
guint32
max
=
o_prio
>
a_prio
?
o_prio
:
a_prio
;
...
...
agent/candidate.h
View file @
29a33974
...
...
@@ -212,10 +212,10 @@ NiceCandidate *
nice_candidate_copy
(
const
NiceCandidate
*
candidate
);
g
float
g
uint32
nice_candidate_jingle_priority
(
NiceCandidate
*
candidate
);
g
float
g
uint32
nice_candidate_msn_priority
(
NiceCandidate
*
candidate
);
guint32
...
...
agent/discovery.c
View file @
29a33974
...
...
@@ -398,9 +398,9 @@ NiceCandidate *discovery_add_local_host_candidate (
candidate
->
addr
=
*
address
;
candidate
->
base_addr
=
*
address
;
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
)
*
1000
;
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
)
*
1000
;
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
);
}
else
{
candidate
->
priority
=
nice_candidate_ice_priority
(
candidate
);
}
...
...
@@ -478,9 +478,9 @@ discovery_add_server_reflexive_candidate (
candidate
=
nice_candidate_new
(
NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE
);
if
(
candidate
)
{
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
)
*
1000
;
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
)
*
1000
;
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
);
}
else
{
candidate
->
priority
=
nice_candidate_ice_priority_full
(
NICE_CANDIDATE_TYPE_PREF_SERVER_REFLEXIVE
,
0
,
component_id
);
...
...
@@ -538,9 +538,9 @@ discovery_add_relay_candidate (
candidate
=
nice_candidate_new
(
NICE_CANDIDATE_TYPE_RELAYED
);
if
(
candidate
)
{
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
)
*
1000
;
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
)
*
1000
;
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
);
}
else
{
candidate
->
priority
=
nice_candidate_ice_priority_full
(
NICE_CANDIDATE_TYPE_PREF_RELAYED
,
0
,
component_id
);
...
...
@@ -624,9 +624,9 @@ discovery_add_peer_reflexive_candidate (
candidate
->
transport
=
NICE_CANDIDATE_TRANSPORT_UDP
;
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
)
*
1000
;
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
)
*
1000
;
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
);
}
else
{
candidate
->
priority
=
nice_candidate_ice_priority_full
(
NICE_CANDIDATE_TYPE_PREF_PEER_REFLEXIVE
,
0
,
component_id
);
...
...
agent/test-priority.c
View file @
29a33974
...
...
@@ -48,7 +48,7 @@ main (void)
/* test 1 */
candidate
=
nice_candidate_new
(
NICE_CANDIDATE_TYPE_HOST
);
g_assert
(
nice_candidate_ice_priority
(
candidate
)
==
0x78000200
);
g_assert
(
nice_candidate_jingle_priority
(
candidate
)
==
1
.
0
);
g_assert
(
nice_candidate_jingle_priority
(
candidate
)
==
1
00
0
);
nice_candidate_free
(
candidate
);
/* test 2 */
...
...
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