Revision
15795
Author
mikej
Date
2009-12-04 15:23:09 -0600 (Fri, 04 Dec 2009)

Log Message

code before decl and whitespace

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c (15794 => 15795)


--- freeswitch/trunk/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c	2009-12-04 20:54:15 UTC (rev 15794)
+++ freeswitch/trunk/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c	2009-12-04 21:23:09 UTC (rev 15795)
@@ -374,11 +374,8 @@
 	uint32_t rate = PREFERRED_RATE;
 	char *npath ;
 	int devNumber;
+	int tmp;
 
-
-
-
-
 	handle->pre_buffer_datalen = 0;
 
 	if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
@@ -388,7 +385,7 @@
 
 	npath =  switch_core_strdup(module_pool, path);
 
-	int tmp = handle->samplerate;
+	tmp = handle->samplerate;
 	if (tmp == 8000 || tmp == 16000 || tmp == 32000 || tmp == 48000) {
 		rate = tmp;
 	}
@@ -400,8 +397,6 @@
 	}
     npath = switch_mprintf("device-%d at %d",devNumber,rate);
 
-
-
 	switch_mutex_lock(globals.mutex);
 	source = switch_core_hash_find(globals.source_hash, npath);
 
@@ -426,22 +421,15 @@
 				source->ready = 0;
 				source->samples = switch_samples_per_packet(source->rate, source->interval);
 
-
-
 				switch_mutex_init(&source->mutex, SWITCH_MUTEX_NESTED, source->pool);
 
-
-
 				switch_threadattr_create(&thd_attr, source->pool);
 				switch_threadattr_detach_set(thd_attr, 1);
 
 				switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
 				switch_thread_create(&thread, thd_attr, read_stream_thread, source, source->pool);
-
 			}
-
 		}
-
 	}
 	switch_mutex_unlock(globals.mutex);
 	switch_yield(1000000);
@@ -449,19 +437,16 @@
 	if (source) {
 
 		/*wait for source to be ready*/
+		while(source->ready==0) {
+			switch_yield(100000);
+		}
 
-		while(source->ready==0){switch_yield(100000);}
-
-
 		if (switch_thread_rwlock_tryrdlock(source->rwlock) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, " error rwlock !\n");
 			source = NULL;
 		}
-
 	}
 
-
-
 	if (source) {
 		status = SWITCH_STATUS_SUCCESS;
 
@@ -480,7 +465,6 @@
 			handle->private_info = context;
 			handle->interval = source->interval;
 
-
 			switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, handle->memory_pool);
 			if (switch_buffer_create_dynamic(&context->audio_buffer, 512, 1024, 0) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
@@ -497,7 +481,6 @@
 				source->context_list = context;
 				source->total++;
 				switch_mutex_unlock(source->mutex);
-
 			}
 		}
 	} else {
@@ -505,8 +488,6 @@
 		status = SWITCH_STATUS_FALSE;
 	}
 
-
-
 	return status;
 }
 
@@ -544,8 +525,6 @@
 	int bytesPerSample = context->source->audio_stream->bytesPerFrame;
 	size_t need = *len * bytesPerSample;
 
-
-
 	if (!context->source->ready) {
 		*len = 0;
 		return SWITCH_STATUS_FALSE;