Changeset 2709 for pjproject/branches/projects/sipit24
- Timestamp:
- May 18, 2009 9:06:19 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/sipit24/pjmedia/src/pjmedia-codec/ipp_codecs.c
r2573 r2709 235 235 # if PJMEDIA_HAS_INTEL_IPP_CODEC_AMR 236 236 {1, "AMR", PJMEDIA_RTP_PT_AMR, &USC_GSMAMR_Fxns, 8000, 1, 160, 237 5900, 12200, 4, 1, 1,237 7400, 12200, 2, 0, 1, 238 238 &predecode_amr, &parse_amr, &pack_amr 239 239 /*, {1, {{{"octet-align", 11}, {"1", 1}}} } */ 240 , {1, {{{"mode-set", 8}, {"1,4,5", 5}}} } 240 241 }, 241 242 # endif … … 561 562 /* Check Change Mode Request. */ 562 563 if ((setting->amr_nb && cmr <= 7) || (!setting->amr_nb && cmr <= 8)) { 564 struct ipp_codec *ippc = &ipp_codec[codec_data->codec_idx]; 565 563 566 s->enc_mode = cmr; 567 codec_data->info->params.modes.bitrate = s->enc_setting.amr_nb? 568 pjmedia_codec_amrnb_bitrates[s->enc_mode] : 569 pjmedia_codec_amrwb_bitrates[s->enc_mode]; 570 ippc->fxns->std.Control(&codec_data->info->params.modes, 571 codec_data->enc); 564 572 } 565 573 … … 1034 1042 1035 1043 /* Not sure if VAD affects decoder, just try to be safe */ 1036 codec_data->info->params.modes.vad = ippc->has_native_vad;1044 //codec_data->info->params.modes.vad = ippc->has_native_vad; 1037 1045 1038 1046 /* Get number of memory blocks needed by the decoder */ … … 1085 1093 amr_settings_t *s; 1086 1094 pj_uint8_t octet_align = 0; 1087 const pj_str_t STR_FMTP_OCTET_ALIGN = {"octet-align", 11}; 1088 1089 /* Check octet-align */ 1095 pj_int8_t enc_mode = -1; 1096 1097 /* Check AMR specific attributes */ 1098 1090 1099 for (i = 0; i < attr->setting.dec_fmtp.cnt; ++i) { 1100 /* octet-align, one of the parameters that must have same value 1101 * in offer & answer (RFC 4867 Section 8.3.1). Just check fmtp 1102 * in the decoder side, since it's value is guaranteed to fulfil 1103 * above requirement (by SDP negotiator). 1104 */ 1105 const pj_str_t STR_FMTP_OCTET_ALIGN = {"octet-align", 11}; 1106 1091 1107 if (pj_stricmp(&attr->setting.dec_fmtp.param[i].name, 1092 1108 &STR_FMTP_OCTET_ALIGN) == 0) 1093 1109 { 1094 1110 octet_align=(pj_uint8_t) 1095 (pj_strtoul(&attr->setting.dec_fmtp.param[i].val));1111 pj_strtoul(&attr->setting.dec_fmtp.param[i].val); 1096 1112 break; 1097 1113 } 1098 1114 } 1099 1115 for (i = 0; i < attr->setting.enc_fmtp.cnt; ++i) { 1116 /* mode-set */ 1117 const pj_str_t STR_FMTP_MODE_SET = {"mode-set", 8}; 1118 1119 if (pj_stricmp(&attr->setting.enc_fmtp.param[i].name, 1120 &STR_FMTP_MODE_SET) == 0) 1121 { 1122 pj_int8_t tmp; 1123 1124 /* Just get the first value. */ 1125 tmp = (pj_int8_t) 1126 pj_strtoul(&attr->setting.enc_fmtp.param[i].val); 1127 1128 if ((ippc->pt == PJMEDIA_RTP_PT_AMR && tmp > 0 && tmp < 8) || 1129 (ippc->pt == PJMEDIA_RTP_PT_AMRWB && tmp > 0 && tmp < 9)) 1130 { 1131 enc_mode = tmp; 1132 PJ_LOG(4,(THIS_FILE, "Remote specifies AMR mode-set attr, " 1133 "selected: %d", enc_mode)); 1134 } 1135 break; 1136 } 1137 } 1138 1139 /* Initialize AMR specific settings */ 1100 1140 s = PJ_POOL_ZALLOC_T(pool, amr_settings_t); 1101 1141 codec_data->codec_setting = s; 1102 1103 s->enc_mode = pjmedia_codec_amr_get_mode(ippc->def_bitrate);1104 if (s->enc_mode < 0)1105 goto on_error;1106 1142 1107 1143 s->enc_setting.amr_nb = (pj_uint8_t)(ippc->pt == PJMEDIA_RTP_PT_AMR); … … 1109 1145 s->enc_setting.reorder = PJ_TRUE; 1110 1146 s->enc_setting.cmr = 15; 1111 1147 1112 1148 s->dec_setting.amr_nb = (pj_uint8_t)(ippc->pt == PJMEDIA_RTP_PT_AMR); 1113 1149 s->dec_setting.octet_aligned = octet_align; 1114 1150 s->dec_setting.reorder = PJ_TRUE; 1151 1152 s->enc_mode = pjmedia_codec_amr_get_mode( 1153 codec_data->info->params.modes.bitrate); 1154 if (s->enc_mode < 0) 1155 goto on_error; 1156 1157 if (enc_mode != -1) { 1158 s->enc_mode = enc_mode; 1159 1160 /* Apply requested encoder bitrate */ 1161 codec_data->info->params.modes.bitrate = s->enc_setting.amr_nb? 1162 pjmedia_codec_amrnb_bitrates[s->enc_mode] : 1163 pjmedia_codec_amrwb_bitrates[s->enc_mode]; 1164 ippc->fxns->std.Control(&codec_data->info->params.modes, 1165 codec_data->enc); 1166 } 1167 1115 1168 } 1116 1169 #endif
Note: See TracChangeset
for help on using the changeset viewer.