#define STREAM_FOCUS_STATE_RELEASED "0"
#define STREAM_FOCUS_STATE_ACQUIRED "1"
+#define MUTE_KEY "mute_by_device_disconnection"
+
typedef enum _process_stream_result {
PROCESS_STREAM_RESULT_OK,
PROCESS_STREAM_RESULT_STOP,
} else {
role = pa_proplist_gets(GET_STREAM_PROPLIST(stream, type), PA_PROP_MEDIA_ROLE);
route_type_str = pa_proplist_gets(GET_STREAM_PROPLIST(stream, type), PA_PROP_MEDIA_ROLE_ROUTE_TYPE);
+ /* FIXME: if PA_COMMUNICATOR_HOOK_EVENT_FULLY_HANDLED is not called for some reason,
+ * volume factor should be removed forcedly. */
+ if (type == STREAM_SINK_INPUT) {
+ pa_sink_input *i = (pa_sink_input *)stream;
+ if ((pa_hashmap_get(i->volume_factor_items, MUTE_KEY)))
+ pa_sink_input_remove_volume_factor(i, MUTE_KEY);
+ }
}
/* skip roles */
uint32_t s_idx = 0;
pa_cvolume vol;
pa_sink_input *i;
- const char *mute_key = "mute_by_device_disconnection";
pa_assert(m);
muted_streams = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
PA_IDXSET_FOREACH(i, (pa_idxset *)user_data, s_idx) {
pa_log_debug("found a stream(%p, %u) that should be muted.", i, i->index);
- pa_sink_input_add_volume_factor(i, mute_key, &vol);
+ /* remove MUTE_KEY before adding to avoid abort-case in pa_sink_input_add_volume_factor */
+ pa_hashmap_remove(i->volume_factor_items, MUTE_KEY);
+ pa_sink_input_add_volume_factor(i, MUTE_KEY, &vol);
pa_idxset_put(muted_streams, i, NULL);
}
pa_hashmap_put(m->muted_streams, (void*)event_id, muted_streams);
}
PA_IDXSET_FOREACH(i, muted_streams, s_idx) {
pa_idxset_remove_by_data(muted_streams, i, NULL);
- pa_sink_input_remove_volume_factor(i, mute_key);
+ pa_sink_input_remove_volume_factor(i, MUTE_KEY);
pa_log_debug("found a stream(%p, %u) that should be un-muted.", i, i->index);
}
pa_hashmap_remove(m->muted_streams, (void*)event_id);