Ignore:
Timestamp:
Sep 14, 2012 4:06:29 AM (10 years ago)
Author:
nanang
Message:

Close #1568:

  • Added media change detection based on SDP negotiation result and local codec param settings, the detection result will decide whether the media should be re-initialized after the SDP negotiation.
  • Fixed stream to keep the duplicate of codec param for the stream info (was only copying the pointer).
  • Introduced macro PJSUA_THIRD_PARTY_STREAM_HAS_GET_INFO & PJSUA_THIRD_PARTY_STREAM_HAS_GET_STAT.
File:
1 edited

Legend:

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

    r3664 r4254  
    4242 
    4343/* 
     44 * Duplicate codec parameter. 
     45 */ 
     46PJ_DEF(pjmedia_codec_param*) pjmedia_codec_param_clone( 
     47                                        pj_pool_t *pool,  
     48                                        const pjmedia_codec_param *src) 
     49{ 
     50    pjmedia_codec_param *p; 
     51    unsigned i; 
     52 
     53    PJ_ASSERT_RETURN(pool && src, NULL); 
     54 
     55    p = PJ_POOL_ZALLOC_T(pool, pjmedia_codec_param); 
     56 
     57    /* Update codec param */ 
     58    pj_memcpy(p, src, sizeof(pjmedia_codec_param)); 
     59    for (i = 0; i < src->setting.dec_fmtp.cnt; ++i) { 
     60        pj_strdup(pool, &p->setting.dec_fmtp.param[i].name,  
     61                  &src->setting.dec_fmtp.param[i].name); 
     62        pj_strdup(pool, &p->setting.dec_fmtp.param[i].val,  
     63                  &src->setting.dec_fmtp.param[i].val); 
     64    } 
     65    for (i = 0; i < src->setting.enc_fmtp.cnt; ++i) { 
     66        pj_strdup(pool, &p->setting.enc_fmtp.param[i].name,  
     67                  &src->setting.enc_fmtp.param[i].name); 
     68        pj_strdup(pool, &p->setting.enc_fmtp.param[i].val,  
     69                  &src->setting.enc_fmtp.param[i].val); 
     70    } 
     71 
     72    return p; 
     73} 
     74 
     75 
     76/* 
    4477 * Initialize codec manager. 
    4578 */ 
     
    601634    p = codec_desc->param; 
    602635    p->pool = pool; 
    603     p->param = PJ_POOL_ZALLOC_T(pool, pjmedia_codec_param); 
    604636 
    605637    /* Update codec param */ 
    606     pj_memcpy(p->param, param, sizeof(pjmedia_codec_param)); 
    607     for (i = 0; i < param->setting.dec_fmtp.cnt; ++i) { 
    608         pj_strdup(pool, &p->param->setting.dec_fmtp.param[i].name,  
    609                   &param->setting.dec_fmtp.param[i].name); 
    610         pj_strdup(pool, &p->param->setting.dec_fmtp.param[i].val,  
    611                   &param->setting.dec_fmtp.param[i].val); 
    612     } 
    613     for (i = 0; i < param->setting.enc_fmtp.cnt; ++i) { 
    614         pj_strdup(pool, &p->param->setting.enc_fmtp.param[i].name,  
    615                   &param->setting.enc_fmtp.param[i].name); 
    616         pj_strdup(pool, &p->param->setting.enc_fmtp.param[i].val,  
    617                   &param->setting.enc_fmtp.param[i].val); 
    618     } 
     638    p->param = pjmedia_codec_param_clone(pool, param); 
     639    if (!p->param) 
     640        return PJ_EINVAL; 
    619641 
    620642    pj_mutex_unlock(mgr->mutex); 
Note: See TracChangeset for help on using the changeset viewer.