Changeset 291 for pjproject/trunk
- Timestamp:
- Mar 6, 2006 1:32:57 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-codec/speex_codec.c
r282 r291 29 29 #include <pj/os.h> 30 30 31 #define DEFAULT_QUALITY 832 #define DEFAULT_COMPLEXITY 831 #define DEFAULT_QUALITY 4 32 #define DEFAULT_COMPLEXITY -1 33 33 34 34 … … 103 103 struct speex_param 104 104 { 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. */ 114 114 }; 115 115 … … 129 129 struct spx_private 130 130 { 131 //pjmedia_codec_info info; /**< Codec info. */132 133 131 int param_id; /**< Index to speex param. */ 134 132 … … 154 152 155 153 /* 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); 157 156 158 157 /* Sampling rate. */ 159 158 speex_encoder_ctl(state, SPEEX_SET_SAMPLING_RATE, &p->clock_rate); 160 159 161 /* VAD */162 tmp = 1;160 /* VAD off to have max bitrate */ 161 tmp = 0; 163 162 speex_encoder_ctl(state, SPEEX_SET_VAD, &tmp); 164 163 165 164 /* 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); 167 167 168 168 /* Now get the frame size */ … … 393 393 attr->lpf_enabled =1 ; 394 394 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; 396 398 397 399 return PJ_SUCCESS; … … 558 560 559 561 /* 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 } 562 566 563 567 /* Sampling rate. */ … … 571 575 572 576 /* 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 } 579 581 580 582 /*
Note: See TracChangeset
for help on using the changeset viewer.