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:
Tanu Kaskinen 2017-11-28 19:50:01 +02:00
parent 10010f81e8
commit 3d698d17af
27 changed files with 72 additions and 42 deletions

View file

@ -80,6 +80,14 @@ struct pa_sink_input {
pa_client *client; /* may be NULL */
pa_sink *sink; /* NULL while we are being moved */
/* This is set to true when creating the sink input if the sink was
* requested by the application that created the sink input. This is
* sometimes useful for determining whether the sink input should be
* moved by some automatic policy. If the sink input is moved away from the
* sink that the application requested, this flag is reset to false. */
bool sink_requested_by_application;
pa_sink *origin_sink; /* only set by filter sinks */
/* A sink input may be connected to multiple source outputs
@ -284,6 +292,7 @@ typedef struct pa_sink_input_new_data {
pa_client *client;
pa_sink *sink;
bool sink_requested_by_application;
pa_sink *origin_sink;
pa_resample_method_t resample_method;
@ -321,7 +330,7 @@ void pa_sink_input_new_data_set_volume(pa_sink_input_new_data *data, const pa_cv
void pa_sink_input_new_data_add_volume_factor(pa_sink_input_new_data *data, const char *key, const pa_cvolume *volume_factor);
void pa_sink_input_new_data_add_volume_factor_sink(pa_sink_input_new_data *data, const char *key, const pa_cvolume *volume_factor);
void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, bool mute);
bool pa_sink_input_new_data_set_sink(pa_sink_input_new_data *data, pa_sink *s, bool save);
bool pa_sink_input_new_data_set_sink(pa_sink_input_new_data *data, pa_sink *s, bool save, bool requested_by_application);
bool pa_sink_input_new_data_set_formats(pa_sink_input_new_data *data, pa_idxset *formats);
void pa_sink_input_new_data_done(pa_sink_input_new_data *data);