Changeset 4348 for pjproject/trunk/pjmedia/src/pjmedia-codec/opencore_amr.c
- Timestamp:
- Feb 14, 2013 2:00:13 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-codec/opencore_amr.c
r4335 r4348 143 143 &amr_alloc_codec, 144 144 &amr_dealloc_codec, 145 &pjmedia_codec_opencore_amr nb_deinit145 &pjmedia_codec_opencore_amr_deinit 146 146 }; 147 147 … … 195 195 {pjmedia_codec_amrnb_bitrates, pjmedia_codec_amrwb_bitrates}; 196 196 197 static const unsigned amr_bitrates_size[2] = 198 { 199 PJ_ARRAY_SIZE(pjmedia_codec_amrnb_bitrates), 200 PJ_ARRAY_SIZE(pjmedia_codec_amrwb_bitrates) 201 }; 202 197 203 198 204 /* … … 327 333 328 334 /* Normalize bitrate. */ 329 nbitrates = PJ_ARRAY_SIZE(amr_bitrates[idx]);335 nbitrates = amr_bitrates_size[idx]; 330 336 if (def_config[idx].bitrate < amr_bitrates[idx][0]) { 331 337 def_config[idx].bitrate = amr_bitrates[idx][0]; … … 410 416 attr->info.channel_cnt = 1; 411 417 attr->info.avg_bps = def_config[idx].bitrate; 412 attr->info.max_bps = amr_bitrates[idx][ PJ_ARRAY_SIZE(amr_bitrates[idx])-1];418 attr->info.max_bps = amr_bitrates[idx][amr_bitrates_size[idx]-1]; 413 419 attr->info.pcm_bits_per_sample = 16; 414 420 attr->info.frm_ptime = 20; … … 563 569 idx = (attr->info.clock_rate <= 8000? IDX_AMR_NB: IDX_AMR_WB); 564 570 enc_mode = pjmedia_codec_amr_get_mode(attr->info.avg_bps); 565 pj_assert(enc_mode >= 0 && 566 enc_mode < PJ_ARRAY_SIZE(amr_bitrates[idx])); 571 pj_assert(enc_mode >= 0 && enc_mode < amr_bitrates_size[idx]); 567 572 568 573 /* Check octet-align */ … … 598 603 l = pj_strlen(&attr->setting.enc_fmtp.param[i].val); 599 604 while (l--) { 600 if (*p>='0' && 601 *p<=('0'+PJ_ARRAY_SIZE(amr_bitrates[idx])-1)) 602 { 605 if (*p>='0' && *p<=('0'+amr_bitrates_size[idx]-1)) { 603 606 pj_int8_t tmp = *p - '0' - enc_mode; 604 607 … … 776 779 777 780 /* Check for Change Mode Request. */ 778 if (cmr < PJ_ARRAY_SIZE(amr_bitrates[idx])&& amr_data->enc_mode != cmr) {781 if (cmr < amr_bitrates_size[idx] && amr_data->enc_mode != cmr) { 779 782 amr_data->enc_mode = cmr; 780 783 TRACE_((THIS_FILE, "AMR encoder switched mode to %d (%dbps)",
Note: See TracChangeset
for help on using the changeset viewer.