Ignore:
Timestamp:
Jul 31, 2006 3:19:36 PM (18 years ago)
Author:
bennylp
Message:
  • Added iLBC codec (experimental) with the following features:
    • configurable default decoder mode (20 or 30),
    • encoder mode follows the mode specified in SDP fmtp from the remote's SDP,
    • silence detector uses pjmedia's,
    • PLC uses iLBC's PLC,
    • perceptual enhancement (penh) is configurable via codec param, as usual.
  • iLBC mode is configurable in pjsua with --ilbc-mode option.
  • Added packet lost simulation in pjmedia's UDP transport and in pjsua (with --rx-drop-pct and --tx-drop-pct options).
  • Increase default buffer count in DirectSound? to 32 frames to make it more resilient to CPU disruption.
  • Specify and parse fmtp mode in SDP for codecs that need it.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/session.c

    r582 r637  
    5959 
    6060/* 
     61 * Get fmtp mode parameter associated with the codec. 
     62 */ 
     63static pj_status_t get_fmtp_mode(const pjmedia_sdp_media *m, 
     64                                 const pj_str_t *fmt, 
     65                                 int *p_mode) 
     66{ 
     67    const pjmedia_sdp_attr *attr; 
     68    pjmedia_sdp_fmtp fmtp; 
     69    const pj_str_t str_mode = { "mode=", 5 }; 
     70    char *pos; 
     71 
     72    /* Get "fmtp" attribute for the format */ 
     73    attr = pjmedia_sdp_media_find_attr2(m, "fmtp", fmt); 
     74    if (attr == NULL) 
     75        return -1; 
     76 
     77    /* Parse "fmtp" attribute */ 
     78    if (pjmedia_sdp_attr_get_fmtp(attr, &fmtp) != PJ_SUCCESS) 
     79        return -1; 
     80 
     81    /* Look for "mode=" string in the fmtp */ 
     82    while (fmtp.fmt_param.slen >= str_mode.slen + 1) { 
     83        if (pj_strnicmp(&fmtp.fmt_param, &str_mode, str_mode.slen)==0) { 
     84            /* Found "mode=" string */ 
     85            break; 
     86        } 
     87 
     88        fmtp.fmt_param.ptr++; 
     89        fmtp.fmt_param.slen--; 
     90    } 
     91 
     92    if (fmtp.fmt_param.slen < str_mode.slen + 1) { 
     93        /* "mode=" param not found */ 
     94        return -1; 
     95    } 
     96 
     97    /* Get the mode */ 
     98    pos = fmtp.fmt_param.ptr + str_mode.slen; 
     99    *p_mode = 0; 
     100    while (pj_isdigit(*pos)) { 
     101        *p_mode = *p_mode * 10 + (*pos - '0'); 
     102        ++pos; 
     103    } 
     104 
     105    return PJ_SUCCESS; 
     106} 
     107 
     108 
     109/* 
    61110 * Create stream info from SDP media line. 
    62111 */ 
     
    76125    const pjmedia_sdp_conn *rem_conn; 
    77126    pjmedia_sdp_rtpmap *rtpmap; 
     127    int local_fmtp_mode = 0, rem_fmtp_mode = 0; 
    78128    unsigned i, pt; 
    79129    pj_status_t status; 
     
    271321 
    272322    } else { 
     323 
    273324        attr = pjmedia_sdp_media_find_attr(local_m, &ID_RTPMAP,  
    274325                                           &local_m->desc.fmt[0]); 
     
    305356        } 
    306357 
     358        /* Get fmtp mode= param in local SDP, if any */ 
     359        get_fmtp_mode(local_m, &local_m->desc.fmt[0], &local_fmtp_mode); 
     360 
    307361        /* Determine payload type for outgoing channel, by finding 
    308362         * dynamic payload type in remote SDP that matches the answer. 
     
    331385                /* Found matched codec. */ 
    332386                si->tx_pt = rpt; 
     387 
     388                /* Get fmtp mode param in remote SDP, if any */ 
     389                get_fmtp_mode(rem_m, &rtpmap->pt, &rem_fmtp_mode); 
     390 
    333391                break; 
    334392            } 
     
    345403    if (status != PJ_SUCCESS) 
    346404        return status; 
     405 
     406    /* Set fmtp mode for both local and remote */ 
     407    if (local_fmtp_mode != 0) 
     408        si->param->setting.dec_fmtp_mode = (pj_int8_t)local_fmtp_mode; 
     409    if (rem_fmtp_mode != 0) 
     410        si->param->setting.enc_fmtp_mode = (pj_int8_t)rem_fmtp_mode; 
     411 
    347412 
    348413    /* Get incomming payload type for telephone-events */ 
Note: See TracChangeset for help on using the changeset viewer.