From 8339a13fd40b519958218660f986947f8290c98c Mon Sep 17 00:00:00 2001 From: Sangchul Lee Date: Wed, 5 Jul 2017 14:04:09 +0900 Subject: [PATCH] filter-apply: Add "autoclean_interval" module argument Now it is possible to set interval time of "autoclean" behavior. Deafult time is 10 seconds which is the same as before. [Version] 5.0.119 [Issue Type] New feature Change-Id: I30d11b4e7a735ba37a7c1983c6ab7944721641aa Signed-off-by: Sangchul Lee --- packaging/pulseaudio.spec | 2 +- src/modules/module-filter-apply.c | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/packaging/pulseaudio.spec b/packaging/pulseaudio.spec index aa9bab0..1f426bb 100644 --- a/packaging/pulseaudio.spec +++ b/packaging/pulseaudio.spec @@ -12,7 +12,7 @@ Name: pulseaudio Summary: Improved Linux sound server Version: 5.0 -Release: 118 +Release: 119 Group: Multimedia/Audio License: LGPL-2.1 URL: http://pulseaudio.org diff --git a/src/modules/module-filter-apply.c b/src/modules/module-filter-apply.c index 54651f0..8b630a8 100644 --- a/src/modules/module-filter-apply.c +++ b/src/modules/module-filter-apply.c @@ -48,15 +48,18 @@ PA_MODULE_AUTHOR("Colin Guthrie"); PA_MODULE_DESCRIPTION("Load filter sinks automatically when needed"); PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_LOAD_ONCE(true); -PA_MODULE_USAGE(_("autoclean=")); +PA_MODULE_USAGE( + _("autoclean= " + "autoclean_internal= ")); static const char* const valid_modargs[] = { "autoclean", + "autoclean_interval", NULL }; #define DEFAULT_AUTOCLEAN true -#define HOUSEKEEPING_INTERVAL (10 * PA_USEC_PER_SEC) +#define DEFAULT_AUTOCLEAN_INTERVAL 10 struct filter { char *name; @@ -84,6 +87,7 @@ struct userdata { *source_output_unlink_slot, *source_unlink_slot; bool autoclean; + uint32_t autoclean_interval; pa_time_event *housekeeping_time_event; }; @@ -376,6 +380,12 @@ static void housekeeping_time_callback(pa_mainloop_api*a, pa_time_event* e, cons pa_log_info("Housekeeping Done."); } +static pa_usec_t get_housekeeping_interval(struct userdata *u) { + pa_assert(u); + + return u->autoclean_interval * PA_USEC_PER_SEC; +} + static void trigger_housekeeping(struct userdata *u) { pa_assert(u); @@ -385,7 +395,7 @@ static void trigger_housekeeping(struct userdata *u) { if (u->housekeeping_time_event) return; - u->housekeeping_time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + HOUSEKEEPING_INTERVAL, housekeeping_time_callback, u); + u->housekeeping_time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + get_housekeeping_interval(u), housekeeping_time_callback, u); } static int do_move(pa_object *obj, pa_object *parent, bool restore, bool is_input) { @@ -815,6 +825,12 @@ int pa__init(pa_module *m) { goto fail; } + 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; + } + u->filters = pa_hashmap_new(filter_hash, filter_compare); u->sink_input_put_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_PUT], PA_HOOK_LATE, (pa_hook_cb_t) sink_input_put_cb, u); -- 2.7.4