[Nice] [nice/master] some google testing modes for test-fullmode
Youness Alaoui
youness.alaoui at collabora.co.uk
Mon Nov 10 18:46:53 PST 2008
---
agent/test-fullmode.c | 72 ++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 63 insertions(+), 9 deletions(-)
diff --git a/agent/test-fullmode.c b/agent/test-fullmode.c
index d00ea86..182c881 100644
--- a/agent/test-fullmode.c
+++ b/agent/test-fullmode.c
@@ -46,7 +46,25 @@
#define USE_TURN 0
#define USE_LOOPBACK 1
+#define TEST_GOOGLE 0
+#if TEST_GOOGLE
+#define NICE_COMPATIBILITY NICE_COMPATIBILITY_GOOGLE
+
+#if USE_TURN
+#undef USE_LOOPBACK
+#define USE_LOOPBACK 0
+
+#define TURN_IP "216.239.51.126"
+#define TURN_PORT 19295
+#define TURN_USER "7fopcMAPytH1tozK"
+#define TURN_PASS "8Cu7RYbXXicIIzkZ"
+#define TURN_USER2 "h13BD48G76QkUhKf"
+
+#endif
+
+#else
+#define NICE_COMPATIBILITY NICE_COMPATIBILITY_DRAFT19
#if USE_LOOPBACK
#define USE_TURN_SERVER_ORG 1
#else
@@ -69,15 +87,21 @@
#define TURN_PORT TSORG_PORT
#define TURN_USER TSORG_USER
#define TURN_PASS TSORG_PASS
+#define TURN_USER2 TSORG_USER
+#define TURN_PASS2 TSORG_PASS
#define TURN_TYPE NICE_RELAY_TYPE_UDP
#else
#define TURN_IP NUMB_IP
#define TURN_PORT NUMB_PORT
#define TURN_USER NUMB_USER
#define TURN_PASS NUMB_PASS
+#define TURN_USER2 NUMB_USER
+#define TURN_PASS2 NUMB_PASS
#define TURN_TYPE NICE_RELAY_TYPE_UDP
#endif
+#endif
+
static NiceComponentState global_lagent_state[2] = { NICE_COMPONENT_STATE_LAST, NICE_COMPONENT_STATE_LAST };
static NiceComponentState global_ragent_state[2] = { NICE_COMPONENT_STATE_LAST, NICE_COMPONENT_STATE_LAST };
@@ -241,6 +265,24 @@ static void priv_get_local_addr (NiceAgent *agent, guint stream_id, guint compon
}
+static GSList *priv_get_local_candidate (NiceAgent *agent, guint stream_id, guint component_id)
+{
+ GSList *cands, *i;
+ GSList *result = NULL;
+ NiceCandidate *out_cand = NULL;
+ cands = nice_agent_get_local_candidates(agent, stream_id, component_id);
+ for (i = cands; i; i = i->next) {
+ NiceCandidate *cand = i->data;
+ if (cand) {
+ out_cand = cand;
+ }
+ }
+ g_slist_free (cands);
+ result = g_slist_append (result, out_cand);
+ return result;
+}
+
+
static void init_candidate (NiceCandidate *cand)
{
@@ -254,7 +296,7 @@ static void init_candidate (NiceCandidate *cand)
static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *baseaddr, guint ready, guint failed)
{
- NiceAddress laddr, raddr, laddr_rtcp, raddr_rtcp;
+ // NiceAddress laddr, raddr, laddr_rtcp, raddr_rtcp;
NiceCandidate cdes;
GSList *cands;
guint ls_id, rs_id;
@@ -291,9 +333,9 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
nice_agent_set_relay_info(lagent, ls_id, 2,
TURN_IP, TURN_PORT, TURN_USER, TURN_PASS, TURN_TYPE);
nice_agent_set_relay_info(ragent, rs_id, 1,
- TURN_IP, TURN_PORT, TURN_USER, TURN_PASS, TURN_TYPE);
+ TURN_IP, TURN_PORT, TURN_USER2, TURN_PASS2, TURN_TYPE);
nice_agent_set_relay_info(ragent, rs_id, 2,
- TURN_IP, TURN_PORT, TURN_USER, TURN_PASS, TURN_TYPE);
+ TURN_IP, TURN_PORT, TURN_USER2, TURN_PASS2, TURN_TYPE);
#endif
@@ -322,7 +364,7 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
/* step: find out the local candidates of each agent */
- priv_get_local_addr (ragent, rs_id, NICE_COMPONENT_TYPE_RTP, &raddr);
+ /* priv_get_local_addr (ragent, rs_id, NICE_COMPONENT_TYPE_RTP, &raddr);
g_debug ("test-fullmode: local RTP port R %u",
nice_address_get_port (&raddr));
@@ -336,10 +378,10 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
priv_get_local_addr (lagent, ls_id, NICE_COMPONENT_TYPE_RTCP, &laddr_rtcp);
g_debug ("test-fullmode: local RTCP port L %u",
- nice_address_get_port (&laddr_rtcp));
+ nice_address_get_port (&laddr_rtcp));*/
/* step: pass the remote candidates to agents */
- cands = g_slist_append (NULL, &cdes);
+ //cands = g_slist_append (NULL, &cdes);
{
const gchar *ufrag = NULL, *password = NULL;
nice_agent_get_local_credentials(lagent, ls_id, &ufrag, &password);
@@ -349,7 +391,7 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
nice_agent_set_remote_credentials (lagent,
ls_id, ufrag, password);
}
- cdes.component_id = NICE_COMPONENT_TYPE_RTP;
+ /* cdes.component_id = NICE_COMPONENT_TYPE_RTP;
cdes.addr = raddr;
nice_agent_set_remote_candidates (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, cands);
cdes.addr = laddr;
@@ -360,6 +402,18 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
cdes.addr = laddr_rtcp;
nice_agent_set_remote_candidates (ragent, rs_id, NICE_COMPONENT_TYPE_RTCP, cands);
+ g_slist_free (cands);*/
+ cands = priv_get_local_candidate (ragent, rs_id, NICE_COMPONENT_TYPE_RTP);
+ nice_agent_set_remote_candidates (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, cands);
+ g_slist_free (cands);
+ cands = priv_get_local_candidate (ragent, rs_id, NICE_COMPONENT_TYPE_RTCP);
+ nice_agent_set_remote_candidates (lagent, ls_id, NICE_COMPONENT_TYPE_RTCP, cands);
+ g_slist_free (cands);
+ cands = priv_get_local_candidate (lagent, ls_id, NICE_COMPONENT_TYPE_RTP);
+ nice_agent_set_remote_candidates (ragent, rs_id, NICE_COMPONENT_TYPE_RTP, cands);
+ g_slist_free (cands);
+ cands = priv_get_local_candidate (lagent, ls_id, NICE_COMPONENT_TYPE_RTCP);
+ nice_agent_set_remote_candidates (ragent, rs_id, NICE_COMPONENT_TYPE_RTCP, cands);
g_slist_free (cands);
g_debug ("test-fullmode: Set properties, next running mainloop until connectivity checks succeed...");
@@ -811,8 +865,8 @@ int main (void)
*/
/* step: create the agents L and R */
- lagent = nice_agent_new (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY_DRAFT19);
- ragent = nice_agent_new (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY_DRAFT19);
+ lagent = nice_agent_new (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY);
+ ragent = nice_agent_new (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY);
/* step: add a timer to catch state changes triggered by signals */
#if USE_TURN
--
1.5.6.5
More information about the Nice
mailing list