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

login
register
mail settings
Submitter Jun Zhu
Date July 29, 2014, 7:04 a.m.
Message ID <1406617455-16372-3-git-send-email-R01007@freescale.com>
Download mbox | patch
Permalink /patch/76819/
State Changes Requested
Delegated to: Otavio Salvador
Headers show

Comments

Jun Zhu - July 29, 2014, 7:04 a.m.
This issue found on the i.MX6 testing: when switch audio output
between headphone and speaker, sometimes it found 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>
---
 ...here-is-no-sound-after-plugin-plugout-hea.patch |  127 ++++++++++++++++++++
 .../pulseaudio/pulseaudio_5.0.bbappend             |    1 +
 2 files changed, 128 insertions(+)
 create mode 100644 recipes-multimedia/pulseaudio/pulseaudio/0002-Fix-issue-there-is-no-sound-after-plugin-plugout-hea.patch
Otavio Salvador - July 29, 2014, 1:46 p.m.
On Tue, Jul 29, 2014 at 4:04 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 found 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>

The patch needs to be included only for i.MX6.

Patch

diff --git a/recipes-multimedia/pulseaudio/pulseaudio/0002-Fix-issue-there-is-no-sound-after-plugin-plugout-hea.patch b/recipes-multimedia/pulseaudio/pulseaudio/0002-Fix-issue-there-is-no-sound-after-plugin-plugout-hea.patch
new file mode 100644
index 0000000..0d4d73a
--- /dev/null
+++ b/recipes-multimedia/pulseaudio/pulseaudio/0002-Fix-issue-there-is-no-sound-after-plugin-plugout-hea.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 4ea4921..5b2b1a9 100644
--- a/recipes-multimedia/pulseaudio/pulseaudio_5.0.bbappend
+++ b/recipes-multimedia/pulseaudio/pulseaudio_5.0.bbappend
@@ -6,6 +6,7 @@  FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
 SRC_URI_append = " file://daemon.conf \
         file://default.pa \
         file://0001-Fix-pulseaudio-mutex-issue-when-do-pause-in-gstreame.patch \
+        file://0002-Fix-issue-there-is-no-sound-after-plugin-plugout-hea.patch \
 "
 
 do_install_append() {