Commit ac437f66 authored by Ghislain MARY's avatar Ghislain MARY

Add ICE session state.

parent 0ebf88d0
......@@ -81,6 +81,16 @@ typedef enum {
ICL_Failed
} IceCheckListState;
/**
* ICE session state.
*/
typedef enum {
IS_Stopped,
IS_Running,
IS_Completed,
IS_Failed
} IceSessionState;
/**
* Structure representing an ICE session.
*/
......@@ -92,6 +102,7 @@ typedef struct _IceSession {
char *remote_ufrag; /**< Remote username fragment for the session (provided via SDP by the peer) */
char *remote_pwd; /**< Remote password for the session (provided via SDP by the peer) */
IceRole role; /**< Role played by the agent for this session */
IceSessionState state; /**< State of the session */
uint64_t tie_breaker; /**< Random number used to resolve role conflicts (see paragraph 5.2 of the RFC 5245) */
uint32_t ta; /**< Duration of timer for sending connectivity checks in ms */
uint8_t max_connectivity_checks; /**< Configuration parameter to limit the number of connectivity checks performed by the agent (default is 100) */
......
......@@ -143,6 +143,7 @@ static const char * const candidate_pair_state_values[] = {
static void ice_session_init(IceSession *session)
{
session->streams = NULL;
session->state = IS_Stopped;
session->role = IR_Controlling;
session->tie_breaker = (((uint64_t)random()) << 32) | (((uint64_t)random()) & 0xffffffff);
session->ta = ICE_DEFAULT_TA_DURATION;
......@@ -1639,6 +1640,7 @@ static void ice_check_list_pair_candidates(IceCheckList *cl, IceSession *session
void ice_session_pair_candidates(IceSession *session)
{
ms_list_for_each2(session->streams, (void (*)(void*,void*))ice_check_list_pair_candidates, session);
session->state = IS_Running;
}
......@@ -1791,6 +1793,7 @@ void ice_check_list_process(IceCheckList *cl, RtpSession *rtp_session)
bool_t retransmissions_pending = FALSE;
if (cl->session == NULL) return;
if ((cl->session->state == IS_Stopped) || (cl->session->state == IS_Failed)) return;
curtime = cl->session->ticker->time;
switch (cl->state) {
......
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