Skip to content

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@intel.com

Merge request reports