[Freeswitch-svn] [commit] r12728 - in freeswitch/trunk/src: . mod/formats/mod_sndfile mod/languages/mod_lua

FreeSWITCH SVN anthm at freeswitch.org
Tue Mar 24 07:54:13 PDT 2009


Author: anthm
Date: Tue Mar 24 09:54:13 2009
New Revision: 12728

Log:
FSCORE-341

Modified:
   freeswitch/trunk/src/mod/formats/mod_sndfile/mod_sndfile.c
   freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp
   freeswitch/trunk/src/switch_core_file.c
   freeswitch/trunk/src/switch_cpp.cpp

Modified: freeswitch/trunk/src/mod/formats/mod_sndfile/mod_sndfile.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_sndfile/mod_sndfile.c	(original)
+++ freeswitch/trunk/src/mod/formats/mod_sndfile/mod_sndfile.c	Tue Mar 24 09:54:13 2009
@@ -103,7 +103,8 @@
 		context->sfinfo.channels = handle->channels;
 		context->sfinfo.samplerate = handle->samplerate;
 		if (handle->samplerate == 8000 || handle->samplerate == 16000 ||
-			handle->samplerate == 24000 || handle->samplerate == 32000 || handle->samplerate == 48000) {
+			handle->samplerate == 24000 || handle->samplerate == 32000 || handle->samplerate == 48000 ||
+			handle->samplerate == 11025 || handle->samplerate == 22050 || handle->samplerate == 44100) {
 			context->sfinfo.format |= SF_FORMAT_PCM_16;
 		}
 

Modified: freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp	Tue Mar 24 09:54:13 2009
@@ -24,20 +24,23 @@
 Session::~Session()
 {
 
-	if (channel) {
-		switch_channel_set_private(channel, "CoreSession", NULL);
-	}
-
-	if (hangup_func_str) {
-		if (session) {
-			switch_core_event_hook_remove_state_change(session, lua_hanguphook);
+	if (session) {
+		if (!channel) {
+			channel = switch_core_session_get_channel(session);
 		}
-		switch_safe_free(hangup_func_str);
+		switch_channel_set_private(channel, "CoreSession", NULL);
+		switch_core_event_hook_remove_state_change(session, lua_hanguphook);
+		session = NULL;
+		channel = NULL;
 	}
 
+	switch_safe_free(hangup_func_str);
 	switch_safe_free(hangup_func_arg);
 	switch_safe_free(cb_function);
 	switch_safe_free(cb_arg);
+
+	init_vars();
+	
 }
 
 bool Session::begin_allow_threads()

Modified: freeswitch/trunk/src/switch_core_file.c
==============================================================================
--- freeswitch/trunk/src/switch_core_file.c	(original)
+++ freeswitch/trunk/src/switch_core_file.c	Tue Mar 24 09:54:13 2009
@@ -290,10 +290,10 @@
 				fh->dbuf = switch_core_alloc(fh->memory_pool, fh->dbuflen);
 			}
 			switch_assert(fh->resampler->to_len <= fh->dbuflen);
-			memcpy(fh->dbuf, fh->resampler->to, fh->resampler->to_len);
+			memcpy(fh->dbuf, fh->resampler->to, fh->resampler->to_len * 2);
 			data = fh->dbuf;
 		} else {
-			memcpy(data, fh->resampler->to, fh->resampler->to_len);
+			memcpy(data, fh->resampler->to, fh->resampler->to_len * 2);
 		}
 
 		*len = fh->resampler->to_len / fh->channels;

Modified: freeswitch/trunk/src/switch_cpp.cpp
==============================================================================
--- freeswitch/trunk/src/switch_cpp.cpp	(original)
+++ freeswitch/trunk/src/switch_cpp.cpp	Tue Mar 24 09:54:13 2009
@@ -888,22 +888,28 @@
 {
 	this_check_void();
 
-	if (channel) {
-		switch_channel_set_private(channel, "CoreSession", NULL);
-	}
-	
 	switch_safe_free(xml_cdr_text);
 	switch_safe_free(uuid);	
 	switch_safe_free(tts_name);
 	switch_safe_free(voice_name);
 
 	if (session) {
+		if (!channel) {
+			channel = switch_core_session_get_channel(session);
+		}
+
+		if (channel) {
+			switch_channel_set_private(channel, "CoreSession", NULL);
+		}
+		
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "destroy/unlink session from object\n");
-        if (switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {
+
+        if (switch_channel_up(channel) && switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {
             switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
         }
         switch_core_session_rwunlock(session);
 		session = NULL;
+		channel = NULL;
     }
 
 	allocated = 0;



More information about the Freeswitch-svn mailing list