[asterisk-commits] file: branch file/chan_jingle2 r365456 - in /team/file/chan_jingle2: include/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun May 6 09:59:09 CDT 2012
Author: file
Date: Sun May 6 09:59:05 2012
New Revision: 365456
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=365456
Log:
Import latest STUN/TURN/ICE changes.
Modified:
team/file/chan_jingle2/include/asterisk/rtp_engine.h
team/file/chan_jingle2/res/res_rtp_asterisk.c
Modified: team/file/chan_jingle2/include/asterisk/rtp_engine.h
URL: http://svnview.digium.com/svn/asterisk/team/file/chan_jingle2/include/asterisk/rtp_engine.h?view=diff&rev=365456&r1=365455&r2=365456
==============================================================================
--- team/file/chan_jingle2/include/asterisk/rtp_engine.h (original)
+++ team/file/chan_jingle2/include/asterisk/rtp_engine.h Sun May 6 09:59:05 2012
@@ -336,6 +336,8 @@
void (*add_remote_candidate)(struct ast_rtp_instance *instance, const struct ast_rtp_engine_ice_candidate *candidate);
/*! Callback for starting ICE negotiation */
void (*start)(struct ast_rtp_instance *instance);
+ /*! Callback for stopping ICE support */
+ void (*stop)(struct ast_rtp_instance *instance);
/*! Callback for getting local username */
const char *(*get_ufrag)(struct ast_rtp_instance *instance);
/*! Callback for getting local password */
Modified: team/file/chan_jingle2/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/file/chan_jingle2/res/res_rtp_asterisk.c?view=diff&rev=365456&r1=365455&r2=365456
==============================================================================
--- team/file/chan_jingle2/res/res_rtp_asterisk.c (original)
+++ team/file/chan_jingle2/res/res_rtp_asterisk.c Sun May 6 09:59:05 2012
@@ -388,6 +388,11 @@
return;
}
+ /* If this is going to exceed the maximum number of ICE candidates don't even add it */
+ if (ao2_container_count(rtp->remote_candidates) == PJ_ICE_MAX_CAND) {
+ return;
+ }
+
if (!(remote_candidate = ao2_alloc(sizeof(*remote_candidate), ast_rtp_ice_candidate_destroy))) {
return;
}
@@ -434,7 +439,7 @@
i = ao2_iterator_init(rtp->remote_candidates, 0);
- while ((candidate = ao2_iterator_next(&i))) {
+ while ((candidate = ao2_iterator_next(&i)) && (cand_cnt < PJ_ICE_MAX_CAND)) {
pj_str_t address;
pj_strdup2(rtp->ice->pool, &candidates[cand_cnt].foundation, candidate->foundation);
@@ -471,18 +476,32 @@
}
}
+static void ast_rtp_ice_stop(struct ast_rtp_instance *instance)
+{
+ struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
+
+ if (!rtp->ice) {
+ return;
+ }
+
+ pj_thread_register_check();
+
+ pj_ice_sess_destroy(rtp->ice);
+ rtp->ice = NULL;
+}
+
static const char *ast_rtp_ice_get_ufrag(struct ast_rtp_instance *instance)
{
struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
- return rtp->ice ? rtp->local_ufrag : NULL;
+ return rtp->local_ufrag;
}
static const char *ast_rtp_ice_get_password(struct ast_rtp_instance *instance)
{
struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
- return rtp->ice ? rtp->local_passwd : NULL;
+ return rtp->local_passwd;
}
static struct ao2_container *ast_rtp_ice_get_local_candidates(struct ast_rtp_instance *instance)
@@ -578,6 +597,7 @@
.set_authentication = ast_rtp_ice_set_authentication,
.add_remote_candidate = ast_rtp_ice_add_remote_candidate,
.start = ast_rtp_ice_start,
+ .stop = ast_rtp_ice_stop,
.get_ufrag = ast_rtp_ice_get_ufrag,
.get_password = ast_rtp_ice_get_password,
.get_local_candidates = ast_rtp_ice_get_local_candidates,
@@ -850,9 +870,13 @@
return -1;
}
- if (rtp->ice && (pj_ice_sess_send_data(rtp->ice, rtcp ? COMPONENT_RTCP : COMPONENT_RTP, temp, len) == PJ_SUCCESS)) {
- *ice = 1;
- return 0;
+ if (rtp->ice) {
+ pj_thread_register_check();
+
+ if (pj_ice_sess_send_data(rtp->ice, rtcp ? COMPONENT_RTCP : COMPONENT_RTP, temp, len) == PJ_SUCCESS) {
+ *ice = 1;
+ return 0;
+ }
}
return ast_sendto(rtcp ? rtp->rtcp->s : rtp->s, temp, len, flags, sa);
@@ -1160,6 +1184,8 @@
AST_SCHED_DEL(rtp->sched, rtp->red->schedid);
ast_free(rtp->red);
}
+
+ pj_thread_register_check();
/* Destroy the ICE session if being used */
if (rtp->ice) {
More information about the asterisk-commits
mailing list