/* * Unregister AMR codec factory from pjmedia endpoint and deinitialize * the AMR codec library. */ PJ_DEF(pj_status_t) pjmedia_codec_opencore_amr_deinit(void) { pjmedia_codec_mgr *codec_mgr; pj_status_t status; amr_codec_factory.init[IDX_AMR_NB] = PJ_FALSE; amr_codec_factory.init[IDX_AMR_WB] = PJ_FALSE; if (amr_codec_factory.pool == NULL) return PJ_SUCCESS; /* Get the codec manager. */ codec_mgr = pjmedia_endpt_get_codec_mgr(amr_codec_factory.endpt); if (!codec_mgr) { pj_pool_release(amr_codec_factory.pool); amr_codec_factory.pool = NULL; return PJ_EINVALIDOP; } /* Unregister AMR codec factory. */ status = pjmedia_codec_mgr_unregister_factory(codec_mgr, &amr_codec_factory.base); /* Destroy pool. */ pj_pool_release(amr_codec_factory.pool); amr_codec_factory.pool = NULL; return status; }
/* * Unregister Opus codec factory from pjmedia endpoint and * deinitialize the codec. */ PJ_DEF(pj_status_t) pjmedia_codec_opus_deinit( void ) { pj_status_t status; pjmedia_codec_mgr *codec_mgr; if (opus_codec_factory.pool == NULL) return PJ_SUCCESS; /* Get the codec manager */ codec_mgr = pjmedia_endpt_get_codec_mgr(opus_codec_factory.endpt); if (!codec_mgr) { PJ_LOG(2, (THIS_FILE, "Unable to get the codec manager")); pj_pool_release(opus_codec_factory.pool); opus_codec_factory.pool = NULL; return PJ_EINVALIDOP; } /* Unregister the codec factory */ status = pjmedia_codec_mgr_unregister_factory(codec_mgr, &opus_codec_factory.base); if (status != PJ_SUCCESS) PJ_LOG(2, (THIS_FILE, "Unable to unregister the codec factory")); /* Release the memory pool */ pj_pool_release(opus_codec_factory.pool); opus_codec_factory.pool = NULL; return status; }
/* * Unregister G722 codec factory from pjmedia endpoint and deinitialize * the G722 codec library. */ PJ_DEF(pj_status_t) pjmedia_codec_g722_deinit(void) { pjmedia_codec_mgr *codec_mgr; pj_status_t status; if (g722_codec_factory.pool == NULL) return PJ_SUCCESS; /* Get the codec manager. */ codec_mgr = pjmedia_endpt_get_codec_mgr(g722_codec_factory.endpt); if (!codec_mgr) { pj_pool_release(g722_codec_factory.pool); g722_codec_factory.pool = NULL; return PJ_EINVALIDOP; } /* Unregister G722 codec factory. */ status = pjmedia_codec_mgr_unregister_factory(codec_mgr, &g722_codec_factory.base); /* Destroy mutex. */ pj_mutex_destroy(g722_codec_factory.mutex); /* Destroy pool. */ pj_pool_release(g722_codec_factory.pool); g722_codec_factory.pool = NULL; TRACE_((THIS_FILE, "G722 codec factory shutdown")); return status; }
*/ PJ_DEF(pj_status_t) pjmedia_codec_opus_deinit(void) { pjmedia_codec_mgr *codec_mgr; pj_status_t status; if (opus_factory.endpt == NULL) { /* Not registered. */ return PJ_SUCCESS; } /* Lock mutex. */ pj_mutex_lock(opus_factory.mutex); /* Get the codec manager. */ codec_mgr = pjmedia_endpt_get_codec_mgr(opus_factory.endpt); if (!codec_mgr) { opus_factory.endpt = NULL; pj_mutex_unlock(opus_factory.mutex); return PJ_EINVALIDOP; } /* Unregister opus codec factory. */ status = pjmedia_codec_mgr_unregister_factory(codec_mgr, &opus_factory.base); opus_factory.endpt = NULL; /* Destroy mutex. */ pj_mutex_destroy(opus_factory.mutex); opus_factory.mutex = NULL; /* Release pool. */ pj_pool_release(opus_factory.pool); opus_factory.pool = NULL; return status; }
/* * Unregister CODEC2 codec factory from pjmedia endpoint and deinitialize * the CODEC2 codec library. */ PJ_DEF(pj_status_t) pjmedia_codec_codec2_deinit(void) { pjmedia_codec_mgr *codec_mgr; pj_status_t status; if (codec2_codec_factory.pool == NULL) return PJ_SUCCESS; /* Get the codec manager. */ codec_mgr = pjmedia_endpt_get_codec_mgr(codec2_codec_factory.endpt); if (!codec_mgr) { pj_pool_release(codec2_codec_factory.pool); codec2_codec_factory.pool = NULL; return PJ_EINVALIDOP; } /* Unregister GSM codec factory. */ status = pjmedia_codec_mgr_unregister_factory(codec_mgr, &codec2_codec_factory.base); /* Destroy mutex. */ pj_mutex_destroy(codec2_codec_factory.mutex); /* Destroy pool. */ pj_pool_release(codec2_codec_factory.pool); codec2_codec_factory.pool = NULL; return status; }
/* * Unregister iLBC codec factory from pjmedia endpoint and deinitialize * the iLBC codec library. */ PJ_DEF(pj_status_t) pjmedia_codec_ilbc_deinit(void) { pjmedia_codec_mgr *codec_mgr; pj_status_t status; /* Get the codec manager. */ codec_mgr = pjmedia_endpt_get_codec_mgr(ilbc_factory.endpt); if (!codec_mgr) return PJ_EINVALIDOP; /* Unregister iLBC codec factory. */ status = pjmedia_codec_mgr_unregister_factory(codec_mgr, &ilbc_factory.base); return status; }
/* * Unregister Speex codec factory from pjmedia endpoint and deinitialize * the Speex codec library. */ PJ_DEF(pj_status_t) pjmedia_codec_speex_deinit(void) { pjmedia_codec_mgr *codec_mgr; pj_status_t status; if (spx_factory.pool == NULL) { /* Already deinitialized */ return PJ_SUCCESS; } pj_mutex_lock(spx_factory.mutex); /* We don't want to deinit if there's outstanding codec. */ /* This is silly, as we'll always have codec in the list if we ever allocate a codec! A better behavior maybe is to deallocate all codecs in the list. if (!pj_list_empty(&spx_factory.codec_list)) { pj_mutex_unlock(spx_factory.mutex); return PJ_EBUSY; } */ /* Get the codec manager. */ codec_mgr = pjmedia_endpt_get_codec_mgr(spx_factory.endpt); if (!codec_mgr) { pj_pool_release(spx_factory.pool); spx_factory.pool = NULL; return PJ_EINVALIDOP; } /* Unregister Speex codec factory. */ status = pjmedia_codec_mgr_unregister_factory(codec_mgr, &spx_factory.base); /* Destroy mutex. */ pj_mutex_destroy(spx_factory.mutex); /* Destroy pool. */ pj_pool_release(spx_factory.pool); spx_factory.pool = NULL; return status; }