Ignore:
Timestamp:
Apr 27, 2006 10:36:40 PM (18 years ago)
Author:
bennylp
Message:

Initial support for stereo codecs, and added L16 codecs. Also better handling for case remote media is restarted

File:
1 edited

Legend:

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

    r350 r411  
    330330    for (i=0; i<endpt->codec_mgr.codec_cnt; ++i) { 
    331331 
    332         pjmedia_codec_info *codec_info = &endpt->codec_mgr.codecs[i]; 
     332        pjmedia_codec_info *codec_info; 
    333333        pjmedia_sdp_rtpmap rtpmap; 
     334        char tmp_param[3]; 
    334335        pjmedia_sdp_attr *attr; 
    335         pj_str_t *fmt = &m->desc.fmt[m->desc.fmt_count++]; 
     336        pj_str_t *fmt; 
     337 
     338        if (endpt->codec_mgr.codec_desc[i].prio == PJMEDIA_CODEC_PRIO_DISABLED) 
     339            break; 
     340 
     341        codec_info = &endpt->codec_mgr.codec_desc[i].info; 
     342        fmt = &m->desc.fmt[m->desc.fmt_count++]; 
    336343 
    337344        fmt->ptr = pj_pool_alloc(pool, 8); 
     
    339346 
    340347        rtpmap.pt = *fmt; 
    341         rtpmap.clock_rate = codec_info->sample_rate; 
     348        rtpmap.clock_rate = codec_info->clock_rate; 
    342349        rtpmap.enc_name = codec_info->encoding_name; 
    343         rtpmap.param.slen = 0; 
     350         
     351        /* For audio codecs, rtpmap parameters denotes the number 
     352         * of channels, which can be omited if the value is 1. 
     353         */ 
     354        if (codec_info->type == PJMEDIA_TYPE_AUDIO && 
     355            codec_info->channel_cnt > 1) 
     356        { 
     357            /* Can only support one digit channel count */ 
     358            pj_assert(codec_info->channel_cnt < 10); 
     359 
     360            tmp_param[0] = '/'; 
     361            tmp_param[1] = (char)('0' + codec_info->channel_cnt); 
     362 
     363            rtpmap.param.ptr = tmp_param; 
     364            rtpmap.param.slen = 2; 
     365 
     366        } else { 
     367            rtpmap.param.slen = 0; 
     368        } 
    344369 
    345370        pjmedia_sdp_rtpmap_to_attr(pool, &rtpmap, &attr); 
     
    389414    count = PJ_ARRAY_SIZE(codec_info); 
    390415    if (pjmedia_codec_mgr_enum_codecs(&endpt->codec_mgr,  
    391                                       &count, codec_info) != PJ_SUCCESS) 
     416                                      &count, codec_info, NULL) != PJ_SUCCESS) 
    392417    { 
    393418        PJ_LOG(3,(THIS_FILE, " -error: failed to enum codecs")); 
     
    417442 
    418443        PJ_LOG(3,(THIS_FILE,  
    419                   "   %s codec #%2d: pt=%d (%.*s @%dKHz, %d bps, ptime=%d ms, vad=%d, cng=%d)",  
     444                  "   %s codec #%2d: pt=%d (%.*s @%dKHz/%d, %d bps, ptime=%d ms, vad=%d, cng=%d)",  
    420445                  type, i, codec_info[i].pt, 
    421446                  (int)codec_info[i].encoding_name.slen, 
    422447                  codec_info[i].encoding_name.ptr, 
    423                   codec_info[i].sample_rate/1000, 
     448                  codec_info[i].clock_rate/1000, 
     449                  codec_info[i].channel_cnt, 
    424450                  param.avg_bps, param.ptime, 
    425                   param.vad_enabled, 
    426                   param.cng_enabled)); 
     451                  param.vad, 
     452                  param.cng)); 
    427453    } 
    428454#endif 
Note: See TracChangeset for help on using the changeset viewer.