- Timestamp:
- Jun 2, 2009 12:38:15 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-codec/ipp_codecs.c
r2724 r2733 571 571 ippc->fxns->std.Control(&codec_data->info->params.modes, 572 572 codec_data->enc); 573 574 PJ_LOG(4,(THIS_FILE, "AMR%s switched encoding mode to: %d (%dbps)", 575 (s->enc_setting.amr_nb?"":"-WB"), 576 s->enc_mode, 577 codec_data->info->params.modes.bitrate)); 573 578 } 574 579 … … 1121 1126 &STR_FMTP_MODE_SET) == 0) 1122 1127 { 1123 pj_int8_t tmp; 1124 1125 /* Just get the first value. */ 1126 tmp = (pj_int8_t) 1127 pj_strtoul(&attr->setting.enc_fmtp.param[i].val); 1128 1129 if ((ippc->pt == PJMEDIA_RTP_PT_AMR && tmp > 0 && tmp < 8) || 1130 (ippc->pt == PJMEDIA_RTP_PT_AMRWB && tmp > 0 && tmp < 9)) 1131 { 1132 enc_mode = tmp; 1133 PJ_LOG(4,(THIS_FILE, "Remote specifies AMR mode-set attr, " 1134 "selected: %d", enc_mode)); 1128 const char *p; 1129 pj_size_t l; 1130 1131 /* Get the highest value, for better quality. */ 1132 p = pj_strbuf(&attr->setting.enc_fmtp.param[i].val); 1133 l = pj_strlen(&attr->setting.enc_fmtp.param[i].val); 1134 1135 while (l--) { 1136 if ((ippc->pt == PJMEDIA_RTP_PT_AMR && *p>='0' && *p<='7') || 1137 (ippc->pt == PJMEDIA_RTP_PT_AMRWB && *p>='0' && *p<='8')) 1138 { 1139 pj_int8_t tmp = *p - '0'; 1140 if (enc_mode < tmp) 1141 enc_mode = tmp; 1142 } 1143 ++p; 1135 1144 } 1136 1145 break; … … 1151 1160 s->dec_setting.reorder = PJ_TRUE; 1152 1161 1153 s->enc_mode = pjmedia_codec_amr_get_mode( 1162 if (enc_mode != -1) { 1163 s->enc_mode = enc_mode; 1164 } else { 1165 s->enc_mode = pjmedia_codec_amr_get_mode( 1154 1166 codec_data->info->params.modes.bitrate); 1167 } 1168 1155 1169 if (s->enc_mode < 0) 1156 1170 goto on_error; 1157 1171 1158 if (enc_mode != -1) {1159 s->enc_mode = enc_mode;1160 1161 /* Apply requested encoder bitrate */1162 codec_data->info->params.modes.bitrate = s->enc_setting.amr_nb?1163 pjmedia_codec_amrnb_bitrates[s->enc_mode] :1164 pjmedia_codec_amrwb_bitrates[s->enc_mode]; 1165 ippc->fxns->std.Control(&codec_data->info->params.modes,1166 codec_data->enc);1167 }1168 1172 /* Apply requested encoder bitrate */ 1173 codec_data->info->params.modes.bitrate = s->enc_setting.amr_nb? 1174 pjmedia_codec_amrnb_bitrates[s->enc_mode]: 1175 pjmedia_codec_amrwb_bitrates[s->enc_mode]; 1176 ippc->fxns->std.Control(&codec_data->info->params.modes, 1177 codec_data->enc); 1178 1179 PJ_LOG(4,(THIS_FILE, "AMR%s encoding mode: %d (%dbps)", 1180 (s->enc_setting.amr_nb?"":"-WB"), 1181 s->enc_mode, 1182 codec_data->info->params.modes.bitrate)); 1169 1183 } 1170 1184 #endif
Note: See TracChangeset
for help on using the changeset viewer.