[Freeswitch-svn] [commit] r6473 - in freeswitch/trunk/src: include mod/formats/mod_local_stream mod/formats/mod_shout

Freeswitch SVN anthm at freeswitch.org
Sun Dec 2 11:01:56 EST 2007


Author: anthm
Date: Sun Dec  2 11:01:56 2007
New Revision: 6473

Modified:
   freeswitch/trunk/src/include/switch_module_interfaces.h
   freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
   freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c

Log:
add interval to file handles for streams

Modified: freeswitch/trunk/src/include/switch_module_interfaces.h
==============================================================================
--- freeswitch/trunk/src/include/switch_module_interfaces.h	(original)
+++ freeswitch/trunk/src/include/switch_module_interfaces.h	Sun Dec  2 11:01:56 2007
@@ -279,6 +279,7 @@
 	/*! pre-buffer x bytes for streams */
 	uint32_t prebuf;
 	/*! private data for the format module to store handle specific info */
+	uint32_t interval;
 	void *private_info;
 	char *handler;
 	int64_t pos;

Modified: freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c	(original)
+++ freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c	Sun Dec  2 11:01:56 2007
@@ -174,13 +174,14 @@
 	handle->seekable = 0;
 	handle->speed = 0;
 	handle->private_info = context;
+	handle->interval = source->interval;
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening Stream [%s] %dhz\n", path, handle->samplerate);
 	
 	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");
 		return SWITCH_STATUS_MEMERR;
-	}	
+	}
 	
 	context->source = source;
 

Modified: freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c	(original)
+++ freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c	Sun Dec  2 11:01:56 2007
@@ -1123,6 +1123,7 @@
     uint8_t buf[1024];
     int rlen;
     int is_local = 0;
+    uint32_t interval = 20000;
 
     if (strstr(path_info + 7, "://")) {
         file = strdup(path_info + 7);
@@ -1171,14 +1172,17 @@
                            path_info + 7);
 
 
-            
+    if (fh.interval) {
+        interval = fh.interval;
+    }
+
     for(;;) {
         switch_size_t samples = sizeof(buf) / 2;
 
         switch_core_file_read(&fh, buf, &samples);
 
         if (is_local) {
-            switch_yield(20000);
+            switch_yield(interval);
         }
 
         if (!samples) {



More information about the Freeswitch-svn mailing list