Changeset 291


Ignore:
Timestamp:
Mar 6, 2006 1:32:57 PM (18 years ago)
Author:
bennylp
Message:

Changed Speex defaults: complexity=-1, vad=off. Tested with EyeBeam?

File:
1 edited

Legend:

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

    r282 r291  
    2929#include <pj/os.h> 
    3030 
    31 #define DEFAULT_QUALITY     8 
    32 #define DEFAULT_COMPLEXITY  8 
     31#define DEFAULT_QUALITY     4 
     32#define DEFAULT_COMPLEXITY  -1 
    3333 
    3434 
     
    103103struct speex_param 
    104104{ 
    105     int     enabled;    /* Is this mode enabled?                */ 
    106     const SpeexMode *mode;  /* Speex mode.                      */ 
    107     int     pt;         /* Payload type.                        */ 
    108     unsigned clock_rate;/* Default sampling rate to be used.    */ 
    109     int     quality;    /* Default encoder quality to be used.  */ 
    110     int     complexity; /* Default encoder complexity.          */ 
    111     int     samples_per_frame;  /* Samples per frame.           */ 
    112     int     framesize;  /* Frame size for current mode.         */ 
    113     int     bitrate;    /* Bit rate for current mode.           */ 
     105    int              enabled;           /* Is this mode enabled?            */ 
     106    const SpeexMode *mode;              /* Speex mode.                      */ 
     107    int              pt;                /* Payload type.                    */ 
     108    unsigned         clock_rate;        /* Default sampling rate to be used.*/ 
     109    int              quality;           /* Default encoder quality.         */ 
     110    int              complexity;        /* Default encoder complexity.      */ 
     111    int              samples_per_frame; /* Samples per frame.               */ 
     112    int              framesize;         /* Frame size for current mode.     */ 
     113    int              bitrate;           /* Bit rate for current mode.       */ 
    114114}; 
    115115 
     
    129129struct spx_private 
    130130{ 
    131     //pjmedia_codec_info         info;              /**< Codec info.            */ 
    132  
    133131    int                  param_id;          /**< Index to speex param.  */ 
    134132 
     
    154152 
    155153    /* Set the quality */ 
    156     speex_encoder_ctl(state, SPEEX_SET_QUALITY, &p->quality); 
     154    if (p->quality != -1) 
     155        speex_encoder_ctl(state, SPEEX_SET_QUALITY, &p->quality); 
    157156 
    158157    /* Sampling rate. */ 
    159158    speex_encoder_ctl(state, SPEEX_SET_SAMPLING_RATE, &p->clock_rate); 
    160159 
    161     /* VAD */ 
    162     tmp = 1; 
     160    /* VAD off to have max bitrate */ 
     161    tmp = 0; 
    163162    speex_encoder_ctl(state, SPEEX_SET_VAD, &tmp); 
    164163 
    165164    /* Complexity. */ 
    166     speex_encoder_ctl(state, SPEEX_SET_COMPLEXITY, &p->complexity); 
     165    if (p->complexity != -1) 
     166        speex_encoder_ctl(state, SPEEX_SET_COMPLEXITY, &p->complexity); 
    167167 
    168168    /* Now get the frame size */ 
     
    393393    attr->lpf_enabled =1 ; 
    394394    attr->penh_enabled =1 ; 
    395     attr->vad_enabled = 1; 
     395 
     396    /* Default, set VAD off as it caused voice chip off */ 
     397    attr->vad_enabled = 0; 
    396398 
    397399    return PJ_SUCCESS; 
     
    558560 
    559561    /* Set the quality*/ 
    560     speex_encoder_ctl(spx->enc, SPEEX_SET_QUALITY,  
    561                       &spx_factory.speex_param[id].quality); 
     562    if (spx_factory.speex_param[id].quality != -1) { 
     563        speex_encoder_ctl(spx->enc, SPEEX_SET_QUALITY,  
     564                          &spx_factory.speex_param[id].quality); 
     565    } 
    562566 
    563567    /* Sampling rate. */ 
     
    571575 
    572576    /* Complexity */ 
    573     speex_encoder_ctl(spx->enc, SPEEX_SET_BITRATE,  
    574                       &spx_factory.speex_param[id].complexity); 
    575  
    576     /* Bitrate */ 
    577     speex_encoder_ctl(spx->enc, SPEEX_SET_BITRATE,  
    578                       &spx_factory.speex_param[id].bitrate); 
     577    if (spx_factory.speex_param[id].complexity != -1) { 
     578        speex_encoder_ctl(spx->enc, SPEEX_SET_COMPLEXITY,  
     579                          &spx_factory.speex_param[id].complexity); 
     580    } 
    579581 
    580582    /*  
Note: See TracChangeset for help on using the changeset viewer.