Changeset 1639 for pjproject


Ignore:
Timestamp:
Dec 28, 2007 8:51:58 AM (17 years ago)
Author:
bennylp
Message:

Ticket #433: Failure in media negotiation when SDP contains two audio media lines (thanks Arie Velthoen)

Location:
pjproject/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/errno.h

    r1417 r1639  
    149149 */ 
    150150#define PJMEDIA_SDP_EINRTCP         (PJMEDIA_ERRNO_START+35)    /* 220035 */ 
     151/** 
     152 * @hideinitializer 
     153 * Invalid SDP media transport protocol. 
     154 */ 
     155#define PJMEDIA_SDP_EINPROTO        (PJMEDIA_ERRNO_START+36)    /* 220036 */ 
    151156 
    152157 
  • pjproject/trunk/pjmedia/include/pjmedia/stream.h

    r1615 r1639  
    9090{ 
    9191    pjmedia_type        type;       /**< Media type (audio, video)          */ 
     92    pjmedia_tp_proto    proto;      /**< Transport protocol (RTP/AVP, etc.) */ 
    9293    pjmedia_dir         dir;        /**< Media direction.                   */ 
    9394    pj_sockaddr         rem_addr;   /**< Remote RTP address                 */ 
  • pjproject/trunk/pjmedia/include/pjmedia/types.h

    r1615 r1639  
    6868} pjmedia_type; 
    6969 
     70 
     71/**  
     72 * Media transport protocol.  
     73 */ 
     74typedef enum pjmedia_tp_proto 
     75{ 
     76    /** No transport type */ 
     77    PJMEDIA_TP_PROTO_NONE = 0, 
     78 
     79    /** RTP using A/V profile */ 
     80    PJMEDIA_TP_PROTO_RTP_AVP, 
     81 
     82    /** Secure RTP */ 
     83    PJMEDIA_TP_PROTO_RTP_SAVP, 
     84 
     85    /** Unknown */ 
     86    PJMEDIA_TP_PROTO_UNKNOWN 
     87 
     88} pjmedia_tp_proto; 
    7089 
    7190 
  • pjproject/trunk/pjmedia/src/pjmedia/errno.c

    r1202 r1639  
    5959    PJ_BUILD_ERR( PJMEDIA_SDP_EINFMTP,      "Invalid SDP fmtp attribute" ), 
    6060    PJ_BUILD_ERR( PJMEDIA_SDP_EINRTCP,      "Invalid SDP rtcp attribyte" ), 
     61    PJ_BUILD_ERR( PJMEDIA_SDP_EINPROTO,     "Invalid SDP media transport protocol" ), 
    6162 
    6263    /* SDP negotiator errors. */ 
  • pjproject/trunk/pjmedia/src/pjmedia/session.c

    r1615 r1639  
    5454static const pj_str_t ID_IP4 = { "IP4", 3}; 
    5555static const pj_str_t ID_IP6 = { "IP6", 3}; 
    56 /*static const pj_str_t ID_RTP_AVP = { "RTP/AVP", 7 };*/ 
    57 /*static const pj_str_t ID_SDP_NAME = { "pjmedia", 7 };*/ 
     56static const pj_str_t ID_RTP_AVP = { "RTP/AVP", 7 }; 
     57static const pj_str_t ID_RTP_SAVP = { "RTP/SAVP", 8 }; 
     58//static const pj_str_t ID_SDP_NAME = { "pjmedia", 7 }; 
    5859static const pj_str_t ID_RTPMAP = { "rtpmap", 6 }; 
    5960static const pj_str_t ID_TELEPHONE_EVENT = { "telephone-event", 15 }; 
     
    181182    } 
    182183 
     184    /* Transport protocol */ 
     185 
    183186    /* Transport type must be equal */ 
    184187    if (pj_stricmp(&rem_m->desc.transport,  
     
    188191        return PJMEDIA_SDPNEG_EINVANSTP; 
    189192    } 
     193 
     194    if (pj_stricmp(&local_m->desc.transport, &ID_RTP_AVP) == 0) { 
     195 
     196        si->proto = PJMEDIA_TP_PROTO_RTP_AVP; 
     197 
     198    } else if (pj_stricmp(&local_m->desc.transport, &ID_RTP_SAVP) == 0) { 
     199 
     200        si->proto = PJMEDIA_TP_PROTO_RTP_SAVP; 
     201 
     202    } else { 
     203 
     204        si->proto = PJMEDIA_TP_PROTO_UNKNOWN; 
     205        return PJMEDIA_SDP_EINPROTO; 
     206    } 
     207 
    190208 
    191209    /* Check address family in remote SDP */ 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r1636 r1639  
    885885                                       const pjmedia_sdp_session *remote_sdp) 
    886886{ 
     887    unsigned i; 
    887888    int prev_media_st = 0; 
    888889    pjsua_call *call = &pjsua_var.calls[call_id]; 
    889890    pjmedia_session_info sess_info; 
     891    pjmedia_stream_info *si = NULL; 
    890892    pjmedia_port *media_port; 
    891893    pj_str_t port_name; 
     
    898900 
    899901    /* Create media session info based on SDP parameters.  
    900      * We only support one stream per session at the moment 
    901902     */     
    902903    status = pjmedia_session_info_from_sdp( call->inv->dlg->pool,  
    903904                                            pjsua_var.med_endpt,  
    904                                             1,&sess_info,  
     905                                            PJMEDIA_MAX_SDP_MEDIA, &sess_info, 
    905906                                            local_sdp, remote_sdp); 
    906907    if (status != PJ_SUCCESS) 
    907908        return status; 
    908909 
     910    /* Find which session is audio (we only support audio for now) */ 
     911    for (i=0; i < sess_info.stream_cnt; ++i) { 
     912        if (sess_info.stream_info[i].type == PJMEDIA_TYPE_AUDIO && 
     913            sess_info.stream_info[i].proto == PJMEDIA_TP_PROTO_RTP_AVP) 
     914        { 
     915            si = &sess_info.stream_info[i]; 
     916            break; 
     917        } 
     918    } 
     919 
     920    if (si == NULL) { 
     921        /* Not found */ 
     922        return PJMEDIA_EINVALIMEDIATYPE; 
     923    } 
     924 
     925     
     926    /* Reset session info with only one media stream */ 
     927    sess_info.stream_cnt = 1; 
     928    if (si != &sess_info.stream_info[0]) 
     929        pj_memcpy(&sess_info.stream_info[0], si, sizeof(pjmedia_stream_info)); 
    909930 
    910931    /* Check if media is put on-hold */ 
    911     if (sess_info.stream_cnt == 0 ||  
    912         sess_info.stream_info[0].dir == PJMEDIA_DIR_NONE) 
     932    if (sess_info.stream_cnt == 0 || si->dir == PJMEDIA_DIR_NONE) 
    913933    { 
    914934 
     
    944964        /* Override ptime, if this option is specified. */ 
    945965        if (pjsua_var.media_cfg.ptime != 0) { 
    946             sess_info.stream_info[0].param->setting.frm_per_pkt = (pj_uint8_t) 
    947                 (pjsua_var.media_cfg.ptime / sess_info.stream_info[0].param->info.frm_ptime); 
    948             if (sess_info.stream_info[0].param->setting.frm_per_pkt == 0) 
    949                 sess_info.stream_info[0].param->setting.frm_per_pkt = 1; 
     966            si->param->setting.frm_per_pkt = (pj_uint8_t) 
     967                (pjsua_var.media_cfg.ptime / si->param->info.frm_ptime); 
     968            if (si->param->setting.frm_per_pkt == 0) 
     969                si->param->setting.frm_per_pkt = 1; 
    950970        } 
    951971 
    952972        /* Disable VAD, if this option is specified. */ 
    953973        if (pjsua_var.media_cfg.no_vad) { 
    954             sess_info.stream_info[0].param->setting.vad = 0; 
     974            si->param->setting.vad = 0; 
    955975        } 
    956976 
     
    959979         * (such as jitter buffer parameters, codec ptime, etc.) 
    960980         */ 
    961         sess_info.stream_info[0].jb_init = pjsua_var.media_cfg.jb_init; 
    962         sess_info.stream_info[0].jb_min_pre = pjsua_var.media_cfg.jb_min_pre; 
    963         sess_info.stream_info[0].jb_max_pre = pjsua_var.media_cfg.jb_max_pre; 
    964         sess_info.stream_info[0].jb_max = pjsua_var.media_cfg.jb_max; 
     981        si->jb_init = pjsua_var.media_cfg.jb_init; 
     982        si->jb_min_pre = pjsua_var.media_cfg.jb_min_pre; 
     983        si->jb_max_pre = pjsua_var.media_cfg.jb_max_pre; 
     984        si->jb_max = pjsua_var.media_cfg.jb_max; 
    965985 
    966986        /* Set SSRC */ 
    967         sess_info.stream_info[0].ssrc = call->ssrc; 
     987        si->ssrc = call->ssrc; 
    968988 
    969989        /* Create session based on session info. */ 
     
    10101030        /* Call's media state is active */ 
    10111031        call->media_st = PJSUA_CALL_MEDIA_ACTIVE; 
    1012         call->media_dir = sess_info.stream_info[0].dir; 
     1032        call->media_dir = si->dir; 
    10131033    } 
    10141034 
Note: See TracChangeset for help on using the changeset viewer.