Patchwork [meta-fsl-arm,v2,3/3] pulseaudio: Fix no sound issue after plugin/out headphone

login
register
mail settings
Submitter Jun Zhu
Date Aug. 1, 2014, 6:18 a.m.
Message ID <1406873886-30571-3-git-send-email-R01007@freescale.com>
Download mbox | patch
Permalink /patch/77067/
State Changes Requested
Delegated to: Otavio Salvador
Headers show

Comments

Jun Zhu - Aug. 1, 2014, 6:18 a.m.
This issue found on the i.MX6 testing: when switch audio output
between headphone and speaker, sometimes it founds no sound when
plugin headphone.
Root cause is the the core-subscribe.c has a defer queue for
audio sink's switch event and stores the status in database.
Because it is a defer queue, sometimes the stored status is changed
not as user expected.

Signed-off-by: Jun Zhu <R01007@freescale.com>
---
 ...s-no-sound-after-plugin-plugout-headphone.patch |  127 ++++++++++++++++++++
 .../pulseaudio/pulseaudio_5.0.bbappend             |    1 +
 2 files changed, 128 insertions(+)
 create mode 100644 recipes-multimedia/pulseaudio/pulseaudio/mx6/Fix-issue-there-is-no-sound-after-plugin-plugout-headphone.patch
Otavio Salvador - Aug. 1, 2014, 1:12 p.m.
On Fri, Aug 1, 2014 at 3:18 AM, Jun Zhu <R01007@freescale.com> wrote:
> This issue found on the i.MX6 testing: when switch audio output
> between headphone and speaker, sometimes it founds no sound when
> plugin headphone.
> Root cause is the the core-subscribe.c has a defer queue for
> audio sink's switch event and stores the status in database.
> Because it is a defer queue, sometimes the stored status is changed
> not as user expected.
>
> Signed-off-by: Jun Zhu <R01007@freescale.com>
...
> +Another change is remain the volume same as the asound.state.
...

Could the asound change be reverted? This is indeed an application
option and people making Media Servers would expect PulseAudio to be
the authority here in case it is in use.

Patch

