module-rescue-streams chooses the target sink badly
Submitted by Tanu Kaskinen
Assigned to pul..@..op.org
module-rescue-streams uses different logic for selecting the target sink than what the core uses for selecting the new default sink when the old default sink disappears. This causes unexpected behaviour in the following scenario:
- there are three sinks: A, B and C
- A is the default sink
- there's a stream playing to A
- A disappears, module-rescue-stream moves the stream to B, and C becomes the new default sink (this is already a bit unexpected, but it gets worse)
- A appears again
- module-switch-on-connect makes A the default sink. module-switch-on-connect should also move the stream back to A, but it doesn't, because the stream is now playing to B, which is a non-default sink, so module-switch-on-connect assumes that the user explicitly moved the stream to B, which the user did not do.
This problem could be avoided if module-rescue-streams used the same logic as what is used for choosing the new default sink when the old default sink disappears. To ensure that the logic is exactly the same, the logic should be implemented in a shared function that is used in both cases.