diff options
author | Fabrice Bellet <fabrice@bellet.info> | 2020-02-08 22:00:57 +0100 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@ocrete.ca> | 2020-02-13 21:27:46 +0000 |
commit | bbcf82b3fcdc8240aa653252210d3005eb087d46 (patch) | |
tree | 5e4fc31d83c99cb8a273a94cbf7abe89554469ea /agent/candidate.c | |
parent | 76f6df3c5358332127032fc222a218b113659dae (diff) | |
download | libnice-bbcf82b3fcdc8240aa653252210d3005eb087d46.tar.gz |
conncheck: display priorities in debug by spliting their values
We display 32-bit candidate priorities in hexadecimal to identify each
8-bit-aligned field more easily: type preference, local preference, and
component id. We display 64-bit pair priority by splitting their local
and remote part. See RFC-8445, section 5.1.2.1. "Recommended Formula",
and section 6.1.2.3. "Computing Pair Priority and Ordering Pairs".
Diffstat (limited to 'agent/candidate.c')
-rw-r--r-- | agent/candidate.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/agent/candidate.c b/agent/candidate.c index aa4e1a4..b6e7012 100644 --- a/agent/candidate.c +++ b/agent/candidate.c @@ -344,6 +344,14 @@ nice_candidate_pair_priority (guint32 o_prio, guint32 a_prio) return (one << thirtytwo) * min + 2 * max + (o_prio > a_prio ? 1 : 0); } +void +nice_candidate_pair_priority_to_string (guint64 prio, gchar *string) +{ + g_snprintf (string, NICE_CANDIDATE_PAIR_PRIORITY_MAX_SIZE, + "%08lx:%08lx:%" G_GUINT64_FORMAT, + prio >> 32, (prio >> 1) & 0x7fffffff, prio & 1); +} + /* * Copies a candidate */ |