diff --git a/recipes-multimedia/pulseaudio/pulseaudio/mx6/Fix-issue-there-is-no-sound-after-plugin-plugout-headphone.patch b/recipes-multimedia/pulseaudio/pulseaudio/mx6/Fix-issue-there-is-no-sound-after-plugin-plugout-headphone.patch
new file mode 100644
index 0000000..0d4d73a
--- /dev/null
+++ b/recipes-multimedia/pulseaudio/pulseaudio/mx6/Fix-issue-there-is-no-sound-after-plugin-plugout-headphone.patch
@@ -0,0 +1,127 @@ 
+From 7dfff7e62296779dca9831598af082ee72bfed41 Mon Sep 17 00:00:00 2001
+From: Shengjiu Wang <b02247@freescale.com>
+Date: Mon, 5 May 2014 14:21:16 +0800
+Subject: [PATCH] Fix issue: there is no sound after plugin/plugout headphone
+
+In default config, when switching headphone with speaker, the unused one will
+be switch off. And pulseaudio will store the setting in the database for
+restore later, when switch back to the output path.
+But the core-subscribe.c has a defer queue for these events, like sink|new,
+sink|change, which will read the current switch status and store it in
+the database. Because it is a defer queue, sometimes the stored status is
+changed not as user's requirement. below is the call flow.
+
+init:
+        store on for speaker to database.
+        store on for headphone to database.
+---Activating analog-output-speaker
+	switch on speaker
+	switch off headphone
+----headphone plugin
+   ---analog-output-speaker status no
+   ---Activating analog-output
+      Queued event (SINK|CHANGE|0)
+      switch off speaker
+      switch off headphone
+   ---analog-output-headphone status yes
+   ---Activating analog-output-headphone
+      switch off speaker
+      switch off headphone
+      Dispatched event (SINK|CHANGE|0)
+       store off for headphone to database.
+
+Meantime the root cause is not found, a workaround is used by changing the
+configure file.
+
+Another change is remain the volume same as the asound.state.
+
+Upstream Status: N/A
+  - It is i.Mx specific 
+
+Signed-off-by: Shengjiu Wang <b02247@freescale.com>
+---
+ .../alsa/mixer/paths/analog-output-headphones.conf |    8 ++++----
+ .../alsa/mixer/paths/analog-output-speaker.conf    |    8 ++++----
+ src/modules/alsa/mixer/paths/analog-output.conf    |    8 ++++----
+ 3 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/src/modules/alsa/mixer/paths/analog-output-headphones.conf b/src/modules/alsa/mixer/paths/analog-output-headphones.conf
+index b1a349a..7bfa79e 100644
+--- a/src/modules/alsa/mixer/paths/analog-output-headphones.conf
++++ b/src/modules/alsa/mixer/paths/analog-output-headphones.conf
+@@ -63,8 +63,8 @@ volume = off
+ 
+ [Element Headphone]
+ required-any = any
+-switch = mute
+-volume = merge
++switch = on
++volume = ignore
+ override-map.1 = all
+ override-map.2 = all-left,all-right
+ 
+@@ -86,8 +86,8 @@ switch = mute
+ volume = zero
+ 
+ [Element Speaker]
+-switch = off
+-volume = off
++switch = on
++volume = ignore
+ 
+ [Element Desktop Speaker]
+ switch = off
+diff --git a/src/modules/alsa/mixer/paths/analog-output-speaker.conf b/src/modules/alsa/mixer/paths/analog-output-speaker.conf
+index d79fad1..eae40a0 100644
+--- a/src/modules/alsa/mixer/paths/analog-output-speaker.conf
++++ b/src/modules/alsa/mixer/paths/analog-output-speaker.conf
+@@ -62,8 +62,8 @@ volume = off
+ ; This profile path is intended to control the speaker, let's mute headphones
+ ; else there will be a spike when plugging in headphones
+ [Element Headphone]
+-switch = off
+-volume = off
++switch = on
++volume = ignore
+ 
+ [Element Headphone2]
+ switch = off
+@@ -71,8 +71,8 @@ volume = off
+ 
+ [Element Speaker]
+ required-any = any
+-switch = mute
+-volume = merge
++switch = on
++volume = ignore
+ override-map.1 = all
+ override-map.2 = all-left,all-right
+ 
+diff --git a/src/modules/alsa/mixer/paths/analog-output.conf b/src/modules/alsa/mixer/paths/analog-output.conf
+index 3a552c9..bd5c12b 100644
+--- a/src/modules/alsa/mixer/paths/analog-output.conf
++++ b/src/modules/alsa/mixer/paths/analog-output.conf
+@@ -53,16 +53,16 @@ switch = off
+ ; headphones. But it should not hurt if we leave the headphone jack
+ ; enabled nonetheless.
+ [Element Headphone]
+-switch = mute
+-volume = zero
++switch = on
++volume = ignore
+ 
+ [Element Headphone2]
+ switch = mute
+ volume = zero
+ 
+ [Element Speaker]
+-switch = mute
+-volume = off
++switch = on
++volume = ignore
+ 
+ [Element Desktop Speaker]
+ switch = mute
+-- 
+1.7.9.5
+
diff --git a/recipes-multimedia/pulseaudio/pulseaudio_5.0.bbappend b/recipes-multimedia/pulseaudio/pulseaudio_5.0.bbappend
index 81b03f6..63f522d 100644
--- a/recipes-multimedia/pulseaudio/pulseaudio_5.0.bbappend
+++ b/recipes-multimedia/pulseaudio/pulseaudio_5.0.bbappend
@@ -2,6 +2,7 @@  FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
 
 SRC_URI_append_mx6 = " file://daemon.conf \
         file://default.pa \
+        file://Fix-issue-there-is-no-sound-after-plugin-plugout-headphone.patch \
 "
 
 do_install_append_mx6 () {