Changeset 2724 for pjproject/trunk/pjmedia/src/pjmedia-codec/ipp_codecs.c
- Timestamp:
- May 29, 2009 1:04:03 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-codec/ipp_codecs.c
r2573 r2724 234 234 { 235 235 # if PJMEDIA_HAS_INTEL_IPP_CODEC_AMR 236 /* AMR-NB SID seems to produce noise, so let's just disable its VAD. */ 236 237 {1, "AMR", PJMEDIA_RTP_PT_AMR, &USC_GSMAMR_Fxns, 8000, 1, 160, 237 5900, 12200, 4, 1, 1,238 &predecode_amr, &parse_amr, &pack_amr 239 /*, {1, {{{"octet-align", 11}, {"1", 1}}} } */238 7400, 12200, 2, 0, 1, 239 &predecode_amr, &parse_amr, &pack_amr, 240 {1, {{{"octet-align", 11}, {"1", 1}}} } 240 241 }, 241 242 # endif … … 244 245 {1, "AMR-WB", PJMEDIA_RTP_PT_AMRWB, &USC_AMRWB_Fxns, 16000, 1, 320, 245 246 15850, 23850, 1, 1, 1, 246 &predecode_amr, &parse_amr, &pack_amr 247 &predecode_amr, &parse_amr, &pack_amr, 248 {1, {{{"octet-align", 11}, {"1", 1}}} } 247 249 }, 248 250 # endif … … 561 563 /* Check Change Mode Request. */ 562 564 if ((setting->amr_nb && cmr <= 7) || (!setting->amr_nb && cmr <= 8)) { 565 struct ipp_codec *ippc = &ipp_codec[codec_data->codec_idx]; 566 563 567 s->enc_mode = cmr; 568 codec_data->info->params.modes.bitrate = s->enc_setting.amr_nb? 569 pjmedia_codec_amrnb_bitrates[s->enc_mode] : 570 pjmedia_codec_amrwb_bitrates[s->enc_mode]; 571 ippc->fxns->std.Control(&codec_data->info->params.modes, 572 codec_data->enc); 564 573 } 565 574 … … 1034 1043 1035 1044 /* Not sure if VAD affects decoder, just try to be safe */ 1036 codec_data->info->params.modes.vad = ippc->has_native_vad;1045 //codec_data->info->params.modes.vad = ippc->has_native_vad; 1037 1046 1038 1047 /* Get number of memory blocks needed by the decoder */ … … 1085 1094 amr_settings_t *s; 1086 1095 pj_uint8_t octet_align = 0; 1087 const pj_str_t STR_FMTP_OCTET_ALIGN = {"octet-align", 11}; 1088 1089 /* Check octet-align */ 1096 pj_int8_t enc_mode = -1; 1097 1098 /* Check AMR specific attributes */ 1099 1090 1100 for (i = 0; i < attr->setting.dec_fmtp.cnt; ++i) { 1101 /* octet-align, one of the parameters that must have same value 1102 * in offer & answer (RFC 4867 Section 8.3.1). Just check fmtp 1103 * in the decoder side, since it's value is guaranteed to fulfil 1104 * above requirement (by SDP negotiator). 1105 */ 1106 const pj_str_t STR_FMTP_OCTET_ALIGN = {"octet-align", 11}; 1107 1091 1108 if (pj_stricmp(&attr->setting.dec_fmtp.param[i].name, 1092 1109 &STR_FMTP_OCTET_ALIGN) == 0) 1093 1110 { 1094 1111 octet_align=(pj_uint8_t) 1095 (pj_strtoul(&attr->setting.dec_fmtp.param[i].val));1112 pj_strtoul(&attr->setting.dec_fmtp.param[i].val); 1096 1113 break; 1097 1114 } 1098 1115 } 1099 1116 for (i = 0; i < attr->setting.enc_fmtp.cnt; ++i) { 1117 /* mode-set */ 1118 const pj_str_t STR_FMTP_MODE_SET = {"mode-set", 8}; 1119 1120 if (pj_stricmp(&attr->setting.enc_fmtp.param[i].name, 1121 &STR_FMTP_MODE_SET) == 0) 1122 { 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)); 1135 } 1136 break; 1137 } 1138 } 1139 1140 /* Initialize AMR specific settings */ 1100 1141 s = PJ_POOL_ZALLOC_T(pool, amr_settings_t); 1101 1142 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 1143 1107 1144 s->enc_setting.amr_nb = (pj_uint8_t)(ippc->pt == PJMEDIA_RTP_PT_AMR); … … 1109 1146 s->enc_setting.reorder = PJ_TRUE; 1110 1147 s->enc_setting.cmr = 15; 1111 1148 1112 1149 s->dec_setting.amr_nb = (pj_uint8_t)(ippc->pt == PJMEDIA_RTP_PT_AMR); 1113 1150 s->dec_setting.octet_aligned = octet_align; 1114 1151 s->dec_setting.reorder = PJ_TRUE; 1152 1153 s->enc_mode = pjmedia_codec_amr_get_mode( 1154 codec_data->info->params.modes.bitrate); 1155 if (s->enc_mode < 0) 1156 goto on_error; 1157 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 1115 1169 } 1116 1170 #endif
Note: See TracChangeset
for help on using the changeset viewer.