Ignore:
Timestamp:
Sep 24, 2014 10:30:57 AM (7 years ago)
Author:
nanang
Message:

Fix #1794: Fixed assertion or garbled audio in call using G.722.1:

  • Updated stream info to use pjmedia_sdp_neg_fmt_match() for matching formats in SDP, so it will call codec specific match function, e.g: for G.722.1 it will match the bitrate too.
  • Workaround for 'stream uses wrong codec param for opening G.722.1' issue, it is the G.722.1 codec that check the SDP fmtp for fetching bitrate setting (instead of using avg_bps/max_bps fields in codec param).
File:
1 edited

Legend:

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

    r4001 r4930  
    649649    codec_private_t *codec_data = (codec_private_t*) codec->codec_data; 
    650650    pj_pool_t *pool; 
     651    pjmedia_codec_fmtp *fmtp = &attr->setting.dec_fmtp; 
     652    pj_uint16_t fmtp_bitrate = 0; 
    651653    unsigned tmp; 
    652654 
     655    for (tmp = 0; tmp < fmtp->cnt && !fmtp_bitrate; ++tmp) { 
     656        if (!pj_strcmp2(&fmtp->param[tmp].name, "bitrate")) 
     657            fmtp_bitrate = (pj_uint16_t)pj_strtoul(&fmtp->param[tmp].val); 
     658    } 
     659 
    653660    /* Validation mode first! */ 
    654     if (!validate_mode(attr->info.clock_rate, attr->info.avg_bps)) 
     661    if (!fmtp_bitrate || !validate_mode(attr->info.clock_rate, fmtp_bitrate)) 
    655662        return PJMEDIA_CODEC_EINMODE; 
    656663 
     
    661668    codec_data->plc_enabled = (attr->setting.plc != 0); 
    662669 
    663     codec_data->bitrate = (pj_uint16_t)attr->info.avg_bps; 
    664     codec_data->frame_size_bits = (pj_uint16_t)(attr->info.avg_bps*20/1000); 
     670    codec_data->bitrate = fmtp_bitrate; 
     671    codec_data->frame_size_bits = fmtp_bitrate*20/1000; 
    665672    codec_data->frame_size = (pj_uint16_t)(codec_data->frame_size_bits>>3); 
    666673    codec_data->samples_per_frame = (pj_uint16_t) 
     
    687694    codec_data->dec_randobj.seed2 = 1; 
    688695    codec_data->dec_randobj.seed3 = 1; 
     696 
     697    /* Update codec param */ 
     698    attr->info.avg_bps = attr->info.max_bps = fmtp_bitrate; 
    689699 
    690700    return PJ_SUCCESS; 
Note: See TracChangeset for help on using the changeset viewer.