Changeset 1985 for pjproject/trunk/pjmedia/src/pjmedia-codec/speex_codec.c
- Timestamp:
- Jun 6, 2008 12:15:23 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-codec/speex_codec.c
r1983 r1985 122 122 int framesize; /* Frame size for current mode. */ 123 123 int bitrate; /* Bit rate for current mode. */ 124 int max_bitrate; /* Max bit rate for current mode. */ 124 125 }; 125 126 … … 161 162 return PJMEDIA_CODEC_EFAILED; 162 163 163 /* We have to get maximum bitrate, so let's set maximumquality */164 tmp = 10;165 speex_encoder_ctl(state, SPEEX_SET_QUALITY, &tmp);164 /* Set the quality */ 165 if (p->quality != -1) 166 speex_encoder_ctl(state, SPEEX_SET_QUALITY, &p->quality); 166 167 167 168 /* Sampling rate. */ … … 179 180 speex_encoder_ctl(state, SPEEX_GET_FRAME_SIZE, &p->samples_per_frame); 180 181 181 /* Now get the the averate bitrate */182 /* Now get the average bitrate */ 182 183 speex_encoder_ctl(state, SPEEX_GET_BITRATE, &p->bitrate); 183 184 184 185 /* Calculate framesize. */ 185 186 p->framesize = p->bitrate * 20 / 1000; 187 188 /* Now get the maximum bitrate by using maximum quality (=10) */ 189 tmp = 10; 190 speex_encoder_ctl(state, SPEEX_SET_QUALITY, &tmp); 191 speex_encoder_ctl(state, SPEEX_GET_BITRATE, &p->max_bitrate); 186 192 187 193 /* Destroy encoder. */ … … 238 244 ((options & PJMEDIA_SPEEX_NO_NB) == 0); 239 245 spx_factory.speex_param[PARAM_NB].pt = PJMEDIA_RTP_PT_SPEEX_NB; 240 spx_factory.speex_param[PARAM_NB].mode = &speex_nb_mode;246 spx_factory.speex_param[PARAM_NB].mode = speex_lib_get_mode(SPEEX_MODEID_NB); 241 247 spx_factory.speex_param[PARAM_NB].clock_rate = 8000; 242 248 spx_factory.speex_param[PARAM_NB].quality = quality; … … 246 252 ((options & PJMEDIA_SPEEX_NO_WB) == 0); 247 253 spx_factory.speex_param[PARAM_WB].pt = PJMEDIA_RTP_PT_SPEEX_WB; 248 spx_factory.speex_param[PARAM_WB].mode = &speex_wb_mode;254 spx_factory.speex_param[PARAM_WB].mode = speex_lib_get_mode(SPEEX_MODEID_WB); 249 255 spx_factory.speex_param[PARAM_WB].clock_rate = 16000; 250 256 spx_factory.speex_param[PARAM_WB].quality = quality; … … 254 260 ((options & PJMEDIA_SPEEX_NO_UWB) == 0); 255 261 spx_factory.speex_param[PARAM_UWB].pt = PJMEDIA_RTP_PT_SPEEX_UWB; 256 spx_factory.speex_param[PARAM_UWB].mode = &speex_uwb_mode;262 spx_factory.speex_param[PARAM_UWB].mode = speex_lib_get_mode(SPEEX_MODEID_UWB); 257 263 spx_factory.speex_param[PARAM_UWB].clock_rate = 32000; 258 264 spx_factory.speex_param[PARAM_UWB].quality = quality; … … 438 444 attr->info.clock_rate = spx_factory.speex_param[PARAM_NB].clock_rate; 439 445 attr->info.avg_bps = spx_factory.speex_param[PARAM_NB].bitrate; 446 attr->info.max_bps = spx_factory.speex_param[PARAM_NB].max_bitrate; 440 447 441 448 } else if (id->clock_rate <= 16000) { 442 449 attr->info.clock_rate = spx_factory.speex_param[PARAM_WB].clock_rate; 443 450 attr->info.avg_bps = spx_factory.speex_param[PARAM_WB].bitrate; 451 attr->info.max_bps = spx_factory.speex_param[PARAM_WB].max_bitrate; 444 452 445 453 } else { … … 447 455 attr->info.clock_rate = spx_factory.speex_param[PARAM_UWB].clock_rate; 448 456 attr->info.avg_bps = spx_factory.speex_param[PARAM_UWB].bitrate; 457 attr->info.max_bps = spx_factory.speex_param[PARAM_UWB].max_bitrate; 449 458 } 450 459
Note: See TracChangeset
for help on using the changeset viewer.