Build fix
This commit is contained in:
parent
130edc502b
commit
a5477e617b
1 changed files with 28 additions and 3 deletions
|
|
@ -98,6 +98,8 @@ struct userdata {
|
|||
bool voice_virtual_stream;
|
||||
char *voice_property_key;
|
||||
char *voice_property_value;
|
||||
pa_sink_input *voice_virtual_sink_input;
|
||||
pa_sink_input *voice_control_sink_input;
|
||||
pa_hook_slot *sink_input_volume_changed_hook_slot;
|
||||
|
||||
pa_hook_slot *sink_input_put_hook_slot;
|
||||
|
|
@ -712,7 +714,12 @@ static pa_hook_result_t sink_input_volume_changed_hook_cb(pa_core *c, pa_sink_in
|
|||
if (!u->use_voice_volume)
|
||||
return PA_HOOK_OK;
|
||||
|
||||
if (sink_input_is_voice_control(u, sink_input))
|
||||
if (!u->voice_control_sink_input && sink_input_is_voice_control(u, sink_input))
|
||||
u->voice_control_sink_input = sink_input;
|
||||
|
||||
if (u->voice_control_sink_input != sink_input)
|
||||
return PA_HOOK_OK;
|
||||
|
||||
set_voice_volume(u, sink_input);
|
||||
|
||||
return PA_HOOK_OK;
|
||||
|
|
@ -813,21 +820,35 @@ void pa_droid_sink_set_voice_control(pa_sink* sink, bool enable) {
|
|||
|
||||
pa_assert(!u->sink_input_volume_changed_hook_slot);
|
||||
|
||||
if (u->voice_virtual_stream)
|
||||
create_voice_virtual_stream(u);
|
||||
|
||||
if (u->use_hw_volume)
|
||||
pa_sink_set_set_volume_callback(u->sink, NULL);
|
||||
|
||||
u->sink_input_volume_changed_hook_slot = pa_hook_connect(&u->core->hooks[PA_CORE_HOOK_SINK_INPUT_VOLUME_CHANGED],
|
||||
PA_HOOK_LATE+10, (pa_hook_cb_t) sink_input_volume_changed_hook_cb, u);
|
||||
|
||||
if ((i = find_volume_control_sink_input(u))) {
|
||||
u->voice_control_sink_input = i;
|
||||
set_voice_volume(u, i);
|
||||
}
|
||||
|
||||
} else {
|
||||
pa_assert(u->sink_input_volume_changed_hook_slot);
|
||||
|
||||
if (u->voice_virtual_stream)
|
||||
destroy_voice_virtual_stream(u);
|
||||
|
||||
u->voice_control_sink_input = NULL;
|
||||
pa_hook_slot_free(u->sink_input_volume_changed_hook_slot);
|
||||
u->sink_input_volume_changed_hook_slot = NULL;
|
||||
|
||||
pa_log_debug("Using %s volume control with %s",
|
||||
u->use_hw_volume ? "hardware" : "software", u->sink->name);
|
||||
|
||||
if (u->use_hw_volume)
|
||||
pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -838,7 +859,8 @@ static pa_hook_result_t sink_input_put_hook_cb(pa_core *c, pa_sink_input *sink_i
|
|||
const char *media_str;
|
||||
audio_devices_t devices;
|
||||
|
||||
if (u->use_voice_volume && sink_input_is_voice_control(u, sink_input)) {
|
||||
if (u->use_voice_volume && !u->voice_control_sink_input && sink_input_is_voice_control(u, sink_input)) {
|
||||
u->voice_control_sink_input = sink_input;
|
||||
set_voice_volume(u, sink_input);
|
||||
}
|
||||
|
||||
|
|
@ -873,6 +895,9 @@ static pa_hook_result_t sink_input_unlink_hook_cb(pa_core *c, pa_sink_input *sin
|
|||
const char *media_str;
|
||||
audio_devices_t devices;
|
||||
|
||||
if (u->voice_control_sink_input == sink_input)
|
||||
u->voice_control_sink_input = NULL;
|
||||
|
||||
/* Dynamic routing changes do not apply during active voice call. */
|
||||
if (u->use_voice_volume)
|
||||
return PA_HOOK_OK;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue