sink, source: Call sink input suspend callback also on suspend cause change

Currently, virtual sinks and sources are not suspended when the master sink
or source is suspended. To implement this, the slave must be able to track
the suspend cause of the master.

With this patch, the sink input suspend callback will not only be called
when the sink or source is changing state, but also when the suspend cause
changes. Similar to the set_state_in_*_thread_cb() functions, the suspend
callback receives a state and a suspend cause as additional arguments.
Because the new state and suspend cause of the sink or source have already
been set, the old values are passed to the callback.
This commit is contained in:
Georg Chini 2019-02-12 20:21:01 +01:00 committed by Arun Raghavan
parent f7b3537bbf
commit acb02d9e88
6 changed files with 54 additions and 14 deletions

View file

@ -150,8 +150,9 @@ struct pa_source_output {
void (*detach) (pa_source_output *o); /* may be NULL */
/* If non-NULL called whenever the source this output is attached
* to suspends or resumes. Called from main context */
void (*suspend) (pa_source_output *o, bool b); /* may be NULL */
* to suspends or resumes or if the suspend cause changes.
* Called from main context */
void (*suspend) (pa_source_output *o, pa_source_state_t old_state, pa_suspend_cause_t old_suspend_cause); /* may be NULL */
/* If non-NULL called whenever the source this output is attached
* to suspends or resumes. Called from IO context */