Changeset 2825 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
- Timestamp:
- Jun 30, 2009 3:02:06 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r2758 r2825 195 195 #if PJMEDIA_HAS_PASSTHROUGH_CODECS 196 196 /* Register passthrough codecs */ 197 status = pjmedia_codec_passthrough_init(pjsua_var.med_endpt); 198 if (status != PJ_SUCCESS) { 199 pjsua_perror(THIS_FILE, "Error initializing passthrough codecs", 200 status); 201 return status; 197 { 198 unsigned aud_idx; 199 unsigned ext_fmt_cnt = 0; 200 pjmedia_format ext_fmts[32]; 201 pjmedia_codec_passthrough_setting setting; 202 203 /* List extended formats supported by audio devices */ 204 for (aud_idx = 0; aud_idx < pjmedia_aud_dev_count(); ++aud_idx) { 205 pjmedia_aud_dev_info aud_info; 206 unsigned i; 207 208 status = pjmedia_aud_dev_get_info(aud_idx, &aud_info); 209 if (status != PJ_SUCCESS) { 210 pjsua_perror(THIS_FILE, "Error querying audio device info", 211 status); 212 return status; 213 } 214 215 /* Collect extended formats supported by this audio device */ 216 for (i = 0; i < aud_info.ext_fmt_cnt; ++i) { 217 unsigned j; 218 pj_bool_t is_listed = PJ_FALSE; 219 220 /* See if this extended format is already in the list */ 221 for (j = 0; j < ext_fmt_cnt && !is_listed; ++j) { 222 if (ext_fmts[j].id == aud_info.ext_fmt[i].id && 223 ext_fmts[j].bitrate == aud_info.ext_fmt[i].bitrate) 224 { 225 is_listed = PJ_TRUE; 226 } 227 } 228 229 /* Put this format into the list, if it is not in the list */ 230 if (!is_listed) 231 ext_fmts[ext_fmt_cnt++] = aud_info.ext_fmt[i]; 232 233 pj_assert(ext_fmt_cnt <= PJ_ARRAY_SIZE(ext_fmts)); 234 } 235 } 236 237 /* Init the passthrough codec with supported formats only */ 238 setting.fmt_cnt = ext_fmt_cnt; 239 setting.fmts = ext_fmts; 240 status = pjmedia_codec_passthrough_init2(pjsua_var.med_endpt, &setting); 241 if (status != PJ_SUCCESS) { 242 pjsua_perror(THIS_FILE, "Error initializing passthrough codecs", 243 status); 244 return status; 245 } 202 246 } 203 247 #endif /* PJMEDIA_HAS_PASSTHROUGH_CODECS */
Note: See TracChangeset
for help on using the changeset viewer.