From: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date: Mon, 29 Jul 2019 13:27:59 +0000 (+0300)
Subject: pipewire: add patch to fix non-S16 negotiation issue
X-Git-Tag: 8.0.0^0
X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=0c48b622c53059cb0da320c83747056a766e3364;p=AGL%2Fmeta-agl-devel.git

pipewire: add patch to fix non-S16 negotiation issue

Bug-AGL: SPEC-2674

Change-Id: Id5b099a8efed2a2f9bdae142ef69bbc09deae8e8
Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
---

diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0015-audioconvert-fmtconvert-assume-F32-on-the-other-port.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0015-audioconvert-fmtconvert-assume-F32-on-the-other-port.patch
new file mode 100644
index 00000000..ed3c1b06
--- /dev/null
+++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0015-audioconvert-fmtconvert-assume-F32-on-the-other-port.patch
@@ -0,0 +1,44 @@
+From aa5de0cfc31df9cd8fb6d24367d2852dbbc8dcb9 Mon Sep 17 00:00:00 2001
+From: George Kiagiadakis <george.kiagiadakis@collabora.com>
+Date: Mon, 29 Jul 2019 16:12:45 +0300
+Subject: [PATCH] audioconvert/fmtconvert: assume F32 on the other port when
+ listing formats
+
+This allows picking F32LE as the default format on links that have
+no restriction and it avoids failing negotiation when the restricted
+end cannot handle S16/F32/F32P
+
+For instance this pipeline would previously fail:
+
+  audio-dsp mode=merge ! audio-dsp mode=convert ! alsa-sink
+old negotiation:     S16LE                   S24_32LE
+new negotiation:     F32LE                   S24_32LE
+
+The link between the audio-dsp nodes has no restriction, so previously
+it would negotiate S16LE, which would then fail to negotiate with alsa-sink
+because fmtconvert does not know how to convert S16LE to S24_32LE directly.
+
+With this change, the middle link negotiates to F32LE, which can be
+converted to anything.
+
+Upstream-Status: Submitted [https://github.com/PipeWire/pipewire/pull/169]
+---
+ spa/plugins/audioconvert/fmtconvert.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/spa/plugins/audioconvert/fmtconvert.c b/spa/plugins/audioconvert/fmtconvert.c
+index df4ffb6b..a330f68f 100644
+--- a/spa/plugins/audioconvert/fmtconvert.c
++++ b/spa/plugins/audioconvert/fmtconvert.c
+@@ -338,7 +338,7 @@ static int port_enum_formats(struct spa_node *node,
+ 			if (other->have_format)
+ 				info = other->format;
+ 			else
+-				info.info.raw.format = SPA_AUDIO_FORMAT_S16;
++				info.info.raw.format = SPA_AUDIO_FORMAT_F32;
+ 
+ 			if (info.info.raw.format == SPA_AUDIO_FORMAT_F32P ||
+ 			    info.info.raw.format == SPA_AUDIO_FORMAT_F32) {
+-- 
+2.20.1
+
diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire_git.bb b/meta-pipewire/recipes-multimedia/pipewire/pipewire_git.bb
index 43aae8ea..8809bddc 100644
--- a/meta-pipewire/recipes-multimedia/pipewire/pipewire_git.bb
+++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire_git.bb
@@ -15,6 +15,7 @@ SRC_URI = "gitsm://github.com/PipeWire/pipewire;protocol=https;branch=work \
     file://0012-gst-pwaudioringbuffer-request-pause-play-on-the-appr.patch \
     file://0013-gst-pwaudioringbuffer-wait-only-for-STREAM_STATE_CON.patch \
     file://0014-gst-pwaudiosink-set-the-default-latency-time-buffer-.patch \
+    file://0015-audioconvert-fmtconvert-assume-F32-on-the-other-port.patch \
     "
 
 SRCREV = "4be788962e60891237f1f018627bf709ae3981e6"