mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
sink-input, source-output: add sink/source_requested_by_application flag
When a stream is created, and the stream creator specifies which device should be used, that can affect automatic routing policies. Specifically, module-device-manager shouldn't apply its priority list routing when a stream has been routed by the application that created the stream. A stream that was initially routed by the application may be moved for some valid reason (e.g. user requesting a move, or the original device disappearing). When the stream is moved away from its initial device, the "device requested by application" flag isn't relevant any more, so it's set to false and never reset to true again. The change in module-device-manager's routing logic will be done in the following patch.
This commit is contained in:
parent
10010f81e8
commit
3d698d17af
27 changed files with 72 additions and 42 deletions
|
|
@ -1943,7 +1943,7 @@ int pa__init(pa_module*m) {
|
|||
pa_source_output_new_data_init(&source_output_data);
|
||||
source_output_data.driver = __FILE__;
|
||||
source_output_data.module = m;
|
||||
pa_source_output_new_data_set_source(&source_output_data, source_master, false);
|
||||
pa_source_output_new_data_set_source(&source_output_data, source_master, false, true);
|
||||
source_output_data.destination_source = u->source;
|
||||
|
||||
pa_proplist_sets(source_output_data.proplist, PA_PROP_MEDIA_NAME, "Echo-Cancel Source Stream");
|
||||
|
|
@ -1982,7 +1982,7 @@ int pa__init(pa_module*m) {
|
|||
pa_sink_input_new_data_init(&sink_input_data);
|
||||
sink_input_data.driver = __FILE__;
|
||||
sink_input_data.module = m;
|
||||
pa_sink_input_new_data_set_sink(&sink_input_data, sink_master, false);
|
||||
pa_sink_input_new_data_set_sink(&sink_input_data, sink_master, false, true);
|
||||
sink_input_data.origin_sink = u->sink;
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Echo-Cancel Sink Stream");
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ static pa_hook_result_t sink_input_new_cb(pa_core *core, pa_sink_input_new_data
|
|||
if (!new_data->sink) {
|
||||
pa_sink *sink = pa_namereg_get(core, NULL, PA_NAMEREG_SINK);
|
||||
pa_return_val_if_fail(sink, -PA_ERR_NOENTITY);
|
||||
pa_sink_input_new_data_set_sink(new_data, sink, false);
|
||||
pa_sink_input_new_data_set_sink(new_data, sink, false, false);
|
||||
}
|
||||
|
||||
if (!new_data->format && new_data->nego_formats && !pa_idxset_isempty(new_data->nego_formats))
|
||||
|
|
@ -193,7 +193,7 @@ static pa_hook_result_t sink_input_new_cb(pa_core *core, pa_sink_input_new_data
|
|||
|
||||
if (null_sink) {
|
||||
pa_log_info("Already playing a passthrough stream; re-routing new stream to the null sink");
|
||||
pa_sink_input_new_data_set_sink(new_data, null_sink, false);
|
||||
pa_sink_input_new_data_set_sink(new_data, null_sink, false, false);
|
||||
}
|
||||
|
||||
return PA_HOOK_OK;
|
||||
|
|
|
|||
|
|
@ -974,7 +974,7 @@ static int output_create_sink_input(struct output *o) {
|
|||
u = o->userdata;
|
||||
|
||||
pa_sink_input_new_data_init(&data);
|
||||
pa_sink_input_new_data_set_sink(&data, o->sink, false);
|
||||
pa_sink_input_new_data_set_sink(&data, o->sink, false, true);
|
||||
data.driver = __FILE__;
|
||||
pa_proplist_setf(data.proplist, PA_PROP_MEDIA_NAME, "Simultaneous output on %s", pa_strnull(pa_proplist_gets(o->sink->proplist, PA_PROP_DEVICE_DESCRIPTION)));
|
||||
pa_proplist_sets(data.proplist, PA_PROP_MEDIA_ROLE, "filter");
|
||||
|
|
|
|||
|
|
@ -996,7 +996,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
|
|||
pa_sink *sink;
|
||||
|
||||
if ((sink = pa_idxset_get_by_index(u->core->sinks, device_index))) {
|
||||
if (!pa_sink_input_new_data_set_sink(new_data, sink, false))
|
||||
if (!pa_sink_input_new_data_set_sink(new_data, sink, false, false))
|
||||
pa_log_debug("Not restoring device for stream because no supported format was found");
|
||||
}
|
||||
}
|
||||
|
|
@ -1036,7 +1036,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
|
|||
pa_source *source;
|
||||
|
||||
if ((source = pa_idxset_get_by_index(u->core->sources, device_index)))
|
||||
if (!pa_source_output_new_data_set_source(new_data, source, false))
|
||||
if (!pa_source_output_new_data_set_source(new_data, source, false, false))
|
||||
pa_log_debug("Not restoring device for stream because no supported format was found");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1254,7 +1254,7 @@ int pa__init(pa_module*m) {
|
|||
pa_sink_input_new_data_init(&sink_input_data);
|
||||
sink_input_data.driver = __FILE__;
|
||||
sink_input_data.module = m;
|
||||
pa_sink_input_new_data_set_sink(&sink_input_data, master, false);
|
||||
pa_sink_input_new_data_set_sink(&sink_input_data, master, false, true);
|
||||
sink_input_data.origin_sink = u->sink;
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Equalized Stream");
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
|
|||
|
||||
/* Prefer the default sink over any other sink, just in case... */
|
||||
if (c->default_sink)
|
||||
if (role_match(c->default_sink->proplist, role) && pa_sink_input_new_data_set_sink(new_data, c->default_sink, false))
|
||||
if (role_match(c->default_sink->proplist, role) && pa_sink_input_new_data_set_sink(new_data, c->default_sink, false, false))
|
||||
return PA_HOOK_OK;
|
||||
|
||||
/* @todo: favour the highest priority device, not the first one we find? */
|
||||
|
|
@ -104,7 +104,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
|
|||
if (!PA_SINK_IS_LINKED(pa_sink_get_state(s)))
|
||||
continue;
|
||||
|
||||
if (role_match(s->proplist, role) && pa_sink_input_new_data_set_sink(new_data, s, false))
|
||||
if (role_match(s->proplist, role) && pa_sink_input_new_data_set_sink(new_data, s, false, false))
|
||||
return PA_HOOK_OK;
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
|
|||
/* Prefer the default source over any other source, just in case... */
|
||||
if (c->default_source)
|
||||
if (role_match(c->default_source->proplist, role)) {
|
||||
pa_source_output_new_data_set_source(new_data, c->default_source, false);
|
||||
pa_source_output_new_data_set_source(new_data, c->default_source, false, false);
|
||||
return PA_HOOK_OK;
|
||||
}
|
||||
|
||||
|
|
@ -154,7 +154,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
|
|||
|
||||
/* @todo: favour the highest priority device, not the first one we find? */
|
||||
if (role_match(s->proplist, role)) {
|
||||
pa_source_output_new_data_set_source(new_data, s, false);
|
||||
pa_source_output_new_data_set_source(new_data, s, false, false);
|
||||
return PA_HOOK_OK;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1308,7 +1308,7 @@ int pa__init(pa_module*m) {
|
|||
pa_sink_input_new_data_init(&sink_input_data);
|
||||
sink_input_data.driver = __FILE__;
|
||||
sink_input_data.module = m;
|
||||
pa_sink_input_new_data_set_sink(&sink_input_data, master, false);
|
||||
pa_sink_input_new_data_set_sink(&sink_input_data, master, false, true);
|
||||
sink_input_data.origin_sink = u->sink;
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "LADSPA Stream");
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
|
||||
|
|
|
|||
|
|
@ -1370,7 +1370,7 @@ int pa__init(pa_module *m) {
|
|||
sink_input_data.module = m;
|
||||
|
||||
if (sink)
|
||||
pa_sink_input_new_data_set_sink(&sink_input_data, sink, false);
|
||||
pa_sink_input_new_data_set_sink(&sink_input_data, sink, false, true);
|
||||
|
||||
if (pa_modargs_get_proplist(ma, "sink_input_properties", sink_input_data.proplist, PA_UPDATE_REPLACE) < 0) {
|
||||
pa_log("Failed to parse the sink_input_properties value.");
|
||||
|
|
@ -1437,7 +1437,7 @@ int pa__init(pa_module *m) {
|
|||
source_output_data.driver = __FILE__;
|
||||
source_output_data.module = m;
|
||||
if (source)
|
||||
pa_source_output_new_data_set_source(&source_output_data, source, false);
|
||||
pa_source_output_new_data_set_source(&source_output_data, source, false, true);
|
||||
|
||||
if (pa_modargs_get_proplist(ma, "source_output_properties", source_output_data.proplist, PA_UPDATE_REPLACE) < 0) {
|
||||
pa_log("Failed to parse the source_output_properties value.");
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ int pa__init(pa_module*m) {
|
|||
pa_sink_input_new_data_init(&sink_input_data);
|
||||
sink_input_data.driver = __FILE__;
|
||||
sink_input_data.module = m;
|
||||
pa_sink_input_new_data_set_sink(&sink_input_data, master, false);
|
||||
pa_sink_input_new_data_set_sink(&sink_input_data, master, false, true);
|
||||
sink_input_data.origin_sink = u->sink;
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Remapped Stream");
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ int pa__init(pa_module*m) {
|
|||
pa_source_output_new_data_init(&source_output_data);
|
||||
source_output_data.driver = __FILE__;
|
||||
source_output_data.module = m;
|
||||
pa_source_output_new_data_set_source(&source_output_data, master, false);
|
||||
pa_source_output_new_data_set_source(&source_output_data, master, false, true);
|
||||
source_output_data.destination_source = u->source;
|
||||
|
||||
pa_proplist_sets(source_output_data.proplist, PA_PROP_MEDIA_NAME, "Remapped Stream");
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ int pa__init(pa_module*m) {
|
|||
pa_sink_input_new_data_init(&data);
|
||||
data.driver = __FILE__;
|
||||
data.module = m;
|
||||
pa_sink_input_new_data_set_sink(&data, sink, false);
|
||||
pa_sink_input_new_data_set_sink(&data, sink, false, true);
|
||||
pa_proplist_setf(data.proplist, PA_PROP_MEDIA_NAME, "%u Hz Sine", frequency);
|
||||
pa_proplist_sets(data.proplist, PA_PROP_MEDIA_ROLE, "abstract");
|
||||
pa_proplist_setf(data.proplist, "sine.hz", "%u", frequency);
|
||||
|
|
|
|||
|
|
@ -1451,7 +1451,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
|
|||
same time, in which case we want to make sure we don't
|
||||
interfere with that */
|
||||
if (s && PA_SINK_IS_LINKED(pa_sink_get_state(s)))
|
||||
if (pa_sink_input_new_data_set_sink(new_data, s, true))
|
||||
if (pa_sink_input_new_data_set_sink(new_data, s, true, false))
|
||||
pa_log_info("Restoring device for stream %s.", name);
|
||||
|
||||
entry_free(e);
|
||||
|
|
@ -1555,7 +1555,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
|
|||
interfere with that */
|
||||
if (s && PA_SOURCE_IS_LINKED(pa_source_get_state(s))) {
|
||||
pa_log_info("Restoring device for stream %s.", name);
|
||||
pa_source_output_new_data_set_source(new_data, s, true);
|
||||
pa_source_output_new_data_set_source(new_data, s, true, false);
|
||||
}
|
||||
|
||||
entry_free(e);
|
||||
|
|
|
|||
|
|
@ -576,7 +576,7 @@ int pa__init(pa_module*m) {
|
|||
pa_sink_input_new_data_init(&sink_input_data);
|
||||
sink_input_data.driver = __FILE__;
|
||||
sink_input_data.module = m;
|
||||
pa_sink_input_new_data_set_sink(&sink_input_data, master, false);
|
||||
pa_sink_input_new_data_set_sink(&sink_input_data, master, false, true);
|
||||
sink_input_data.origin_sink = u->sink;
|
||||
pa_proplist_setf(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Virtual Sink Stream from %s", pa_proplist_gets(u->sink->proplist, PA_PROP_DEVICE_DESCRIPTION));
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
|
||||
|
|
|
|||
|
|
@ -599,7 +599,7 @@ int pa__init(pa_module*m) {
|
|||
pa_source_output_new_data_init(&source_output_data);
|
||||
source_output_data.driver = __FILE__;
|
||||
source_output_data.module = m;
|
||||
pa_source_output_new_data_set_source(&source_output_data, master, false);
|
||||
pa_source_output_new_data_set_source(&source_output_data, master, false, true);
|
||||
source_output_data.destination_source = u->source;
|
||||
|
||||
pa_proplist_setf(source_output_data.proplist, PA_PROP_MEDIA_NAME, "Virtual Source Stream of %s", pa_proplist_gets(u->source->proplist, PA_PROP_DEVICE_DESCRIPTION));
|
||||
|
|
|
|||
|
|
@ -750,7 +750,7 @@ int pa__init(pa_module*m) {
|
|||
pa_sink_input_new_data_init(&sink_input_data);
|
||||
sink_input_data.driver = __FILE__;
|
||||
sink_input_data.module = m;
|
||||
pa_sink_input_new_data_set_sink(&sink_input_data, master, false);
|
||||
pa_sink_input_new_data_set_sink(&sink_input_data, master, false, true);
|
||||
sink_input_data.origin_sink = u->sink;
|
||||
pa_proplist_setf(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Virtual Surround Sink Stream from %s", pa_proplist_gets(u->sink->proplist, PA_PROP_DEVICE_DESCRIPTION));
|
||||
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
|
|||
goto fail;
|
||||
|
||||
pa_sink_input_new_data_init(&data);
|
||||
pa_sink_input_new_data_set_sink(&data, sink, false);
|
||||
pa_sink_input_new_data_set_sink(&data, sink, false, true);
|
||||
data.driver = __FILE__;
|
||||
pa_proplist_sets(data.proplist, PA_PROP_MEDIA_ROLE, "stream");
|
||||
pa_proplist_setf(data.proplist, PA_PROP_MEDIA_NAME,
|
||||
|
|
|
|||
|
|
@ -430,7 +430,7 @@ int pa__init(pa_module*m) {
|
|||
pa_proplist_setf(data.proplist, "rtp.ttl", "%lu", (unsigned long) ttl);
|
||||
data.driver = __FILE__;
|
||||
data.module = m;
|
||||
pa_source_output_new_data_set_source(&data, s, false);
|
||||
pa_source_output_new_data_set_source(&data, s, false, true);
|
||||
pa_source_output_new_data_set_sample_spec(&data, &ss);
|
||||
pa_source_output_new_data_set_channel_map(&data, &cm);
|
||||
data.flags |= get_dont_inhibit_auto_suspend_flag(s, inhibit_auto_suspend);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue