Changeset 4082 for pjproject/trunk/pjmedia/src/pjmedia/sound_port.c
- Timestamp:
- Apr 24, 2012 1:09:14 PM (13 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk
- Property svn:mergeinfo changed
/pjproject/branches/1.x merged: 4063-4067,4074,4079
- Property svn:mergeinfo changed
-
pjproject/trunk/pjmedia/src/pjmedia/sound_port.c
r3999 r4082 53 53 unsigned bits_per_sample; 54 54 unsigned options; 55 unsigned prm_ec_options; 55 56 56 57 /* software ec */ … … 188 189 } 189 190 191 /* Initialize with default values (zero) */ 192 PJ_DEF(void) pjmedia_snd_port_param_default(pjmedia_snd_port_param *prm) 193 { 194 pj_bzero(prm, sizeof(*prm)); 195 } 196 190 197 /* 191 198 * Start the sound stream. … … 227 234 if (param_copy.flags & PJMEDIA_AUD_DEV_CAP_EC) { 228 235 /* EC is wanted */ 229 if (snd_port->aud_caps & PJMEDIA_AUD_DEV_CAP_EC) { 236 if ((snd_port->prm_ec_options & PJMEDIA_ECHO_USE_SW_ECHO) == 0 && 237 snd_port->aud_caps & PJMEDIA_AUD_DEV_CAP_EC) 238 { 230 239 /* Device supports EC */ 231 240 /* Nothing to do */ 232 241 } else { 233 /* Device doesn't support EC, remove EC settings from 242 /* Application wants to use software EC or device 243 * doesn't support EC, remove EC settings from 234 244 * device parameters 235 245 */ … … 263 273 snd_port->samples_per_frame); 264 274 265 /* Create software EC if parameter specifies EC but device 266 * doesn't support EC. Only do this if the format is PCM! 275 /* Create software EC if parameter specifies EC and 276 * (app specifically requests software EC or device 277 * doesn't support EC). Only do this if the format is PCM! 267 278 */ 268 279 if ((snd_port->aud_param.flags & PJMEDIA_AUD_DEV_CAP_EC) && 269 (snd_port->aud_caps & PJMEDIA_AUD_DEV_CAP_EC)==0 && 280 ((snd_port->aud_caps & PJMEDIA_AUD_DEV_CAP_EC)==0 || 281 (snd_port->prm_ec_options & PJMEDIA_ECHO_USE_SW_ECHO) != 0) && 270 282 param_copy.ext_fmt.id == PJMEDIA_FORMAT_PCM) 271 283 { … … 278 290 279 291 status = pjmedia_snd_port_set_ec(snd_port, pool, 280 snd_port->aud_param.ec_tail_ms, 0); 292 snd_port->aud_param.ec_tail_ms, 293 snd_port->prm_ec_options); 281 294 if (status != PJ_SUCCESS) { 282 295 pjmedia_aud_stream_destroy(snd_port->aud_stream); … … 339 352 pj_status_t status; 340 353 341 PJ_UNUSED_ARG(options);354 pjmedia_snd_port_param_default(¶m); 342 355 343 356 status = pjmedia_aud_dev_default_param(rec_id, ¶m.base); … … 353 366 param.base.bits_per_sample = bits_per_sample; 354 367 param.options = options; 368 param.ec_options = 0; 355 369 356 370 return pjmedia_snd_port_create2(pool, ¶m, p_port); … … 372 386 pj_status_t status; 373 387 374 PJ_UNUSED_ARG(options);388 pjmedia_snd_port_param_default(¶m); 375 389 376 390 status = pjmedia_aud_dev_default_param(dev_id, ¶m.base); … … 385 399 param.base.bits_per_sample = bits_per_sample; 386 400 param.options = options; 401 param.ec_options = 0; 387 402 388 403 return pjmedia_snd_port_create2(pool, ¶m, p_port); … … 405 420 pj_status_t status; 406 421 407 PJ_UNUSED_ARG(options);422 pjmedia_snd_port_param_default(¶m); 408 423 409 424 status = pjmedia_aud_dev_default_param(dev_id, ¶m.base); … … 418 433 param.base.bits_per_sample = bits_per_sample; 419 434 param.options = options; 435 param.ec_options = 0; 420 436 421 437 return pjmedia_snd_port_create2(pool, ¶m, p_port); … … 446 462 snd_port->samples_per_frame = prm->base.samples_per_frame; 447 463 snd_port->bits_per_sample = prm->base.bits_per_sample; 448 pj_memcpy(&snd_port->aud_param, prm, sizeof(snd_port->aud_param));464 pj_memcpy(&snd_port->aud_param, &prm->base, sizeof(snd_port->aud_param)); 449 465 snd_port->options = prm->options; 466 snd_port->prm_ec_options = prm->ec_options; 450 467 451 468 ptime_usec = prm->base.samples_per_frame * 1000 / prm->base.channel_count / … … 510 527 511 528 /* Determine whether we use device or software EC */ 512 if (snd_port->aud_caps & PJMEDIA_AUD_DEV_CAP_EC) { 529 if ((snd_port->prm_ec_options & PJMEDIA_ECHO_USE_SW_ECHO) == 0 && 530 snd_port->aud_caps & PJMEDIA_AUD_DEV_CAP_EC) 531 { 513 532 /* We use device EC */ 514 533 pj_bool_t ec_enabled;
Note: See TracChangeset
for help on using the changeset viewer.