static switch_status_t local_stream_file_close(switch_file_handle_t *handle)
{
	local_stream_context_t *cp, *last = NULL, *context = handle->private_info;

	context->ready = 0;

	switch_mutex_lock(context->source->mutex);
	for (cp = context->source->context_list; cp; cp = cp->next) {
		if (cp == context) {
			if (last) {
				last->next = cp->next;
			} else {
				context->source->context_list = cp->next;
			}
			break;
		}
		last = cp;
	}
	
	if (context->video_q) {
		flush_video_queue(context->video_q);
		switch_queue_trypush(context->video_q, NULL);
		switch_queue_interrupt_all(context->video_q);
		flush_video_queue(context->video_q);
	}

	switch_img_free(&context->banner_img);
	
	context->source->total--;
	switch_mutex_unlock(context->source->mutex);
	switch_buffer_destroy(&context->audio_buffer);
	switch_thread_rwlock_unlock(context->source->rwlock);

	return SWITCH_STATUS_SUCCESS;
}
Exemple #2
0
SWITCH_DECLARE(void) EventConsumer::cleanup()
{

	uint32_t i;
	void *pop;

	if (!ready) {
		return;
	}	

	ready = 0;

	for (i = 0; i < node_index; i++) {
		switch_event_unbind(&enodes[i]);
	}

	node_index = 0;

	if (events) {
		switch_queue_interrupt_all(events);
	}

	while(switch_queue_trypop(events, &pop) == SWITCH_STATUS_SUCCESS) {
		switch_event_t *event = (switch_event_t *) pop;
		switch_event_destroy(&event);
	}


	switch_core_destroy_memory_pool(&pool);

}
Exemple #3
0
SWITCH_DECLARE_CONSTRUCTOR EventConsumer::~EventConsumer()
{
	if (node) {
		switch_event_unbind(&node);
	}

	if (events) {
		switch_queue_interrupt_all(events);
	}

	switch_core_destroy_memory_pool(&pool);
}
SWITCH_DECLARE_CONSTRUCTOR EventConsumer::~EventConsumer()
{
	uint32_t i;

	for (i = 0; i < node_index; i++) {
		switch_event_unbind(&enodes[i]);
	}

	if (events) {
		switch_queue_interrupt_all(events);
	}

	switch_core_destroy_memory_pool(&pool);
}
Exemple #5
0
/**
 * Stop graylog2 delivery thread
 */
static void stop_deliver_graylog2_thread(void)
{
	globals.shutdown = 1;
	switch_queue_interrupt_all(globals.log_queue);
	switch_thread_rwlock_wrlock(globals.shutdown_rwlock);
}