Ignore:
Timestamp:
May 19, 2006 3:58:13 PM (18 years ago)
Author:
bennylp
Message:

Install VAD in g711, gsm, and speex, and add the DTX support in stream.c. Also changed the way the silence detector works, and changed default speex quality/complexity to 10

File:
1 edited

Legend:

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

    r438 r457  
    3838#define THIS_FILE   "speex_codec.c" 
    3939 
    40 #define DEFAULT_QUALITY     4 
    41 #define DEFAULT_COMPLEXITY  -1 
     40#define DEFAULT_QUALITY     10 
     41#define DEFAULT_COMPLEXITY  10 
    4242 
    4343/* Prototypes for Speex factory */ 
     
    256256 
    257257    /* Somehow quality <=4 is broken in linux. */ 
    258     if (quality <= 4) { 
    259         PJ_LOG(4,(THIS_FILE, "Adjusting quality to 5 for uwb")); 
     258    if (quality <= 4 && quality >= 0) { 
     259        PJ_LOG(5,(THIS_FILE, "Adjusting quality to 5 for uwb")); 
    260260        spx_factory.speex_param[PARAM_UWB].quality = 5; 
    261261    } 
     
    412412    attr->setting.lpf =1 ; 
    413413    attr->setting.penh =1 ; 
    414  
    415     /* Default, set VAD off as it caused voice chip off */ 
    416     attr->setting.vad = 0; 
     414    attr->setting.vad = 1; 
    417415 
    418416    return PJ_SUCCESS; 
     
    572570 
    573571    /* VAD */ 
    574     tmp = attr->setting.vad; 
     572    tmp = (attr->setting.vad != 0); 
    575573    speex_encoder_ctl(spx->enc, SPEEX_SET_VAD, &tmp); 
     574    speex_encoder_ctl(spx->enc, SPEEX_SET_DTX, &tmp); 
    576575 
    577576    /* Complexity */ 
     
    688687    pj_int16_t *samp_in; 
    689688    unsigned i, samp_count, sz; 
     689    int tx; 
    690690 
    691691    spx = (struct spx_private*) codec->codec_data; 
     
    711711 
    712712    /* Encode the frame */ 
    713     speex_encode(spx->enc, tmp, &spx->enc_bits); 
     713    tx = speex_encode(spx->enc, tmp, &spx->enc_bits); 
     714 
     715    /* Check if we need not to transmit the frame (DTX) */ 
     716    if (tx == 0) { 
     717        output->buf = NULL; 
     718        output->size = 0; 
     719        output->timestamp.u64 = input->timestamp.u64; 
     720        output->type = PJMEDIA_FRAME_TYPE_NONE; 
     721        return PJ_SUCCESS; 
     722    } 
    714723 
    715724    /* Check size. */ 
Note: See TracChangeset for help on using the changeset viewer.