PA_MODULE_DESCRIPTION("Load filter sinks automatically when needed");
PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(true);
+#ifdef __TIZEN__
+PA_MODULE_USAGE(
+ _("autoclean=<automatically unload unused filters?>"
+ "autoclean_interval=<interval time(sec) of unloading filters. Default: 10>"));
+#else
PA_MODULE_USAGE(_("autoclean=<automatically unload unused filters?>"));
+#endif
static const char* const valid_modargs[] = {
"autoclean",
+#ifdef __TIZEN__
+ "autoclean_interval",
+#endif
NULL
};
#define DEFAULT_AUTOCLEAN true
+#ifdef __TIZEN__
+#define DEFAULT_AUTOCLEAN_INTERVAL 10
+#else
#define HOUSEKEEPING_INTERVAL (10 * PA_USEC_PER_SEC)
+#endif
struct filter {
char *name;
* pa_sink_input/pa_source_output. */
pa_hashmap *mdm_ignored_inputs, *mdm_ignored_outputs;
bool autoclean;
+#ifdef __TIZEN__
+ uint32_t autoclean_interval;
+#endif
pa_time_event *housekeeping_time_event;
};
pa_log_info("Housekeeping Done.");
}
+#ifdef __TIZEN__
+static pa_usec_t get_housekeeping_interval(struct userdata *u) {
+ pa_assert(u);
+
+ return u->autoclean_interval * PA_USEC_PER_SEC;
+}
+#endif
static void trigger_housekeeping(struct userdata *u) {
pa_assert(u);
if (u->housekeeping_time_event)
return;
+#ifdef __TIZEN__
+ u->housekeeping_time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + get_housekeeping_interval(u), housekeeping_time_callback, u);
+#else
u->housekeeping_time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + HOUSEKEEPING_INTERVAL, housekeeping_time_callback, u);
+#endif
}
static int do_move(struct userdata *u, pa_object *obj, pa_object *parent, bool is_input) {
pa_log("Failed to parse autoclean value");
goto fail;
}
+#ifdef __TIZEN__
+ u->autoclean_interval = DEFAULT_AUTOCLEAN_INTERVAL;
+ if (pa_modargs_get_value_u32(ma, "autoclean_interval", &u->autoclean_interval) < 0) {
+ pa_log("Failed to parse autoclean_interval value");
+ goto fail;
+ }
+#endif
u->filters = pa_hashmap_new(filter_hash, filter_compare);
u->mdm_ignored_inputs = pa_hashmap_new_full(NULL, NULL, (pa_free_cb_t) unset_mdm_ignore_input, NULL);