mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
suspend-on-idle: use earlier (safer) hooks for stream unlink notifications
In the "unlink post" hook it's not guaranteed that the stream's old device exists any more, so let's use the "unlink" hook that is safer. For example, module-bluetooth-policy does a card profile change in the source-output "unlink post" hook, which invalidates the source-output's source pointer. When the "unlink" hook is fired, the stream is still linked to its device, which affects the return values of the check_suspend() functions. The unlinked streams should be ignored by the check_suspend() functions, so I had to add extra parameters to those functions.
This commit is contained in:
parent
2250dbfd69
commit
c3393d27a5
5 changed files with 39 additions and 22 deletions
|
|
@ -2381,7 +2381,7 @@ unsigned pa_sink_used_by(pa_sink *s) {
|
|||
}
|
||||
|
||||
/* Called from main thread */
|
||||
unsigned pa_sink_check_suspend(pa_sink *s) {
|
||||
unsigned pa_sink_check_suspend(pa_sink *s, pa_sink_input *ignore_input, pa_source_output *ignore_output) {
|
||||
unsigned ret;
|
||||
pa_sink_input *i;
|
||||
uint32_t idx;
|
||||
|
|
@ -2397,6 +2397,9 @@ unsigned pa_sink_check_suspend(pa_sink *s) {
|
|||
PA_IDXSET_FOREACH(i, s->inputs, idx) {
|
||||
pa_sink_input_state_t st;
|
||||
|
||||
if (i == ignore_input)
|
||||
continue;
|
||||
|
||||
st = pa_sink_input_get_state(i);
|
||||
|
||||
/* We do not assert here. It is perfectly valid for a sink input to
|
||||
|
|
@ -2417,7 +2420,7 @@ unsigned pa_sink_check_suspend(pa_sink *s) {
|
|||
}
|
||||
|
||||
if (s->monitor_source)
|
||||
ret += pa_source_check_suspend(s->monitor_source);
|
||||
ret += pa_source_check_suspend(s->monitor_source, ignore_output);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue