Ignore:
Timestamp:
Jun 30, 2009 3:02:06 PM (15 years ago)
Author:
nanang
Message:

Ticket #910:

  • Added a new API pjmedia_codec_passthrough_init2().
  • Updated the initialization steps of passthrough codec in pjsua_media.c, to configure the codecs (of passthrough codec) to be enabled based on audio device extended/encoded formats.
  • Minor update: added passthrough.h into pjmedia_codec.vcproj.
File:
1 edited

Legend:

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

    r2735 r2825  
    313313    if (codec_factory.pool != NULL) { 
    314314        /* Already initialized. */ 
    315         return PJ_SUCCESS; 
     315        return PJ_EEXISTS; 
    316316    } 
    317317 
     
    355355 
    356356/* 
     357 * Initialize and register passthrough codec factory to pjmedia endpoint. 
     358 */ 
     359PJ_DEF(pj_status_t) pjmedia_codec_passthrough_init2(  
     360                      pjmedia_endpt *endpt, 
     361                      const pjmedia_codec_passthrough_setting *setting) 
     362{ 
     363    if (codec_factory.pool != NULL) { 
     364        /* Already initialized. */ 
     365        return PJ_EEXISTS; 
     366    } 
     367 
     368    if (setting != NULL) { 
     369        unsigned i; 
     370 
     371        /* Enable/disable codecs based on the specified encoding formats */ 
     372        for (i = 0; i < PJ_ARRAY_SIZE(codec_desc); ++i) { 
     373            pj_bool_t enabled = PJ_FALSE; 
     374            unsigned j; 
     375 
     376            for (j = 0; j < setting->fmt_cnt && !enabled; ++j) { 
     377                if (codec_desc[i].fmt_id == setting->fmts[j].id) 
     378                    enabled = PJ_TRUE; 
     379            } 
     380 
     381            codec_desc[i].enabled = enabled; 
     382        } 
     383    } 
     384 
     385    return pjmedia_codec_passthrough_init(endpt); 
     386} 
     387 
     388/* 
    357389 * Unregister passthrough codecs factory from pjmedia endpoint. 
    358390 */ 
     
    360392{ 
    361393    pjmedia_codec_mgr *codec_mgr; 
     394    unsigned i; 
    362395    pj_status_t status; 
    363396 
     
    387420    pj_pool_release(codec_factory.pool); 
    388421    codec_factory.pool = NULL; 
     422 
     423    /* Re-enable all codecs in the codec_desc. */ 
     424    for (i = 0; i < PJ_ARRAY_SIZE(codec_desc); ++i) { 
     425        codec_desc[i].enabled = PJ_TRUE; 
     426    } 
    389427 
    390428    return status; 
Note: See TracChangeset for help on using the changeset viewer.