[Freeswitch-svn] [commit] r5748 - freeswitch/trunk/src

Freeswitch SVN anthm at freeswitch.org
Mon Sep 24 11:52:32 EDT 2007


Author: anthm
Date: Mon Sep 24 11:52:32 2007
New Revision: 5748

Modified:
   freeswitch/trunk/src/switch_buffer.c
   freeswitch/trunk/src/switch_ivr_play_say.c

Log:
fix initialized struct

Modified: freeswitch/trunk/src/switch_buffer.c
==============================================================================
--- freeswitch/trunk/src/switch_buffer.c	(original)
+++ freeswitch/trunk/src/switch_buffer.c	Mon Sep 24 11:52:32 2007
@@ -157,13 +157,15 @@
 {
 	switch_size_t len;
 	if ((len = switch_buffer_read(buffer, data, datalen)) == 0) {
+		if (buffer->loops >= 0) {
+			buffer->loops--;
+		}
 		if (buffer->loops == 0) {
 			return 0;
 		}
 		buffer->head = buffer->data;
 		buffer->used = buffer->actually_used;
 		len = switch_buffer_read(buffer, data, datalen);
-		buffer->loops--;
 	}
 	return len;
 }

Modified: freeswitch/trunk/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_play_say.c	(original)
+++ freeswitch/trunk/src/switch_ivr_play_say.c	Mon Sep 24 11:52:32 2007
@@ -504,8 +504,8 @@
 	teletone_generation_session_t ts;
 	switch_buffer_t *audio_buffer;
 	switch_frame_t *read_frame = NULL;
-	switch_codec_t *read_codec = NULL, write_codec;
-	switch_frame_t write_frame;
+	switch_codec_t *read_codec = NULL, write_codec = { 0 };
+	switch_frame_t write_frame = { 0 };
 	switch_byte_t data[1024];
 	switch_channel_t *channel;
 
@@ -516,7 +516,7 @@
 
 	switch_channel_pre_answer(channel);
 	read_codec = switch_core_session_get_read_codec(session);
-
+	
 	if (switch_core_codec_init(&write_codec,
 							   "L16",
 							   NULL,
@@ -527,14 +527,14 @@
 
 		return SWITCH_STATUS_FALSE;
 	}
-
+	memset(&ts, 0, sizeof(ts));
 	write_frame.codec = &write_codec;
 	write_frame.data = data;
 
 	switch_buffer_create_dynamic(&audio_buffer, 512, 1024, 0);
 	teletone_init_session(&ts, 0, teletone_handler, audio_buffer);
 	ts.rate = read_codec->implementation->samples_per_second;
-
+	ts.channels = 1;
 	teletone_run(&ts, script);
 
 	if (loops) {
@@ -570,7 +570,7 @@
 		}
 
 		write_frame.samples = write_frame.datalen / 2;
-		
+
 		if (switch_core_session_write_frame(session, &write_frame, 1000, 0) != SWITCH_STATUS_SUCCESS) {
 			break;
 		}



More information about the Freeswitch-svn mailing list