mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -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
|
|
@ -123,7 +123,8 @@ void pa_source_output_new_data_set_muted(pa_source_output_new_data *data, bool m
|
|||
data->muted = mute;
|
||||
}
|
||||
|
||||
bool pa_source_output_new_data_set_source(pa_source_output_new_data *data, pa_source *s, bool save) {
|
||||
bool pa_source_output_new_data_set_source(pa_source_output_new_data *data, pa_source *s, bool save,
|
||||
bool requested_by_application) {
|
||||
bool ret = true;
|
||||
pa_idxset *formats = NULL;
|
||||
|
||||
|
|
@ -134,6 +135,7 @@ bool pa_source_output_new_data_set_source(pa_source_output_new_data *data, pa_so
|
|||
/* We're not working with the extended API */
|
||||
data->source = s;
|
||||
data->save_source = save;
|
||||
data->source_requested_by_application = requested_by_application;
|
||||
} else {
|
||||
/* Extended API: let's see if this source supports the formats the client would like */
|
||||
formats = pa_source_check_formats(s, data->req_formats);
|
||||
|
|
@ -142,6 +144,7 @@ bool pa_source_output_new_data_set_source(pa_source_output_new_data *data, pa_so
|
|||
/* Source supports at least one of the requested formats */
|
||||
data->source = s;
|
||||
data->save_source = save;
|
||||
data->source_requested_by_application = requested_by_application;
|
||||
if (data->nego_formats)
|
||||
pa_idxset_free(data->nego_formats, (pa_free_cb_t) pa_format_info_free);
|
||||
data->nego_formats = formats;
|
||||
|
|
@ -167,7 +170,8 @@ bool pa_source_output_new_data_set_formats(pa_source_output_new_data *data, pa_i
|
|||
|
||||
if (data->source) {
|
||||
/* Trigger format negotiation */
|
||||
return pa_source_output_new_data_set_source(data, data->source, data->save_source);
|
||||
return pa_source_output_new_data_set_source(data, data->source, data->save_source,
|
||||
data->source_requested_by_application);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -271,7 +275,7 @@ int pa_source_output_new(
|
|||
pa_return_val_if_fail(source, -PA_ERR_NOENTITY);
|
||||
}
|
||||
|
||||
pa_source_output_new_data_set_source(data, source, false);
|
||||
pa_source_output_new_data_set_source(data, source, false, false);
|
||||
}
|
||||
|
||||
/* If something didn't pick a format for us, pick the top-most format since
|
||||
|
|
@ -424,6 +428,7 @@ int pa_source_output_new(
|
|||
o->driver = pa_xstrdup(pa_path_get_filename(data->driver));
|
||||
o->module = data->module;
|
||||
o->source = data->source;
|
||||
o->source_requested_by_application = data->source_requested_by_application;
|
||||
o->destination_source = data->destination_source;
|
||||
o->client = data->client;
|
||||
|
||||
|
|
@ -1365,6 +1370,7 @@ int pa_source_output_start_move(pa_source_output *o) {
|
|||
pa_cvolume_remap(&o->volume_factor_source, &o->source->channel_map, &o->channel_map);
|
||||
|
||||
o->source = NULL;
|
||||
o->source_requested_by_application = false;
|
||||
|
||||
pa_source_output_unref(o);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue