[Freeswitch-svn] [commit] r10390 - in freeswitch/trunk/src: . include mod/endpoints/mod_sofia

FreeSWITCH SVN anthm at freeswitch.org
Thu Nov 13 15:07:03 PST 2008


Author: anthm
Date: Thu Nov 13 18:07:03 2008
New Revision: 10390

Log:
fix codec issue

Modified:
   freeswitch/trunk/src/include/switch_module_interfaces.h
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/switch_loadable_module.c

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	Thu Nov 13 18:07:03 2008
@@ -633,8 +633,8 @@
 	struct switch_api_interface *next;
 };
 
-#define PROTECT_INTERFACE(_it) if (!_it->refs) {switch_thread_rwlock_rdlock(_it->parent->rwlock); switch_thread_rwlock_rdlock(_it->rwlock); _it->refs++; _it->parent->refs++;}
-#define UNPROTECT_INTERFACE(_it) if (_it->refs) {switch_thread_rwlock_unlock(_it->rwlock); switch_thread_rwlock_unlock(_it->parent->rwlock); _it->refs--; _it->parent->refs--; _it = NULL;}
+#define PROTECT_INTERFACE(_it) if (_it && !_it->refs) {switch_thread_rwlock_rdlock(_it->parent->rwlock); switch_thread_rwlock_rdlock(_it->rwlock); _it->refs++; _it->parent->refs++;} //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "+++++++++++LOCK\n");
+#define UNPROTECT_INTERFACE(_it) if (_it && _it->refs) {switch_thread_rwlock_unlock(_it->rwlock); switch_thread_rwlock_unlock(_it->parent->rwlock); _it->refs--; _it->parent->refs--; _it = NULL;} //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "-----------UNLOCK\n");
 
 SWITCH_END_EXTERN_C
 #endif

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Thu Nov 13 18:07:03 2008
@@ -373,6 +373,17 @@
 		switch_safe_free(stream.data);
 	}
 
+	if (tech_pvt->read_codec.implementation) {
+		switch_core_codec_destroy(&tech_pvt->read_codec);
+	}
+
+	if (tech_pvt->write_codec.implementation) {
+		switch_core_codec_destroy(&tech_pvt->write_codec);
+	}
+
+	switch_core_session_unset_read_codec(session);
+	switch_core_session_unset_write_codec(session);
+
 	switch_mutex_lock(tech_pvt->profile->flag_mutex);
 	switch_clear_flag(tech_pvt, TFLAG_IO);
 	tech_pvt->profile->inuse--;

Modified: freeswitch/trunk/src/switch_loadable_module.c
==============================================================================
--- freeswitch/trunk/src/switch_loadable_module.c	(original)
+++ freeswitch/trunk/src/switch_loadable_module.c	Thu Nov 13 18:07:03 2008
@@ -1479,9 +1479,12 @@
 
 		  found:
 
+			UNPROTECT_INTERFACE(codec_interface);
+
 			if (i > arraylen) {
 				break;
 			}
+
 		}
 	}
 



More information about the Freeswitch-svn mailing list