]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
stable branch version of spandsp changes in 4178688b4a7c77cc5ca296fd6bc0b91fea0d0f2a
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 14 Apr 2014 20:57:28 +0000 (01:57 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 14 Apr 2014 20:57:28 +0000 (01:57 +0500)
src/mod/applications/mod_spandsp/mod_spandsp.c

index 08bcf5e17dc5f0eaffe19729bb963844e8409fd7..578991829225ee70480b7bd7e6163c17e214448b 100644 (file)
@@ -477,6 +477,25 @@ void mod_spandsp_indicate_data(switch_core_session_t *session, switch_bool_t sel
    CONFIGURATION
    ************************************************************************* */
 
+static void destroy_tones(void)
+{
+       if (spandsp_globals.tones) {
+        switch_hash_index_t *hi;
+        void *val;
+        const void *vvar;
+        tone_descriptor_t *d;
+
+        for (hi = switch_hash_first(NULL, spandsp_globals.tones); hi; hi = switch_hash_next(hi)) {
+            switch_hash_this(hi, &vvar, NULL, &val);
+
+            d = (tone_descriptor_t *) val;
+            super_tone_rx_free_descriptor(d->spandsp_tone_descriptor);
+        }
+
+               switch_core_hash_destroy(&spandsp_globals.tones);
+       }
+}
+
 switch_status_t load_configuration(switch_bool_t reload)
 {
        switch_xml_t xml = NULL, x_lists = NULL, x_list = NULL, cfg = NULL, callprogress = NULL, xdescriptor = NULL;
@@ -484,10 +503,6 @@ switch_status_t load_configuration(switch_bool_t reload)
 
        switch_mutex_lock(spandsp_globals.mutex);
 
-       if (spandsp_globals.tones) {
-               switch_core_hash_destroy(&spandsp_globals.tones);
-       }
-
        if (spandsp_globals.config_pool) {
                switch_core_destroy_memory_pool(&spandsp_globals.config_pool);
        }
@@ -819,9 +834,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spandsp_shutdown)
        mod_spandsp_dsp_shutdown();
        modem_global_shutdown();
 
-       if (spandsp_globals.tones) {
-               switch_core_hash_destroy(&spandsp_globals.tones);
-       }
+    destroy_tones();
+
 
        if (spandsp_globals.config_pool) {
                switch_core_destroy_memory_pool(&spandsp_globals.config_pool);