For example, a normal stream tried to attach to filter sink(or source), which filter loaded and managed by filter-apply. But, the stream become to attach to the ***master sink(or source)*** of filter module due to restoring operation. It seems should to be attached to the filter sink(or source) properly. Signed-off-by: KimJeongYeon <jeongyeon.kim at samsung.com> --- src/modules/module-filter-apply.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/modules/module-filter-apply.c b/src/modules/module-filter-apply.c index 364d68b..f7e8734 100644 --- a/src/modules/module-filter-apply.c +++ b/src/modules/module-filter-apply.c @@ -54,6 +54,12 @@ static const char* const valid_modargs[] = { #define DEFAULT_AUTOCLEAN true #define HOUSEKEEPING_INTERVAL (10 * PA_USEC_PER_SEC) +typedef enum _process_cmd_type { + PROCESS_CMD_SINK_INPUT_SOURCE_OUTPUT_PUT, + PROCESS_CMD_SINK_INPUT_SOURCE_OUTPUT_MOVE_FINISH, + PROCESS_CMD_SINK_INPUT_SOURCE_OUTPUT_PROPLIST, +} process_cmd_type_t; + struct filter { char *name; uint32_t module_index; @@ -410,7 +416,7 @@ static bool can_unload_module(struct userdata *u, uint32_t idx) { return true; } -static pa_hook_result_t process(struct userdata *u, pa_object *o, bool is_sink_input) { +static pa_hook_result_t process(struct userdata *u, pa_object *o, process_cmd_type_t cmd, bool is_sink_input) { const char *want; bool done_something = false; pa_sink *sink = NULL; @@ -493,10 +499,12 @@ static pa_hook_result_t process(struct userdata *u, pa_object *o, bool is_sink_i /* We do not want to filter... but are we already filtered? * This can happen if an input's proplist changes */ PA_HASHMAP_FOREACH(filter, u->filters, state) { - if ((is_sink_input && sink == filter->sink) || (!is_sink_input && source == filter->source)) { - move_objects_for_filter(u, o, filter, true, is_sink_input); - done_something = true; - break; + if (cmd == PROCESS_CMD_SINK_INPUT_SOURCE_OUTPUT_PROPLIST) { + if ((is_sink_input && sink == filter->sink) || (!is_sink_input && source == filter->source)) { + move_objects_for_filter(u, o, filter, true, is_sink_input); + done_something = true; + break; + } } } } @@ -515,7 +523,7 @@ static pa_hook_result_t sink_input_put_cb(pa_core *core, pa_sink_input *i, struc pa_core_assert_ref(core); pa_sink_input_assert_ref(i); - return process(u, PA_OBJECT(i), true); + return process(u, PA_OBJECT(i), PROCESS_CMD_SINK_INPUT_SOURCE_OUTPUT_PUT, true); } static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { @@ -528,14 +536,14 @@ static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input * /* If we're managing m-d-m.auto_filtered on this, remove and re-add if we're continuing to manage it */ pa_hashmap_remove(u->mdm_ignored_inputs, i); - return process(u, PA_OBJECT(i), true); + return process(u, PA_OBJECT(i), PROCESS_CMD_SINK_INPUT_SOURCE_OUTPUT_MOVE_FINISH, true); } static pa_hook_result_t sink_input_proplist_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { pa_core_assert_ref(core); pa_sink_input_assert_ref(i); - return process(u, PA_OBJECT(i), true); + return process(u, PA_OBJECT(i), PROCESS_CMD_SINK_INPUT_SOURCE_OUTPUT_PROPLIST, true); } static pa_hook_result_t sink_input_unlink_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { @@ -592,7 +600,7 @@ static pa_hook_result_t source_output_put_cb(pa_core *core, pa_source_output *o, pa_core_assert_ref(core); pa_source_output_assert_ref(o); - return process(u, PA_OBJECT(o), false); + return process(u, PA_OBJECT(o), PROCESS_CMD_SINK_INPUT_SOURCE_OUTPUT_PUT, false); } static pa_hook_result_t source_output_move_finish_cb(pa_core *core, pa_source_output *o, struct userdata *u) { @@ -605,14 +613,14 @@ static pa_hook_result_t source_output_move_finish_cb(pa_core *core, pa_source_ou /* If we're managing m-d-m.auto_filtered on this, remove and re-add if we're continuing to manage it */ pa_hashmap_remove(u->mdm_ignored_outputs, o); - return process(u, PA_OBJECT(o), false); + return process(u, PA_OBJECT(o), PROCESS_CMD_SINK_INPUT_SOURCE_OUTPUT_MOVE_FINISH, false); } static pa_hook_result_t source_output_proplist_cb(pa_core *core, pa_source_output *o, struct userdata *u) { pa_core_assert_ref(core); pa_source_output_assert_ref(o); - return process(u, PA_OBJECT(o), false); + return process(u, PA_OBJECT(o), PROCESS_CMD_SINK_INPUT_SOURCE_OUTPUT_PROPLIST, false); } static pa_hook_result_t source_output_unlink_cb(pa_core *core, pa_source_output *o, struct userdata *u) { -- 2.7.4