mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-12 13:30:10 -05:00
core, device-port: check availability when choosing the default device
It doesn't make sense to use a sink or source whose active port is unavailable, so let's take this into account when choosing the default sink and source.
This commit is contained in:
parent
6b34896130
commit
1c477fcb67
2 changed files with 24 additions and 0 deletions
|
|
@ -93,6 +93,14 @@ void pa_device_port_set_available(pa_device_port *p, pa_available_t status) {
|
|||
* be created before port objects, and then p->card could be non-NULL for
|
||||
* the whole lifecycle of pa_device_port. */
|
||||
if (p->card) {
|
||||
/* A sink or source whose active port is unavailable can't be the
|
||||
* default sink/source, so port availability changes may affect the
|
||||
* default sink/source choice. */
|
||||
if (p->direction == PA_DIRECTION_OUTPUT)
|
||||
pa_core_update_default_sink(p->core);
|
||||
else
|
||||
pa_core_update_default_source(p->core);
|
||||
|
||||
pa_subscription_post(p->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, p->card->index);
|
||||
pa_hook_fire(&p->core->hooks[PA_CORE_HOOK_PORT_AVAILABLE_CHANGED], p);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue