Commit 9a6a4d2c authored by Youness Alaoui's avatar Youness Alaoui

some google testing modes for test-fullmode

parent 9728c458
...@@ -46,7 +46,25 @@ ...@@ -46,7 +46,25 @@
#define USE_TURN 0 #define USE_TURN 0
#define USE_LOOPBACK 1 #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 #if USE_LOOPBACK
#define USE_TURN_SERVER_ORG 1 #define USE_TURN_SERVER_ORG 1
#else #else
...@@ -69,15 +87,21 @@ ...@@ -69,15 +87,21 @@
#define TURN_PORT TSORG_PORT #define TURN_PORT TSORG_PORT
#define TURN_USER TSORG_USER #define TURN_USER TSORG_USER
#define TURN_PASS TSORG_PASS #define TURN_PASS TSORG_PASS
#define TURN_USER2 TSORG_USER
#define TURN_PASS2 TSORG_PASS
#define TURN_TYPE NICE_RELAY_TYPE_UDP #define TURN_TYPE NICE_RELAY_TYPE_UDP
#else #else
#define TURN_IP NUMB_IP #define TURN_IP NUMB_IP
#define TURN_PORT NUMB_PORT #define TURN_PORT NUMB_PORT
#define TURN_USER NUMB_USER #define TURN_USER NUMB_USER
#define TURN_PASS NUMB_PASS #define TURN_PASS NUMB_PASS
#define TURN_USER2 NUMB_USER
#define TURN_PASS2 NUMB_PASS
#define TURN_TYPE NICE_RELAY_TYPE_UDP #define TURN_TYPE NICE_RELAY_TYPE_UDP
#endif #endif
#endif
static NiceComponentState global_lagent_state[2] = { NICE_COMPONENT_STATE_LAST, NICE_COMPONENT_STATE_LAST }; 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 }; 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 ...@@ -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) static void init_candidate (NiceCandidate *cand)
{ {
...@@ -254,7 +296,7 @@ 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) 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; NiceCandidate cdes;
GSList *cands; GSList *cands;
guint ls_id, rs_id; guint ls_id, rs_id;
...@@ -291,9 +333,9 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas ...@@ -291,9 +333,9 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
nice_agent_set_relay_info(lagent, ls_id, 2, nice_agent_set_relay_info(lagent, ls_id, 2,
TURN_IP, TURN_PORT, TURN_USER, TURN_PASS, TURN_TYPE); TURN_IP, TURN_PORT, TURN_USER, TURN_PASS, TURN_TYPE);
nice_agent_set_relay_info(ragent, rs_id, 1, 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, 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 #endif
...@@ -322,7 +364,7 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas ...@@ -322,7 +364,7 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
/* step: find out the local candidates of each agent */ /* 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", g_debug ("test-fullmode: local RTP port R %u",
nice_address_get_port (&raddr)); nice_address_get_port (&raddr));
...@@ -336,10 +378,10 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas ...@@ -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); priv_get_local_addr (lagent, ls_id, NICE_COMPONENT_TYPE_RTCP, &laddr_rtcp);
g_debug ("test-fullmode: local RTCP port L %u", 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 */ /* 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; const gchar *ufrag = NULL, *password = NULL;
nice_agent_get_local_credentials(lagent, ls_id, &ufrag, &password); 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 ...@@ -349,7 +391,7 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
nice_agent_set_remote_credentials (lagent, nice_agent_set_remote_credentials (lagent,
ls_id, ufrag, password); ls_id, ufrag, password);
} }
cdes.component_id = NICE_COMPONENT_TYPE_RTP; /* cdes.component_id = NICE_COMPONENT_TYPE_RTP;
cdes.addr = raddr; cdes.addr = raddr;
nice_agent_set_remote_candidates (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, cands); nice_agent_set_remote_candidates (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, cands);
cdes.addr = laddr; cdes.addr = laddr;
...@@ -360,6 +402,18 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas ...@@ -360,6 +402,18 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
cdes.addr = laddr_rtcp; cdes.addr = laddr_rtcp;
nice_agent_set_remote_candidates (ragent, rs_id, NICE_COMPONENT_TYPE_RTCP, cands); 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_slist_free (cands);
g_debug ("test-fullmode: Set properties, next running mainloop until connectivity checks succeed..."); g_debug ("test-fullmode: Set properties, next running mainloop until connectivity checks succeed...");
...@@ -811,8 +865,8 @@ int main (void) ...@@ -811,8 +865,8 @@ int main (void)
*/ */
/* step: create the agents L and R */ /* step: create the agents L and R */
lagent = 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_DRAFT19); ragent = nice_agent_new (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY);
/* step: add a timer to catch state changes triggered by signals */ /* step: add a timer to catch state changes triggered by signals */
#if USE_TURN #if USE_TURN
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment