static void pjmedia_srtp_deinit_lib(pjmedia_endpt *endpt)
{
    err_status_t err;

    /* Note that currently this SRTP init/deinit is not equipped with
     * reference counter, it should be safe as normally there is only
     * one single instance of media endpoint and even if it isn't, the
     * pjmedia_transport_srtp_create() will invoke SRTP init (the only
     * drawback should be the delay described by #788).
     */

    PJ_UNUSED_ARG(endpt);

#if defined(PJMEDIA_EXTERNAL_SRTP) && (PJMEDIA_EXTERNAL_SRTP != 0)

# if defined(PJMEDIA_SRTP_HAS_DEINIT) && PJMEDIA_SRTP_HAS_DEINIT!=0
    err = srtp_deinit();
# elif defined(PJMEDIA_SRTP_HAS_SHUTDOWN) && PJMEDIA_SRTP_HAS_SHUTDOWN!=0
    err = srtp_shutdown();
# else
    err = err_status_ok;
# endif

#else
    err = srtp_deinit();
#endif
    if (err != err_status_ok) {
	PJ_LOG(4, (THIS_FILE, "Failed to deinitialize libsrtp: %s",
		   get_libsrtp_errstr(err)));
    }

    libsrtp_initialized = PJ_FALSE;
}
Exemple #2
0
static void pjmedia_srtp_deinit_lib(void)
{
    err_status_t err;

    err = srtp_deinit();
    if (err != err_status_ok) {
	PJ_LOG(4, (THIS_FILE, "Failed to deinitialize libsrtp: %s", 
		   get_libsrtp_errstr(err)));
    }

    libsrtp_initialized = PJ_FALSE;
}
static void pjmedia_srtp_deinit_lib(pjmedia_endpt *endpt)
{
    err_status_t err;

    /* Note that currently this SRTP init/deinit is not equipped with
     * reference counter, it should be safe as normally there is only
     * one single instance of media endpoint and even if it isn't, the
     * pjmedia_transport_srtp_create() will invoke SRTP init (the only
     * drawback should be the delay described by #788).
     */

    PJ_UNUSED_ARG(endpt);

    err = srtp_deinit();
    if (err != err_status_ok) {
	PJ_LOG(4, (THIS_FILE, "Failed to deinitialize libsrtp: %s", 
		   get_libsrtp_errstr(err)));
    }

    libsrtp_initialized = PJ_FALSE;
}
JNIEXPORT jint JNICALL Java_org_theonionphone_protocol_SrtpProtocol_deinit
	(JNIEnv *env, jobject obj) {

	err_status_t status = srtp_dealloc((*srtpContextSend));
	if(status) {
		return status;
	}

	status = srtp_dealloc((*srtpContextRecv));
	if(status) {
		return status;
	}

	status = srtp_deinit();
	if(status) {
		return status;
	}

	free(srtpContextSend);
	free(srtpContextRecv);

	return status;
}