]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix codec issue
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 13 Nov 2008 23:07:03 +0000 (23:07 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 13 Nov 2008 23:07:03 +0000 (23:07 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10390 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_module_interfaces.h
src/mod/endpoints/mod_sofia/mod_sofia.c
src/switch_loadable_module.c

index e615f8403afb430d406d69da1309a6ba746f042a..3cb497975aaa7cc73c64c63ba6a2a2831e4b5f1f 100644 (file)
@@ -633,8 +633,8 @@ struct switch_api_interface {
        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
index 96354feac05ba595c4469d1ec29bf7a3d0c5fde6..90f9fe4bc4496564517b3c041989192b18977a4c 100644 (file)
@@ -373,6 +373,17 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
                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--;
index 5706494a7fbda05cf2b46458dde6280595e1b288..ca10db6fa495468754c581ec52fcdbdf50e375d2 100644 (file)
@@ -1479,9 +1479,12 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
 
                  found:
 
+                       UNPROTECT_INTERFACE(codec_interface);
+
                        if (i > arraylen) {
                                break;
                        }
+
                }
        }