Ignore:
Timestamp:
Nov 3, 2012 3:32:09 AM (12 years ago)
Author:
ming
Message:

Re #1586: Fixed useInBandFEC setting and default value setting in pjmedia_codec_silk_set_config()

File:
1 edited

Legend:

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

    r4278 r4293  
    4040#endif 
    4141 
    42 #define FRAME_LENGTH_MS         20 
     42#define FRAME_LENGTH_MS                 20 
     43#define SILK_ENC_CTL_PACKET_LOSS_PCT    10 
     44#define SILK_MIN_BITRATE                5000 
    4345#define CALC_BITRATE_QUALITY(quality, max_br) \ 
    4446                (quality * max_br / 10) 
     
    311313    { 
    312314        if (silk_factory.silk_param[i].clock_rate == clock_rate) { 
     315            int quality = PJMEDIA_CODEC_SILK_DEFAULT_QUALITY; 
     316            int complexity = PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY; 
     317 
    313318            silk_factory.silk_param[i].enabled = opt->enabled; 
    314             silk_factory.silk_param[i].complexity = opt->complexity; 
     319            if (opt->complexity >= 0) 
     320                complexity = opt->complexity; 
     321            silk_factory.silk_param[i].complexity = complexity; 
     322            if (opt->quality >= 0) 
     323                quality = opt->quality; 
    315324            silk_factory.silk_param[i].bitrate = 
    316                 CALC_BITRATE_QUALITY(opt->quality, 
     325                CALC_BITRATE_QUALITY(quality, 
    317326                                     silk_factory.silk_param[i].max_bitrate); 
     327            if (silk_factory.silk_param[i].bitrate < SILK_MIN_BITRATE) 
     328                silk_factory.silk_param[i].bitrate = SILK_MIN_BITRATE; 
     329 
    318330            return PJ_SUCCESS; 
    319331        } 
     
    589601 
    590602    /* Check fmtp params */ 
    591     enc_use_fec = PJ_FALSE; 
     603    enc_use_fec = PJ_TRUE; 
    592604    enc_bitrate = sp->bitrate; 
    593605    for (i = 0; i < attr->setting.enc_fmtp.cnt; ++i) { 
     
    615627    silk->enc_ctl.maxInternalSampleRate = attr->info.clock_rate; 
    616628    silk->enc_ctl.packetSize            = silk->samples_per_frame; 
    617     silk->enc_ctl.packetLossPercentage  = 0; 
     629    /* For useInBandFEC setting to be useful, we need to set 
     630     * packetLossPercentage greater than LBRR_LOSS_THRES (1) 
     631     */ 
     632    silk->enc_ctl.packetLossPercentage  = SILK_ENC_CTL_PACKET_LOSS_PCT; 
    618633    silk->enc_ctl.useInBandFEC          = enc_use_fec; 
    619634    silk->enc_ctl.useDTX                = attr->setting.vad; 
Note: See TracChangeset for help on using the changeset viewer.