Add -fno-gnu-unique option 31/295231/3 accepted/tizen/unified/20230710.013112
authorJaechul Lee <jcsing.lee@samsung.com>
Tue, 4 Jul 2023 05:06:06 +0000 (14:06 +0900)
committerJaechul Lee <jcsing.lee@samsung.com>
Wed, 5 Jul 2023 00:52:02 +0000 (09:52 +0900)
libaudio-effect has a dependecy on webrtc-audio-processsing that has
unique symbols. Therefore, the destructor in the webrtc pluing is
not called.

[Version] 0.0.4
[Issue Type] Bug

Change-Id: Ib7b89b89dfa854357d6fcd4aa2c88d04904b2c04
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
meson.build
packaging/libaudio-effect.spec
src/audio_effect_interface.c

index 1591035aae25b6b030941cc6a071f076068ef85e..cd3513de309a2de2f5e9c4ee2961c4d1bbb4dcca 100644 (file)
@@ -2,18 +2,20 @@ project('libaudio-effect', 'c', 'cpp')
 
 version = get_option('version')
 
+config_data = configuration_data()
+
+audio_effect_include_dir = include_directories('./include')
+audio_effect_plugins_install_dir = join_paths(get_option('libdir'), 'audio-effect-plugins/')
+
 platform_dep = []
+config_data.set_quoted('DL_PLUGIN_PATH', '')
 if get_option('tizen').enabled()
   add_global_arguments('-DUSE_DLOG', language : 'c')
   add_global_arguments('-DUSE_DLOG', language : 'cpp')
   platform_dep += [ dependency('dlog') ]
+  config_data.set_quoted('DL_PLUGIN_PATH', join_paths('/', audio_effect_plugins_install_dir))
 endif
 
-audio_effect_include_dir = include_directories('./include')
-audio_effect_plugins_install_dir = get_option('libdir')/'audio-effect-plugins/'
-
-config_data = configuration_data()
-config_data.set_quoted('DL_PLUGIN_PATH', audio_effect_plugins_install_dir)
 configure_file(output : 'config.h', configuration : config_data)
 
 # It can't find dl library that's why i replaced with cc
@@ -79,6 +81,7 @@ shared_library('audio-effect-aec-webrtc',
   link_with: [audio_effect_shared],
   install: true,
   install_dir: audio_effect_plugins_install_dir,
+  cpp_args: '-fno-gnu-unique',
 )
 endif
 
index 06f2c61392a66e438a09f19a3245dfbc953262d6..fbe319c658755a5299b4fc565b4c2584c7ea5a80 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libaudio-effect
 Summary:    audio effect library
-Version:    0.0.3
+Version:    0.0.4
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index be399d513c8009205c179c66316e2fa3cd604ddf..21e1e285b17e586dfc86c5f22209109337576975 100644 (file)
@@ -45,6 +45,12 @@ static struct plugin_list {
        audio_effect_plugin_info_s *plugin_info;
 } plugin_list[AUDIO_EFFECT_METHOD_MAX];
 
+static const char *get_plugin_name(const char *name)
+{
+       assert(name);
+       return name + strlen(DL_PLUGIN_PATH);
+}
+
 audio_effect_interface_s *audio_effect_interface_new(audio_effect_method_e method,
                                                        int rate, int channels,
                                                        audio_effect_format_e format,
@@ -55,13 +61,15 @@ audio_effect_interface_s *audio_effect_interface_new(audio_effect_method_e metho
 
        assert(method < AUDIO_EFFECT_METHOD_MAX);
 
+       LOG_INFO("Trying to create the plugin %s. plugin_info(%p), refcnt(%d)",
+                       get_plugin_name(effect_path_list[method]), plugin_list[method].plugin_info, plugin_list[method].refcnt);
+
        if (!plugin_list[method].plugin_info && plugin_list[method].refcnt == 0) {
                handle = dlopen(effect_path_list[method], RTLD_LAZY);
                if (!handle) {
-                       LOG_INFO("Failed to open handle. path(%s)", effect_path_list[method]);
+                       LOG_INFO("Failed to open handle. path(%s) dlerror(%s)", get_plugin_name(effect_path_list[method]), dlerror());
                        return NULL;
                }
-               LOG_INFO("loaded module %s", effect_path_list[method]);
        }
 
        plugin_info = plugin_list[method].plugin_info;
@@ -96,12 +104,17 @@ audio_effect_interface_s *audio_effect_interface_new(audio_effect_method_e metho
        /* TODO handle lock */
        plugin_list[method].refcnt += 1;
 
+       LOG_INFO("plugin(%s) was created successfully. handle(%p) ref(%d)",
+                       get_plugin_name(effect_path_list[method]), plugin_list[method].handle, plugin_list[method].refcnt);
+
        return &plugin_info->interface;
 
 fail:
        if (handle)
                dlclose(handle);
 
+       plugin_list[method].plugin_info = NULL;
+
        return NULL;
 }
 
@@ -112,8 +125,12 @@ void audio_effect_interface_free(audio_effect_interface_s *intf)
        plugin_list[intf->method].refcnt -= 1;
 
        if (plugin_list[intf->method].refcnt == 0) {
-               LOG_INFO("unloaded module %s", effect_path_list[intf->method]);
-               dlclose(plugin_list[intf->method].handle);
+               int ret;
+               LOG_INFO("unloading the plugin. (%s). handle(%p)",
+                               get_plugin_name(effect_path_list[intf->method]), plugin_list[intf->method].handle);
+
+               if ((ret = dlclose(plugin_list[intf->method].handle)) != 0)
+                       LOG_ERROR("Failed to close plugin. ret(%d), dlerror(%s)", ret, dlerror());
        }
 }
 
@@ -127,6 +144,8 @@ void audio_effect_register_module(audio_effect_plugin_info_s *plugin_info)
        method = plugin_info->interface.method;
 
        plugin_list[method].plugin_info = plugin_info;
+
+       LOG_INFO("loaded the plugin. effect_path(%s)", effect_path_list[method]);
 }
 
 void audio_effect_unregister_module(audio_effect_plugin_info_s *plugin_info)
@@ -140,4 +159,6 @@ void audio_effect_unregister_module(audio_effect_plugin_info_s *plugin_info)
        plugin_list[method].handle = NULL;
        plugin_list[method].refcnt = 0;
        plugin_list[method].plugin_info = NULL;
+
+       LOG_INFO("unloaded the plugin. effect_path(%s)", effect_path_list[method]);
 }