]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_ladspa] Add activate/deactivate support. 1900/head
authorJordan Yelloz <jordan.yelloz@collabora.com>
Fri, 16 Dec 2022 19:35:27 +0000 (12:35 -0700)
committerJordan Yelloz <jordan.yelloz@collabora.com>
Wed, 18 Jan 2023 19:02:16 +0000 (12:02 -0700)
Without these -- especially activate() -- stateful plugins will not be
set up correctly.

For example, the low-pass filter "lpf" in the CMT library may produce
a pop when starting since its state is not zeroed out.

src/mod/applications/mod_ladspa/mod_ladspa.c

index 2bccfffb9c43cefe6a0fcd6d7754328a00d3a316..6e04e414a9123bb73891ea1524157b6b97d043cf 100644 (file)
@@ -370,6 +370,11 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
                                        }
                                }
                        }
+
+                       if (pvt->ldesc->activate) {
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "ACTIVATE\n");
+                               pvt->ldesc->activate(pvt->handle);
+                       }
                }
 
                break;
@@ -382,6 +387,10 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
                        }
 
                        if (pvt->handle && pvt->ldesc) {
+                               if (pvt->ldesc->deactivate) {
+                                       pvt->ldesc->deactivate(pvt->handle);
+                               }
+
                                pvt->ldesc->cleanup(pvt->handle);
                        }