static tsk_object_t* tnet_dtls_socket_dtor(tsk_object_t * self) { tnet_dtls_socket_t *socket = self; if (socket){ #if HAVE_OPENSSL if (socket->rbio) { //BIO_free(socket->rbio); socket->rbio = tsk_null; } if (socket->wbio) { //BIO_free(socket->wbio); socket->wbio = tsk_null; } if (socket->ssl) { SSL_shutdown(socket->ssl); // https://www.openssl.org/docs/crypto/BIO_s_bio.html // implicitly frees internal_bio SSL_free(socket->ssl); } #endif TSK_FREE(socket->handshake_data.ptr); TSK_OBJECT_SAFE_FREE(socket->wrapped_sock); tsk_safeobj_deinit(socket); TSK_DEBUG_INFO("*** tnet_dtls_socket_t destroyed ***"); } return self; }
static tsk_object_t* transport_context_dtor(tsk_object_t * self) { transport_context_t *context = self; if (context) { while(context->count) { removeSocketAtIndex(0, context); } tsk_safeobj_deinit(context); } return self; }
static tsk_object_t* tnet_tls_socket_dtor(tsk_object_t * self) { tnet_tls_socket_t *socket = self; if(socket){ #if HAVE_OPENSSL if(socket->ssl){ SSL_shutdown(socket->ssl); SSL_free(socket->ssl); } #endif tsk_safeobj_deinit(socket); } return self; }
static tsk_object_t* tdav_audiounit_instance_dtor(tsk_object_t * self) { tdav_audiounit_instance_t* inst = self; if(inst){ tsk_safeobj_lock(inst); if(inst->audioUnit){ AudioUnitUninitialize(inst->audioUnit); AudioComponentInstanceDispose(inst->audioUnit); inst->audioUnit = tsk_null; } tsk_safeobj_unlock(inst); tsk_safeobj_deinit(inst); } return self; }
static tsk_object_t* tdav_video_jb_dtor(tsk_object_t * self) { tdav_video_jb_t *jb = self; if(jb){ if(jb->started){ tdav_video_jb_stop(jb); } TSK_OBJECT_SAFE_FREE(jb->frames); if(jb->decode_thread_cond){ tsk_condwait_destroy(&jb->decode_thread_cond); } TSK_SAFE_FREE(jb->buffer.ptr); tsk_safeobj_deinit(jb); } return self; }
static void* tcomp_manager_dtor(void *self) { tcomp_manager_t *manager = self; if(manager){ TSK_OBJECT_SAFE_FREE(manager->stateHandler); TSK_OBJECT_SAFE_FREE(manager->dispatcher_compressor); TSK_OBJECT_SAFE_FREE(manager->dispatcher_decompressor); /* Deinitialize safeobject */ tsk_safeobj_deinit(manager); } else{ TSK_DEBUG_ERROR("Null manager."); } return self; }
/** DeInitialize video consumer */ int tdav_consumer_video_deinit(tdav_consumer_video_t* self) { int ret; if(!self){ TSK_DEBUG_ERROR("Invalid parameter"); return -1; } /* base */ if((ret = tmedia_consumer_deinit(TMEDIA_CONSUMER(self)))){ /* return ret; */ } /* self */ TSK_OBJECT_SAFE_FREE(self->jitterbuffer); tsk_safeobj_deinit(self); return 0; }
/* destructor */ static tsk_object_t* _tdav_producer_video_v4l2_dtor(tsk_object_t * self) { tdav_producer_video_v4l2_t *p_v4l2 = (tdav_producer_video_v4l2_t *)self; if (p_v4l2) { /* stop */ if (p_v4l2->b_started) { _tdav_producer_video_v4l2_stop((tmedia_producer_t*)p_v4l2); } /* deinit base */ tmedia_producer_deinit(TMEDIA_PRODUCER(p_v4l2)); /* deinit self */ _v4l2_unprepare(p_v4l2); TSK_OBJECT_SAFE_FREE(p_v4l2->p_timer_mgr); tsk_safeobj_deinit(p_v4l2); V4L2_DEBUG_INFO("*** destroyed ***"); } return self; }
static tsk_object_t* txcap_stack_destroy(tsk_object_t* self) { txcap_stack_t *stack = self; if(stack){ /* vars */ TSK_FREE(stack->xui); TSK_FREE(stack->password); TSK_FREE(stack->xcap_root); /* HTTP/HTTPS resources */ TSK_OBJECT_SAFE_FREE(stack->http_session); TSK_OBJECT_SAFE_FREE(stack->http_stack); /* Options */ TSK_OBJECT_SAFE_FREE(stack->options); /* AUIDs */ TSK_OBJECT_SAFE_FREE(stack->auids); tsk_safeobj_deinit(stack); } return self; }