[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] device-port: queue CARD CHANGE event before update default sink
Tanu Kaskinen
gitlab at gitlab.freedesktop.org
Mon Jun 22 14:59:23 UTC 2020
Tanu Kaskinen pushed to branch master at PulseAudio / pulseaudio
Commits:
2ae94c14 by Libin Yang at 2020-06-22T14:53:42+00:00
device-port: queue CARD CHANGE event before update default sink
In single profile mode (headphone and speaker use different PCMs),
when headphone is plugged in, pa_device_port_set_available() will call
pa_core_update_default_sink/source() before posting
PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE to the gnome.
And pa_core_update_default_sink/source() will post
PA_SUBSCRIPTION_EVENT_SERVER | PA_SUBSCRIPTION_EVENT_CHANGE to the gnome.
So the original event sequence is:
1. PA_SUBSCRIPTION_EVENT_SERVER | PA_SUBSCRIPTION_EVENT_CHANGE
2. PA_SUBSCRIPTION_EVENT_CARD | PA_SUBSCRIPTION_EVENT_CHANGE
In gnome-control-center:
When it receives PA_SUBSCRIPTION_EVENT_SERVER, it will call
req_update_server_info () to update the panel;
When it receives PA_SUBSCRIPTION_EVENT_CARD, it will update
the card information, for example, when the headphone is connected,
it will call gtk_list_store_append() to append the headphone.
Let's use an example to clarify the correct sequence.
Assume we plug in headphone. PA will set the default sink to headphone
from speaker, and hope gnome sound setting "Output Deivce" to highlight to
"headphone". PA should send PA_SUBSCRIPTION_EVENT_CARD firstly to notify
gnome-control-center "headphone" is plugged in. And then it sends
PA_SUBSCRIPTION_EVENT_SERVER to trigger sound setting to highlight
to "headphone".
Signed-off-by: Libin Yang <libin.yang at intel.com>
- - - - -
1 changed file:
- src/pulsecore/device-port.c
Changes:
=====================================
src/pulsecore/device-port.c
=====================================
@@ -107,6 +107,8 @@ 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 && p->card->linked) {
+ 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);
/* 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. */
@@ -138,9 +140,6 @@ void pa_device_port_set_available(pa_device_port *p, pa_available_t status) {
pa_core_move_streams_to_newly_available_preferred_source(p->core, source);
}
}
-
- 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);
}
}
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/2ae94c141ff4d76d60a66a71d80acefbba3966d1
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/2ae94c141ff4d76d60a66a71d80acefbba3966d1
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20200622/f030622f/attachment.htm>
More information about the pulseaudio-commits
mailing list