Changeset 2825 for pjproject/trunk/pjmedia/src/pjmedia-codec/passthrough.c
- Timestamp:
- Jun 30, 2009 3:02:06 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-codec/passthrough.c
r2735 r2825 313 313 if (codec_factory.pool != NULL) { 314 314 /* Already initialized. */ 315 return PJ_ SUCCESS;315 return PJ_EEXISTS; 316 316 } 317 317 … … 355 355 356 356 /* 357 * Initialize and register passthrough codec factory to pjmedia endpoint. 358 */ 359 PJ_DEF(pj_status_t) pjmedia_codec_passthrough_init2( 360 pjmedia_endpt *endpt, 361 const pjmedia_codec_passthrough_setting *setting) 362 { 363 if (codec_factory.pool != NULL) { 364 /* Already initialized. */ 365 return PJ_EEXISTS; 366 } 367 368 if (setting != NULL) { 369 unsigned i; 370 371 /* Enable/disable codecs based on the specified encoding formats */ 372 for (i = 0; i < PJ_ARRAY_SIZE(codec_desc); ++i) { 373 pj_bool_t enabled = PJ_FALSE; 374 unsigned j; 375 376 for (j = 0; j < setting->fmt_cnt && !enabled; ++j) { 377 if (codec_desc[i].fmt_id == setting->fmts[j].id) 378 enabled = PJ_TRUE; 379 } 380 381 codec_desc[i].enabled = enabled; 382 } 383 } 384 385 return pjmedia_codec_passthrough_init(endpt); 386 } 387 388 /* 357 389 * Unregister passthrough codecs factory from pjmedia endpoint. 358 390 */ … … 360 392 { 361 393 pjmedia_codec_mgr *codec_mgr; 394 unsigned i; 362 395 pj_status_t status; 363 396 … … 387 420 pj_pool_release(codec_factory.pool); 388 421 codec_factory.pool = NULL; 422 423 /* Re-enable all codecs in the codec_desc. */ 424 for (i = 0; i < PJ_ARRAY_SIZE(codec_desc); ++i) { 425 codec_desc[i].enabled = PJ_TRUE; 426 } 389 427 390 428 return status;
Note: See TracChangeset
for help on using the changeset viewer.