diff options
author | Benny Prijono <bennylp@teluu.com> | 2009-10-14 13:13:18 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2009-10-14 13:13:18 +0000 |
commit | 4533e1452749d9c4060d63971eabc7a6baeb9e1e (patch) | |
tree | b12b132dd8af76ba68df84a2ba3d45b60824578a /pjmedia | |
parent | 6bdbb51b9b880efd0f2f9d833189bdfc8e469934 (diff) |
Ticket #881: send UPDATE or re-INVITE after ICE negotiation, if the default candidate has changed
- done
- added pj_ice_strans_state (to be used for informational purposes for now)
- added pjmedia ICE transport specific info, and display it in call dump output
- misc fixes (changed pjmedia_transport_info.spec_info_cnt from int to unsigned)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2945 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r-- | pjmedia/include/pjmedia/transport.h | 2 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/transport_ice.h | 46 | ||||
-rw-r--r-- | pjmedia/src/pjmedia/transport_ice.c | 32 |
3 files changed, 79 insertions, 1 deletions
diff --git a/pjmedia/include/pjmedia/transport.h b/pjmedia/include/pjmedia/transport.h index 02105a7c..a6a6ff47 100644 --- a/pjmedia/include/pjmedia/transport.h +++ b/pjmedia/include/pjmedia/transport.h @@ -503,7 +503,7 @@ struct pjmedia_transport_info /** * Specifies number of transport specific info included. */ - int specific_info_cnt; + unsigned specific_info_cnt; /** * Buffer storage of transport specific info. diff --git a/pjmedia/include/pjmedia/transport_ice.h b/pjmedia/include/pjmedia/transport_ice.h index 349bddd9..0e7816fc 100644 --- a/pjmedia/include/pjmedia/transport_ice.h +++ b/pjmedia/include/pjmedia/transport_ice.h @@ -63,6 +63,52 @@ typedef struct pjmedia_ice_cb /** + * This structure specifies ICE transport specific info. This structure + * will be filled in media transport specific info. + */ +typedef struct pjmedia_ice_transport_info +{ + /** + * ICE sesion state. + */ + pj_ice_strans_state sess_state; + + /** + * Session role. + */ + pj_ice_sess_role role; + + /** + * Number of components in the component array. Before ICE negotiation + * is complete, the number represents the number of components of the + * local agent. After ICE negotiation has been completed successfully, + * the number represents the number of common components between local + * and remote agents. + */ + unsigned comp_cnt; + + /** + * Array of ICE components. Typically the first element denotes RTP and + * second element denotes RTCP. + */ + struct + { + /** + * Local candidate type. + */ + pj_ice_cand_type lcand_type; + + /** + * Remote candidate type. + */ + pj_ice_cand_type rcand_type; + + } comp[2]; + +} pjmedia_ice_transport_info; + + +/** * Options that can be specified when creating ICE transport. */ enum pjmedia_transport_ice_options diff --git a/pjmedia/src/pjmedia/transport_ice.c b/pjmedia/src/pjmedia/transport_ice.c index 7c36787c..7fd0133e 100644 --- a/pjmedia/src/pjmedia/transport_ice.c +++ b/pjmedia/src/pjmedia/transport_ice.c @@ -1473,6 +1473,38 @@ static pj_status_t transport_get_info(pjmedia_transport *tp, info->src_rtcp_name = tp_ice->rtcp_src_addr; } + /* Fill up transport specific info */ + if (info->specific_info_cnt < PJ_ARRAY_SIZE(info->spc_info)) { + pjmedia_transport_specific_info *tsi; + pjmedia_ice_transport_info *ii; + unsigned i; + + pj_assert(sizeof(*ii) <= sizeof(tsi->buffer)); + tsi = &info->spc_info[info->specific_info_cnt++]; + tsi->type = PJMEDIA_TRANSPORT_TYPE_ICE; + tsi->cbsize = sizeof(*ii); + + ii = (pjmedia_ice_transport_info*) tsi->buffer; + pj_bzero(ii, sizeof(*ii)); + + if (pj_ice_strans_has_sess(tp_ice->ice_st)) + ii->role = pj_ice_strans_get_role(tp_ice->ice_st); + else + ii->role = PJ_ICE_SESS_ROLE_UNKNOWN; + ii->sess_state = pj_ice_strans_get_state(tp_ice->ice_st); + ii->comp_cnt = pj_ice_strans_get_running_comp_cnt(tp_ice->ice_st); + + for (i=1; i<=ii->comp_cnt && i<=PJ_ARRAY_SIZE(ii->comp); ++i) { + const pj_ice_sess_check *chk; + + chk = pj_ice_strans_get_valid_pair(tp_ice->ice_st, i); + if (chk) { + ii->comp[i-1].lcand_type = chk->lcand->type; + ii->comp[i-1].rcand_type = chk->rcand->type; + } + } + } + return PJ_SUCCESS; } |