* [PATCH 00/12] audio: pipewire backend improvements
@ 2023-05-06 16:37 marcandre.lureau
2023-05-06 16:37 ` [PATCH 01/12] libvirt-ci: update submodule to cover pipewire marcandre.lureau
` (11 more replies)
0 siblings, 12 replies; 26+ messages in thread
From: marcandre.lureau @ 2023-05-06 16:37 UTC (permalink / raw)
To: qemu-devel
Cc: Gerd Hoffmann, Wainer dos Santos Moschetta, Beraldo Leal,
Marc-André Lureau, Thomas Huth, Markus Armbruster,
Alex Bennée, Philippe Mathieu-Daudé, dbassey,
Daniel P. Berrangé, Eric Blake, Paolo Bonzini
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Hi,
Here are a few patches to cover PipeWire support in the CI and other misc code
improvements.
Note: depends on libvirt-ci!396
thanks
Marc-André Lureau (12):
libvirt-ci: update submodule to cover pipewire
tests/lcitool: add pipewire
audio/pw: Pipewire->PipeWire case fix for user-visible text
audio/pw: drop needless case statement
audio/pw: needless check for NULL
audio/pw: trace during init before calling pipewire API
audio/pw: add more details on error
audio/pw: factorize some common code
audio/pw: add more error reporting
audio/pw: simplify error reporting in stream creation
audio/pw: remove wrong comment
audio/pw: improve channel position code
meson.build | 2 +-
qapi/audio.json | 12 +-
audio/pwaudio.c | 212 +++++++-----------
audio/trace-events | 2 +-
meson_options.txt | 2 +-
qemu-options.hx | 4 +-
scripts/meson-buildoptions.sh | 2 +-
tests/docker/dockerfiles/alpine.docker | 1 +
tests/docker/dockerfiles/centos8.docker | 1 +
.../dockerfiles/debian-amd64-cross.docker | 1 +
tests/docker/dockerfiles/debian-amd64.docker | 1 +
.../dockerfiles/debian-arm64-cross.docker | 1 +
.../dockerfiles/debian-armel-cross.docker | 1 +
.../dockerfiles/debian-armhf-cross.docker | 1 +
.../dockerfiles/debian-mips64el-cross.docker | 1 +
.../dockerfiles/debian-mipsel-cross.docker | 1 +
.../dockerfiles/debian-ppc64el-cross.docker | 1 +
.../dockerfiles/debian-s390x-cross.docker | 1 +
tests/docker/dockerfiles/fedora.docker | 1 +
tests/docker/dockerfiles/opensuse-leap.docker | 1 +
tests/docker/dockerfiles/ubuntu2204.docker | 1 +
tests/lcitool/libvirt-ci | 2 +-
tests/lcitool/projects/qemu.yml | 1 +
23 files changed, 105 insertions(+), 148 deletions(-)
--
2.40.1
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 01/12] libvirt-ci: update submodule to cover pipewire
2023-05-06 16:37 [PATCH 00/12] audio: pipewire backend improvements marcandre.lureau
@ 2023-05-06 16:37 ` marcandre.lureau
2023-05-06 16:37 ` [PATCH 02/12] tests/lcitool: add pipewire marcandre.lureau
` (10 subsequent siblings)
11 siblings, 0 replies; 26+ messages in thread
From: marcandre.lureau @ 2023-05-06 16:37 UTC (permalink / raw)
To: qemu-devel
Cc: Gerd Hoffmann, Wainer dos Santos Moschetta, Beraldo Leal,
Marc-André Lureau, Thomas Huth, Markus Armbruster,
Alex Bennée, Philippe Mathieu-Daudé, dbassey,
Daniel P. Berrangé, Eric Blake, Paolo Bonzini
From: Marc-André Lureau <marcandre.lureau@redhat.com>
List of upstream changes:
Abdulwasiu Apalowo (6):
commandline: add default tag information to image argument
containers: add tag parameter to image_exists method
lcitool: edit error message during container run (or shell) operation.
containers: change the mode bits of --script argument
containers: mount temporary directory to user's home in the container
containers: always change workdir to the user's home
Ani Sinha (1):
mappings: add new package mappings for mformat and xorriso
Erik Skultety (17):
docs: mappings: Add a section on the preferred mapping naming scheme
facts: projects: nbdkit: Replace zstd mapping with libzstd
facts: mappings: Drop 'zstd' mapping
facts: targets: Add Fedora 38
gitlab-ci.yml: Add Fedora 38 target
facts: targets: Drop Fedora 36 target
Add a pytest.ini
tests: commands: Consolidate the installed package/run from git tests
Add tox.ini configuration file
test-requirements: Rename to dev-requirements.txt
requirements: Add tox to dev-requirements.txt and drop pytest and flake
dev-requirements: Reference VM requirements
gitignore: Add the default .tox directory
tox: Allow running with custom pytest options with {posargs}
gitlab-ci.yml: Start using tox for testing
.gitlab-ci.yml: Always test against installed lcitool
docs: testing: Update contents with tox
Marc-André Lureau (1):
facts/mappings & qemu: add pipewire
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
tests/lcitool/libvirt-ci | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/lcitool/libvirt-ci b/tests/lcitool/libvirt-ci
index 85487e1404..2e0571c3e0 160000
--- a/tests/lcitool/libvirt-ci
+++ b/tests/lcitool/libvirt-ci
@@ -1 +1 @@
-Subproject commit 85487e140415b2ac54b01a9a6b600fd7c21edc2f
+Subproject commit 2e0571c3e0722c79b90decb2c7fd9fa1deebbd46
--
2.40.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 02/12] tests/lcitool: add pipewire
2023-05-06 16:37 [PATCH 00/12] audio: pipewire backend improvements marcandre.lureau
2023-05-06 16:37 ` [PATCH 01/12] libvirt-ci: update submodule to cover pipewire marcandre.lureau
@ 2023-05-06 16:37 ` marcandre.lureau
2023-05-10 7:35 ` Philippe Mathieu-Daudé
2023-05-06 16:37 ` [PATCH 03/12] audio/pw: Pipewire->PipeWire case fix for user-visible text marcandre.lureau
` (9 subsequent siblings)
11 siblings, 1 reply; 26+ messages in thread
From: marcandre.lureau @ 2023-05-06 16:37 UTC (permalink / raw)
To: qemu-devel
Cc: Gerd Hoffmann, Wainer dos Santos Moschetta, Beraldo Leal,
Marc-André Lureau, Thomas Huth, Markus Armbruster,
Alex Bennée, Philippe Mathieu-Daudé, dbassey,
Daniel P. Berrangé, Eric Blake, Paolo Bonzini
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
tests/docker/dockerfiles/alpine.docker | 1 +
tests/docker/dockerfiles/centos8.docker | 1 +
tests/docker/dockerfiles/debian-amd64-cross.docker | 1 +
tests/docker/dockerfiles/debian-amd64.docker | 1 +
tests/docker/dockerfiles/debian-arm64-cross.docker | 1 +
tests/docker/dockerfiles/debian-armel-cross.docker | 1 +
tests/docker/dockerfiles/debian-armhf-cross.docker | 1 +
tests/docker/dockerfiles/debian-mips64el-cross.docker | 1 +
tests/docker/dockerfiles/debian-mipsel-cross.docker | 1 +
tests/docker/dockerfiles/debian-ppc64el-cross.docker | 1 +
tests/docker/dockerfiles/debian-s390x-cross.docker | 1 +
tests/docker/dockerfiles/fedora.docker | 1 +
tests/docker/dockerfiles/opensuse-leap.docker | 1 +
tests/docker/dockerfiles/ubuntu2204.docker | 1 +
tests/lcitool/projects/qemu.yml | 1 +
15 files changed, 15 insertions(+)
diff --git a/tests/docker/dockerfiles/alpine.docker b/tests/docker/dockerfiles/alpine.docker
index 81c70aeaf9..d47101e042 100644
--- a/tests/docker/dockerfiles/alpine.docker
+++ b/tests/docker/dockerfiles/alpine.docker
@@ -77,6 +77,7 @@ RUN apk update && \
numactl-dev \
openssh-client \
pcre-dev \
+ pipewire-dev \
pixman-dev \
pkgconf \
pulseaudio-dev \
diff --git a/tests/docker/dockerfiles/centos8.docker b/tests/docker/dockerfiles/centos8.docker
index 1a6a9087c1..f7d46ebd9c 100644
--- a/tests/docker/dockerfiles/centos8.docker
+++ b/tests/docker/dockerfiles/centos8.docker
@@ -90,6 +90,7 @@ RUN dnf distro-sync -y && \
openssh-clients \
pam-devel \
pcre-static \
+ pipewire-devel \
pixman-devel \
pkgconfig \
pulseaudio-libs-devel \
diff --git a/tests/docker/dockerfiles/debian-amd64-cross.docker b/tests/docker/dockerfiles/debian-amd64-cross.docker
index 2e7eb445f1..26109fe4d6 100644
--- a/tests/docker/dockerfiles/debian-amd64-cross.docker
+++ b/tests/docker/dockerfiles/debian-amd64-cross.docker
@@ -114,6 +114,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libnfs-dev:amd64 \
libnuma-dev:amd64 \
libpam0g-dev:amd64 \
+ libpipewire-0.3-dev:amd64 \
libpixman-1-dev:amd64 \
libpmem-dev:amd64 \
libpng-dev:amd64 \
diff --git a/tests/docker/dockerfiles/debian-amd64.docker b/tests/docker/dockerfiles/debian-amd64.docker
index 28e2fa81b1..8ba1c13d8d 100644
--- a/tests/docker/dockerfiles/debian-amd64.docker
+++ b/tests/docker/dockerfiles/debian-amd64.docker
@@ -70,6 +70,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libnuma-dev \
libpam0g-dev \
libpcre2-dev \
+ libpipewire-0.3-dev \
libpixman-1-dev \
libpmem-dev \
libpng-dev \
diff --git a/tests/docker/dockerfiles/debian-arm64-cross.docker b/tests/docker/dockerfiles/debian-arm64-cross.docker
index f558770f84..f560ed6044 100644
--- a/tests/docker/dockerfiles/debian-arm64-cross.docker
+++ b/tests/docker/dockerfiles/debian-arm64-cross.docker
@@ -114,6 +114,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libnfs-dev:arm64 \
libnuma-dev:arm64 \
libpam0g-dev:arm64 \
+ libpipewire-0.3-dev:arm64 \
libpixman-1-dev:arm64 \
libpng-dev:arm64 \
libpulse-dev:arm64 \
diff --git a/tests/docker/dockerfiles/debian-armel-cross.docker b/tests/docker/dockerfiles/debian-armel-cross.docker
index f3d7e07cce..41f9f67417 100644
--- a/tests/docker/dockerfiles/debian-armel-cross.docker
+++ b/tests/docker/dockerfiles/debian-armel-cross.docker
@@ -114,6 +114,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libnfs-dev:armel \
libnuma-dev:armel \
libpam0g-dev:armel \
+ libpipewire-0.3-dev:armel \
libpixman-1-dev:armel \
libpng-dev:armel \
libpulse-dev:armel \
diff --git a/tests/docker/dockerfiles/debian-armhf-cross.docker b/tests/docker/dockerfiles/debian-armhf-cross.docker
index 531c556ad5..1a095c6506 100644
--- a/tests/docker/dockerfiles/debian-armhf-cross.docker
+++ b/tests/docker/dockerfiles/debian-armhf-cross.docker
@@ -114,6 +114,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libnfs-dev:armhf \
libnuma-dev:armhf \
libpam0g-dev:armhf \
+ libpipewire-0.3-dev:armhf \
libpixman-1-dev:armhf \
libpng-dev:armhf \
libpulse-dev:armhf \
diff --git a/tests/docker/dockerfiles/debian-mips64el-cross.docker b/tests/docker/dockerfiles/debian-mips64el-cross.docker
index 816dbd2911..de001a7532 100644
--- a/tests/docker/dockerfiles/debian-mips64el-cross.docker
+++ b/tests/docker/dockerfiles/debian-mips64el-cross.docker
@@ -113,6 +113,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libnfs-dev:mips64el \
libnuma-dev:mips64el \
libpam0g-dev:mips64el \
+ libpipewire-0.3-dev:mips64el \
libpixman-1-dev:mips64el \
libpng-dev:mips64el \
libpulse-dev:mips64el \
diff --git a/tests/docker/dockerfiles/debian-mipsel-cross.docker b/tests/docker/dockerfiles/debian-mipsel-cross.docker
index b115b29af3..993de380d7 100644
--- a/tests/docker/dockerfiles/debian-mipsel-cross.docker
+++ b/tests/docker/dockerfiles/debian-mipsel-cross.docker
@@ -113,6 +113,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libnfs-dev:mipsel \
libnuma-dev:mipsel \
libpam0g-dev:mipsel \
+ libpipewire-0.3-dev:mipsel \
libpixman-1-dev:mipsel \
libpng-dev:mipsel \
libpulse-dev:mipsel \
diff --git a/tests/docker/dockerfiles/debian-ppc64el-cross.docker b/tests/docker/dockerfiles/debian-ppc64el-cross.docker
index 301bddb536..5120b29634 100644
--- a/tests/docker/dockerfiles/debian-ppc64el-cross.docker
+++ b/tests/docker/dockerfiles/debian-ppc64el-cross.docker
@@ -114,6 +114,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libnfs-dev:ppc64el \
libnuma-dev:ppc64el \
libpam0g-dev:ppc64el \
+ libpipewire-0.3-dev:ppc64el \
libpixman-1-dev:ppc64el \
libpng-dev:ppc64el \
libpulse-dev:ppc64el \
diff --git a/tests/docker/dockerfiles/debian-s390x-cross.docker b/tests/docker/dockerfiles/debian-s390x-cross.docker
index 5d27c91c17..cef629f68d 100644
--- a/tests/docker/dockerfiles/debian-s390x-cross.docker
+++ b/tests/docker/dockerfiles/debian-s390x-cross.docker
@@ -114,6 +114,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libnfs-dev:s390x \
libnuma-dev:s390x \
libpam0g-dev:s390x \
+ libpipewire-0.3-dev:s390x \
libpixman-1-dev:s390x \
libpng-dev:s390x \
libpulse-dev:s390x \
diff --git a/tests/docker/dockerfiles/fedora.docker b/tests/docker/dockerfiles/fedora.docker
index b698b7595d..4e087cc2f9 100644
--- a/tests/docker/dockerfiles/fedora.docker
+++ b/tests/docker/dockerfiles/fedora.docker
@@ -98,6 +98,7 @@ exec "$@"\n' > /usr/bin/nosync && \
openssh-clients \
pam-devel \
pcre-static \
+ pipewire-devel \
pixman-devel \
pkgconfig \
pulseaudio-libs-devel \
diff --git a/tests/docker/dockerfiles/opensuse-leap.docker b/tests/docker/dockerfiles/opensuse-leap.docker
index afb9f5419f..2f13d446d2 100644
--- a/tests/docker/dockerfiles/opensuse-leap.docker
+++ b/tests/docker/dockerfiles/opensuse-leap.docker
@@ -88,6 +88,7 @@ RUN zypper update -y && \
openssh \
pam-devel \
pcre-devel-static \
+ pipewire-devel \
pkgconfig \
python39-base \
python39-pip \
diff --git a/tests/docker/dockerfiles/ubuntu2204.docker b/tests/docker/dockerfiles/ubuntu2204.docker
index 3f7d30e5d0..8ebb2ee1d6 100644
--- a/tests/docker/dockerfiles/ubuntu2204.docker
+++ b/tests/docker/dockerfiles/ubuntu2204.docker
@@ -70,6 +70,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libnuma-dev \
libpam0g-dev \
libpcre2-dev \
+ libpipewire-0.3-dev \
libpixman-1-dev \
libpmem-dev \
libpng-dev \
diff --git a/tests/lcitool/projects/qemu.yml b/tests/lcitool/projects/qemu.yml
index af3700379a..117c872f62 100644
--- a/tests/lcitool/projects/qemu.yml
+++ b/tests/lcitool/projects/qemu.yml
@@ -84,6 +84,7 @@ packages:
- pam
- pcre-static
- pixman
+ - pipewire
- pkg-config
- pulseaudio
- python3
--
2.40.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 03/12] audio/pw: Pipewire->PipeWire case fix for user-visible text
2023-05-06 16:37 [PATCH 00/12] audio: pipewire backend improvements marcandre.lureau
2023-05-06 16:37 ` [PATCH 01/12] libvirt-ci: update submodule to cover pipewire marcandre.lureau
2023-05-06 16:37 ` [PATCH 02/12] tests/lcitool: add pipewire marcandre.lureau
@ 2023-05-06 16:37 ` marcandre.lureau
2023-05-07 14:56 ` Volker Rümelin
2023-05-10 7:36 ` Philippe Mathieu-Daudé
2023-05-06 16:37 ` [PATCH 04/12] audio/pw: drop needless case statement marcandre.lureau
` (8 subsequent siblings)
11 siblings, 2 replies; 26+ messages in thread
From: marcandre.lureau @ 2023-05-06 16:37 UTC (permalink / raw)
To: qemu-devel
Cc: Gerd Hoffmann, Wainer dos Santos Moschetta, Beraldo Leal,
Marc-André Lureau, Thomas Huth, Markus Armbruster,
Alex Bennée, Philippe Mathieu-Daudé, dbassey,
Daniel P. Berrangé, Eric Blake, Paolo Bonzini
From: Marc-André Lureau <marcandre.lureau@redhat.com>
"PipeWire" is the correct case.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
meson.build | 2 +-
qapi/audio.json | 12 ++++++------
audio/pwaudio.c | 10 +++++-----
audio/trace-events | 2 +-
meson_options.txt | 2 +-
qemu-options.hx | 4 ++--
scripts/meson-buildoptions.sh | 2 +-
7 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/meson.build b/meson.build
index 229eb585f7..4c44736bd4 100644
--- a/meson.build
+++ b/meson.build
@@ -3988,7 +3988,7 @@ if targetos == 'linux'
summary_info += {'ALSA support': alsa}
summary_info += {'PulseAudio support': pulse}
endif
-summary_info += {'Pipewire support': pipewire}
+summary_info += {'PipeWire support': pipewire}
summary_info += {'JACK support': jack}
summary_info += {'brlapi support': brlapi}
summary_info += {'vde support': vde}
diff --git a/qapi/audio.json b/qapi/audio.json
index e03396a7bc..b5c1af2b91 100644
--- a/qapi/audio.json
+++ b/qapi/audio.json
@@ -327,17 +327,17 @@
##
# @AudiodevPipewirePerDirectionOptions:
#
-# Options of the Pipewire backend that are used for both playback and
+# Options of the PipeWire backend that are used for both playback and
# recording.
#
# @name: name of the sink/source to use
#
-# @stream-name: name of the Pipewire stream created by qemu. Can be
-# used to identify the stream in Pipewire when you
-# create multiple Pipewire devices or run multiple qemu
+# @stream-name: name of the PipeWire stream created by qemu. Can be
+# used to identify the stream in PipeWire when you
+# create multiple PipeWire devices or run multiple qemu
# instances (default: audiodev's id)
#
-# @latency: latency you want Pipewire to achieve in microseconds
+# @latency: latency you want PipeWire to achieve in microseconds
# (default 46000)
#
# Since: 8.1
@@ -352,7 +352,7 @@
##
# @AudiodevPipewireOptions:
#
-# Options of the Pipewire audio backend.
+# Options of the PipeWire audio backend.
#
# @in: options of the capture stream
#
diff --git a/audio/pwaudio.c b/audio/pwaudio.c
index 1d108bdebb..9eb69bfd18 100644
--- a/audio/pwaudio.c
+++ b/audio/pwaudio.c
@@ -1,5 +1,5 @@
/*
- * QEMU Pipewire audio driver
+ * QEMU PipeWire audio driver
*
* Copyright (c) 2023 Red Hat Inc.
*
@@ -800,21 +800,21 @@ qpw_audio_init(Audiodev *dev)
assert(dev->driver == AUDIODEV_DRIVER_PIPEWIRE);
pw->dev = dev;
- pw->thread_loop = pw_thread_loop_new("Pipewire thread loop", NULL);
+ pw->thread_loop = pw_thread_loop_new("PipeWire thread loop", NULL);
if (pw->thread_loop == NULL) {
- error_report("Could not create Pipewire loop");
+ error_report("Could not create PipeWire loop");
goto fail;
}
pw->context =
pw_context_new(pw_thread_loop_get_loop(pw->thread_loop), NULL, 0);
if (pw->context == NULL) {
- error_report("Could not create Pipewire context");
+ error_report("Could not create PipeWire context");
goto fail;
}
if (pw_thread_loop_start(pw->thread_loop) < 0) {
- error_report("Could not start Pipewire loop");
+ error_report("Could not start PipeWire loop");
goto fail;
}
diff --git a/audio/trace-events b/audio/trace-events
index 85dbb506b2..ab04f020ce 100644
--- a/audio/trace-events
+++ b/audio/trace-events
@@ -24,7 +24,7 @@ pw_read(int32_t avail, uint32_t index, size_t len) "avail=%d index=%u len=%zu"
pw_write(int32_t filled, int32_t avail, uint32_t index, size_t len) "filled=%d avail=%d index=%u len=%zu"
pw_vol(const char *ret) "set volume: %s"
pw_period(uint64_t quantum, uint32_t rate) "period =%" PRIu64 "/%u"
-pw_audio_init(void) "Initialize Pipewire context"
+pw_audio_init(void) "Initialize PipeWire context"
# audio.c
audio_timer_start(int interval) "interval %d ms"
diff --git a/meson_options.txt b/meson_options.txt
index ae2017702a..8dd786c1a4 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -256,7 +256,7 @@ option('oss', type: 'feature', value: 'auto',
option('pa', type: 'feature', value: 'auto',
description: 'PulseAudio sound support')
option('pipewire', type: 'feature', value: 'auto',
- description: 'Pipewire sound support')
+ description: 'PipeWire sound support')
option('sndio', type: 'feature', value: 'auto',
description: 'sndio sound support')
diff --git a/qemu-options.hx b/qemu-options.hx
index 42b9094c10..be7317d455 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -963,10 +963,10 @@ SRST
to honor this value but actual latencies may be lower or higher.
``-audiodev pipewire,id=id[,prop[=value][,...]]``
- Creates a backend using Pipewire. This backend is available on
+ Creates a backend using PipeWire. This backend is available on
most systems.
- Pipewire specific options are:
+ PipeWire specific options are:
``in|out.latency=usecs``
Desired latency in microseconds.
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 0e888e6ecd..ba697207f4 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -137,7 +137,7 @@ meson_options_help() {
printf "%s\n" ' oss OSS sound support'
printf "%s\n" ' pa PulseAudio sound support'
printf "%s\n" ' parallels parallels image format support'
- printf "%s\n" ' pipewire Pipewire sound support'
+ printf "%s\n" ' pipewire PipeWire sound support'
printf "%s\n" ' png PNG support with libpng'
printf "%s\n" ' pvrdma Enable PVRDMA support'
printf "%s\n" ' qcow1 qcow1 image format support'
--
2.40.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 04/12] audio/pw: drop needless case statement
2023-05-06 16:37 [PATCH 00/12] audio: pipewire backend improvements marcandre.lureau
` (2 preceding siblings ...)
2023-05-06 16:37 ` [PATCH 03/12] audio/pw: Pipewire->PipeWire case fix for user-visible text marcandre.lureau
@ 2023-05-06 16:37 ` marcandre.lureau
2023-05-07 14:58 ` Volker Rümelin
2023-05-06 16:37 ` [PATCH 05/12] audio/pw: needless check for NULL marcandre.lureau
` (7 subsequent siblings)
11 siblings, 1 reply; 26+ messages in thread
From: marcandre.lureau @ 2023-05-06 16:37 UTC (permalink / raw)
To: qemu-devel
Cc: Gerd Hoffmann, Wainer dos Santos Moschetta, Beraldo Leal,
Marc-André Lureau, Thomas Huth, Markus Armbruster,
Alex Bennée, Philippe Mathieu-Daudé, dbassey,
Daniel P. Berrangé, Eric Blake, Paolo Bonzini
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
audio/pwaudio.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/audio/pwaudio.c b/audio/pwaudio.c
index 9eb69bfd18..51cfc0b052 100644
--- a/audio/pwaudio.c
+++ b/audio/pwaudio.c
@@ -197,16 +197,6 @@ on_stream_state_changed(void *data, enum pw_stream_state old,
trace_pw_state_changed(pw_stream_get_node_id(v->stream),
pw_stream_state_as_string(state));
-
- switch (state) {
- case PW_STREAM_STATE_ERROR:
- case PW_STREAM_STATE_UNCONNECTED:
- break;
- case PW_STREAM_STATE_PAUSED:
- case PW_STREAM_STATE_CONNECTING:
- case PW_STREAM_STATE_STREAMING:
- break;
- }
}
static const struct pw_stream_events capture_stream_events = {
--
2.40.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 05/12] audio/pw: needless check for NULL
2023-05-06 16:37 [PATCH 00/12] audio: pipewire backend improvements marcandre.lureau
` (3 preceding siblings ...)
2023-05-06 16:37 ` [PATCH 04/12] audio/pw: drop needless case statement marcandre.lureau
@ 2023-05-06 16:37 ` marcandre.lureau
2023-05-07 15:01 ` Volker Rümelin
2023-05-06 16:37 ` [PATCH 06/12] audio/pw: trace during init before calling pipewire API marcandre.lureau
` (6 subsequent siblings)
11 siblings, 1 reply; 26+ messages in thread
From: marcandre.lureau @ 2023-05-06 16:37 UTC (permalink / raw)
To: qemu-devel
Cc: Gerd Hoffmann, Wainer dos Santos Moschetta, Beraldo Leal,
Marc-André Lureau, Thomas Huth, Markus Armbruster,
Alex Bennée, Philippe Mathieu-Daudé, dbassey,
Daniel P. Berrangé, Eric Blake, Paolo Bonzini
From: Marc-André Lureau <marcandre.lureau@redhat.com>
g_clear_pointer() already checks for NULL.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
audio/pwaudio.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/audio/pwaudio.c b/audio/pwaudio.c
index 51cfc0b052..6ca4ef4f62 100644
--- a/audio/pwaudio.c
+++ b/audio/pwaudio.c
@@ -834,12 +834,8 @@ fail:
if (pw->thread_loop) {
pw_thread_loop_stop(pw->thread_loop);
}
- if (pw->context) {
- g_clear_pointer(&pw->context, pw_context_destroy);
- }
- if (pw->thread_loop) {
- g_clear_pointer(&pw->thread_loop, pw_thread_loop_destroy);
- }
+ g_clear_pointer(&pw->context, pw_context_destroy);
+ g_clear_pointer(&pw->thread_loop, pw_thread_loop_destroy);
return NULL;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 06/12] audio/pw: trace during init before calling pipewire API
2023-05-06 16:37 [PATCH 00/12] audio: pipewire backend improvements marcandre.lureau
` (4 preceding siblings ...)
2023-05-06 16:37 ` [PATCH 05/12] audio/pw: needless check for NULL marcandre.lureau
@ 2023-05-06 16:37 ` marcandre.lureau
2023-05-07 15:03 ` Volker Rümelin
2023-05-10 7:37 ` Philippe Mathieu-Daudé
2023-05-06 16:37 ` [PATCH 07/12] audio/pw: add more details on error marcandre.lureau
` (5 subsequent siblings)
11 siblings, 2 replies; 26+ messages in thread
From: marcandre.lureau @ 2023-05-06 16:37 UTC (permalink / raw)
To: qemu-devel
Cc: Gerd Hoffmann, Wainer dos Santos Moschetta, Beraldo Leal,
Marc-André Lureau, Thomas Huth, Markus Armbruster,
Alex Bennée, Philippe Mathieu-Daudé, dbassey,
Daniel P. Berrangé, Eric Blake, Paolo Bonzini
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
audio/pwaudio.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/audio/pwaudio.c b/audio/pwaudio.c
index 6ca4ef4f62..2b12b40934 100644
--- a/audio/pwaudio.c
+++ b/audio/pwaudio.c
@@ -784,10 +784,11 @@ static void *
qpw_audio_init(Audiodev *dev)
{
g_autofree pwaudio *pw = g_new0(pwaudio, 1);
- pw_init(NULL, NULL);
- trace_pw_audio_init();
assert(dev->driver == AUDIODEV_DRIVER_PIPEWIRE);
+ trace_pw_audio_init();
+
+ pw_init(NULL, NULL);
pw->dev = dev;
pw->thread_loop = pw_thread_loop_new("PipeWire thread loop", NULL);
--
2.40.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 07/12] audio/pw: add more details on error
2023-05-06 16:37 [PATCH 00/12] audio: pipewire backend improvements marcandre.lureau
` (5 preceding siblings ...)
2023-05-06 16:37 ` [PATCH 06/12] audio/pw: trace during init before calling pipewire API marcandre.lureau
@ 2023-05-06 16:37 ` marcandre.lureau
2023-05-07 15:31 ` Volker Rümelin
2023-05-06 16:37 ` [PATCH 08/12] audio/pw: factorize some common code marcandre.lureau
` (4 subsequent siblings)
11 siblings, 1 reply; 26+ messages in thread
From: marcandre.lureau @ 2023-05-06 16:37 UTC (permalink / raw)
To: qemu-devel
Cc: Gerd Hoffmann, Wainer dos Santos Moschetta, Beraldo Leal,
Marc-André Lureau, Thomas Huth, Markus Armbruster,
Alex Bennée, Philippe Mathieu-Daudé, dbassey,
Daniel P. Berrangé, Eric Blake, Paolo Bonzini
From: Marc-André Lureau <marcandre.lureau@redhat.com>
PipeWire uses errno to report error details.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
audio/pwaudio.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/audio/pwaudio.c b/audio/pwaudio.c
index 2b12b40934..d0bc4680a6 100644
--- a/audio/pwaudio.c
+++ b/audio/pwaudio.c
@@ -750,6 +750,7 @@ static int wait_resync(pwaudio *pw)
}
return 0;
}
+
static void
on_core_error(void *data, uint32_t id, int seq, int res, const char *message)
{
@@ -793,19 +794,19 @@ qpw_audio_init(Audiodev *dev)
pw->dev = dev;
pw->thread_loop = pw_thread_loop_new("PipeWire thread loop", NULL);
if (pw->thread_loop == NULL) {
- error_report("Could not create PipeWire loop");
+ error_report("Could not create PipeWire loop: %s", g_strerror(errno));
goto fail;
}
pw->context =
pw_context_new(pw_thread_loop_get_loop(pw->thread_loop), NULL, 0);
if (pw->context == NULL) {
- error_report("Could not create PipeWire context");
+ error_report("Could not create PipeWire context: %s", g_strerror(errno));
goto fail;
}
if (pw_thread_loop_start(pw->thread_loop) < 0) {
- error_report("Could not start PipeWire loop");
+ error_report("Could not start PipeWire loop: %s", g_strerror(errno));
goto fail;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 08/12] audio/pw: factorize some common code
2023-05-06 16:37 [PATCH 00/12] audio: pipewire backend improvements marcandre.lureau
` (6 preceding siblings ...)
2023-05-06 16:37 ` [PATCH 07/12] audio/pw: add more details on error marcandre.lureau
@ 2023-05-06 16:37 ` marcandre.lureau
2023-05-07 15:07 ` Volker Rümelin
2023-05-06 16:37 ` [PATCH 09/12] audio/pw: add more error reporting marcandre.lureau
` (3 subsequent siblings)
11 siblings, 1 reply; 26+ messages in thread
From: marcandre.lureau @ 2023-05-06 16:37 UTC (permalink / raw)
To: qemu-devel
Cc: Gerd Hoffmann, Wainer dos Santos Moschetta, Beraldo Leal,
Marc-André Lureau, Thomas Huth, Markus Armbruster,
Alex Bennée, Philippe Mathieu-Daudé, dbassey,
Daniel P. Berrangé, Eric Blake, Paolo Bonzini
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
audio/pwaudio.c | 85 ++++++++++++++++++++-----------------------------
1 file changed, 34 insertions(+), 51 deletions(-)
diff --git a/audio/pwaudio.c b/audio/pwaudio.c
index d0bc4680a6..67df53948c 100644
--- a/audio/pwaudio.c
+++ b/audio/pwaudio.c
@@ -66,6 +66,9 @@ typedef struct PWVoiceIn {
PWVoice v;
} PWVoiceIn;
+#define PW_VOICE_IN(v) ((PWVoiceIn*)v)
+#define PW_VOICE_OUT(v) ((PWVoiceOut*)v)
+
static void
stream_destroy(void *data)
{
@@ -630,62 +633,55 @@ qpw_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
}
static void
-qpw_fini_out(HWVoiceOut *hw)
+qpw_voice_fini(PWVoice *v)
{
- PWVoiceOut *pw = (PWVoiceOut *) hw;
- PWVoice *v = &pw->v;
+ pwaudio *c = v->g;
- if (v->stream) {
- pwaudio *c = v->g;
- pw_thread_loop_lock(c->thread_loop);
- pw_stream_destroy(v->stream);
- v->stream = NULL;
- pw_thread_loop_unlock(c->thread_loop);
+ if (!v->stream) {
+ return;
}
+ pw_thread_loop_lock(c->thread_loop);
+ pw_stream_destroy(v->stream);
+ v->stream = NULL;
+ pw_thread_loop_unlock(c->thread_loop);
}
static void
-qpw_fini_in(HWVoiceIn *hw)
+qpw_fini_out(HWVoiceOut *hw)
{
- PWVoiceIn *pw = (PWVoiceIn *) hw;
- PWVoice *v = &pw->v;
+ qpw_voice_fini(&PW_VOICE_OUT(hw)->v);
+}
- if (v->stream) {
- pwaudio *c = v->g;
- pw_thread_loop_lock(c->thread_loop);
- pw_stream_destroy(v->stream);
- v->stream = NULL;
- pw_thread_loop_unlock(c->thread_loop);
- }
+static void
+qpw_fini_in(HWVoiceIn *hw)
+{
+ qpw_voice_fini(&PW_VOICE_IN(hw)->v);
}
static void
-qpw_enable_out(HWVoiceOut *hw, bool enable)
+qpw_voice_set_enabled(PWVoice *v, bool enable)
{
- PWVoiceOut *po = (PWVoiceOut *) hw;
- PWVoice *v = &po->v;
pwaudio *c = v->g;
pw_thread_loop_lock(c->thread_loop);
pw_stream_set_active(v->stream, enable);
pw_thread_loop_unlock(c->thread_loop);
}
+static void
+qpw_enable_out(HWVoiceOut *hw, bool enable)
+{
+ qpw_voice_set_enabled(&PW_VOICE_OUT(hw)->v, enable);
+}
+
static void
qpw_enable_in(HWVoiceIn *hw, bool enable)
{
- PWVoiceIn *pi = (PWVoiceIn *) hw;
- PWVoice *v = &pi->v;
- pwaudio *c = v->g;
- pw_thread_loop_lock(c->thread_loop);
- pw_stream_set_active(v->stream, enable);
- pw_thread_loop_unlock(c->thread_loop);
+ qpw_voice_set_enabled(&PW_VOICE_IN(hw)->v, enable);
}
static void
-qpw_volume_out(HWVoiceOut *hw, Volume *vol)
+qpw_voice_set_volume(PWVoice *v, Volume *vol)
{
- PWVoiceOut *pw = (PWVoiceOut *) hw;
- PWVoice *v = &pw->v;
pwaudio *c = v->g;
int i, ret;
@@ -707,28 +703,15 @@ qpw_volume_out(HWVoiceOut *hw, Volume *vol)
}
static void
-qpw_volume_in(HWVoiceIn *hw, Volume *vol)
+qpw_volume_out(HWVoiceOut *hw, Volume *vol)
{
- PWVoiceIn *pw = (PWVoiceIn *) hw;
- PWVoice *v = &pw->v;
- pwaudio *c = v->g;
- int i, ret;
-
- pw_thread_loop_lock(c->thread_loop);
- v->volume.channels = vol->channels;
-
- for (i = 0; i < vol->channels; ++i) {
- v->volume.values[i] = (float)vol->vol[i] / 255;
- }
-
- ret = pw_stream_set_control(v->stream,
- SPA_PROP_channelVolumes, v->volume.channels, v->volume.values, 0);
- trace_pw_vol(ret == 0 ? "success" : "failed");
+ qpw_voice_set_volume(&PW_VOICE_OUT(hw)->v, vol);
+}
- v->muted = vol->mute;
- float val = v->muted ? 1.f : 0.f;
- ret = pw_stream_set_control(v->stream, SPA_PROP_mute, 1, &val, 0);
- pw_thread_loop_unlock(c->thread_loop);
+static void
+qpw_volume_in(HWVoiceIn *hw, Volume *vol)
+{
+ qpw_voice_set_volume(&PW_VOICE_IN(hw)->v, vol);
}
static int wait_resync(pwaudio *pw)
--
2.40.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 09/12] audio/pw: add more error reporting
2023-05-06 16:37 [PATCH 00/12] audio: pipewire backend improvements marcandre.lureau
` (7 preceding siblings ...)
2023-05-06 16:37 ` [PATCH 08/12] audio/pw: factorize some common code marcandre.lureau
@ 2023-05-06 16:37 ` marcandre.lureau
2023-05-07 15:32 ` Volker Rümelin
2023-05-06 16:37 ` [PATCH 10/12] audio/pw: simplify error reporting in stream creation marcandre.lureau
` (2 subsequent siblings)
11 siblings, 1 reply; 26+ messages in thread
From: marcandre.lureau @ 2023-05-06 16:37 UTC (permalink / raw)
To: qemu-devel
Cc: Gerd Hoffmann, Wainer dos Santos Moschetta, Beraldo Leal,
Marc-André Lureau, Thomas Huth, Markus Armbruster,
Alex Bennée, Philippe Mathieu-Daudé, dbassey,
Daniel P. Berrangé, Eric Blake, Paolo Bonzini
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
audio/pwaudio.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/audio/pwaudio.c b/audio/pwaudio.c
index 67df53948c..5c706a9fde 100644
--- a/audio/pwaudio.c
+++ b/audio/pwaudio.c
@@ -429,6 +429,10 @@ create_stream(pwaudio *c, PWVoice *v, const char *stream_name,
struct pw_properties *props;
props = pw_properties_new(NULL, NULL);
+ if (!props) {
+ error_report("Failed to create PW properties: %s", g_strerror(errno));
+ return -1;
+ }
/* 75% of the timer period for faster updates */
buf_samples = (uint64_t)v->g->dev->timer_period * v->info.rate
@@ -441,8 +445,8 @@ create_stream(pwaudio *c, PWVoice *v, const char *stream_name,
pw_properties_set(props, PW_KEY_TARGET_OBJECT, name);
}
v->stream = pw_stream_new(c->core, stream_name, props);
-
if (v->stream == NULL) {
+ error_report("Failed to create PW stream: %s", g_strerror(errno));
return -1;
}
@@ -470,6 +474,7 @@ create_stream(pwaudio *c, PWVoice *v, const char *stream_name,
PW_STREAM_FLAG_MAP_BUFFERS |
PW_STREAM_FLAG_RT_PROCESS, params, n_params);
if (res < 0) {
+ error_report("Failed to connect PW stream: %s", g_strerror(errno));
pw_stream_destroy(v->stream);
return -1;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 10/12] audio/pw: simplify error reporting in stream creation
2023-05-06 16:37 [PATCH 00/12] audio: pipewire backend improvements marcandre.lureau
` (8 preceding siblings ...)
2023-05-06 16:37 ` [PATCH 09/12] audio/pw: add more error reporting marcandre.lureau
@ 2023-05-06 16:37 ` marcandre.lureau
2023-05-07 15:33 ` Volker Rümelin
2023-05-06 16:37 ` [PATCH 11/12] audio/pw: remove wrong comment marcandre.lureau
2023-05-06 16:37 ` [PATCH 12/12] audio/pw: improve channel position code marcandre.lureau
11 siblings, 1 reply; 26+ messages in thread
From: marcandre.lureau @ 2023-05-06 16:37 UTC (permalink / raw)
To: qemu-devel
Cc: Gerd Hoffmann, Wainer dos Santos Moschetta, Beraldo Leal,
Marc-André Lureau, Thomas Huth, Markus Armbruster,
Alex Bennée, Philippe Mathieu-Daudé, dbassey,
Daniel P. Berrangé, Eric Blake, Paolo Bonzini
From: Marc-André Lureau <marcandre.lureau@redhat.com>
create_stream() now reports on all error paths.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
audio/pwaudio.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/audio/pwaudio.c b/audio/pwaudio.c
index 5c706a9fde..38905f5be2 100644
--- a/audio/pwaudio.c
+++ b/audio/pwaudio.c
@@ -486,8 +486,6 @@ static int
qpw_stream_new(pwaudio *c, PWVoice *v, const char *stream_name,
const char *name, enum spa_direction dir)
{
- int r;
-
switch (v->info.channels) {
case 8:
v->info.position[0] = SPA_AUDIO_CHANNEL_FL;
@@ -540,13 +538,7 @@ qpw_stream_new(pwaudio *c, PWVoice *v, const char *stream_name,
}
/* create a new unconnected pwstream */
- r = create_stream(c, v, stream_name, name, dir);
- if (r < 0) {
- AUD_log(AUDIO_CAP, "Failed to create stream.");
- return -1;
- }
-
- return r;
+ return create_stream(c, v, stream_name, name, dir);
}
static int
@@ -577,7 +569,6 @@ qpw_init_out(HWVoiceOut *hw, struct audsettings *as, void *drv_opaque)
r = qpw_stream_new(c, v, ppdo->stream_name ? : c->dev->id,
ppdo->name, SPA_DIRECTION_OUTPUT);
if (r < 0) {
- error_report("qpw_stream_new for playback failed");
pw_thread_loop_unlock(c->thread_loop);
return -1;
}
@@ -621,7 +612,6 @@ qpw_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
r = qpw_stream_new(c, v, ppdo->stream_name ? : c->dev->id,
ppdo->name, SPA_DIRECTION_INPUT);
if (r < 0) {
- error_report("qpw_stream_new for recording failed");
pw_thread_loop_unlock(c->thread_loop);
return -1;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 11/12] audio/pw: remove wrong comment
2023-05-06 16:37 [PATCH 00/12] audio: pipewire backend improvements marcandre.lureau
` (9 preceding siblings ...)
2023-05-06 16:37 ` [PATCH 10/12] audio/pw: simplify error reporting in stream creation marcandre.lureau
@ 2023-05-06 16:37 ` marcandre.lureau
2023-05-07 15:11 ` Volker Rümelin
2023-05-06 16:37 ` [PATCH 12/12] audio/pw: improve channel position code marcandre.lureau
11 siblings, 1 reply; 26+ messages in thread
From: marcandre.lureau @ 2023-05-06 16:37 UTC (permalink / raw)
To: qemu-devel
Cc: Gerd Hoffmann, Wainer dos Santos Moschetta, Beraldo Leal,
Marc-André Lureau, Thomas Huth, Markus Armbruster,
Alex Bennée, Philippe Mathieu-Daudé, dbassey,
Daniel P. Berrangé, Eric Blake, Paolo Bonzini
From: Marc-André Lureau <marcandre.lureau@redhat.com>
The stream is actually created connected.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
audio/pwaudio.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/audio/pwaudio.c b/audio/pwaudio.c
index 38905f5be2..f74d506ec6 100644
--- a/audio/pwaudio.c
+++ b/audio/pwaudio.c
@@ -537,7 +537,6 @@ qpw_stream_new(pwaudio *c, PWVoice *v, const char *stream_name,
break;
}
- /* create a new unconnected pwstream */
return create_stream(c, v, stream_name, name, dir);
}
--
2.40.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 12/12] audio/pw: improve channel position code
2023-05-06 16:37 [PATCH 00/12] audio: pipewire backend improvements marcandre.lureau
` (10 preceding siblings ...)
2023-05-06 16:37 ` [PATCH 11/12] audio/pw: remove wrong comment marcandre.lureau
@ 2023-05-06 16:37 ` marcandre.lureau
2023-05-07 15:13 ` Volker Rümelin
11 siblings, 1 reply; 26+ messages in thread
From: marcandre.lureau @ 2023-05-06 16:37 UTC (permalink / raw)
To: qemu-devel
Cc: Gerd Hoffmann, Wainer dos Santos Moschetta, Beraldo Leal,
Marc-André Lureau, Thomas Huth, Markus Armbruster,
Alex Bennée, Philippe Mathieu-Daudé, dbassey,
Daniel P. Berrangé, Eric Blake, Paolo Bonzini
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Follow PulseAudio backend comment and code, and only implement the
channels QEMU actually supports at this point, and add the same comment
about limits and future mappings. Simplify a bit the code.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
audio/pwaudio.c | 75 +++++++++++++++++--------------------------------
1 file changed, 26 insertions(+), 49 deletions(-)
diff --git a/audio/pwaudio.c b/audio/pwaudio.c
index f74d506ec6..062610a704 100644
--- a/audio/pwaudio.c
+++ b/audio/pwaudio.c
@@ -417,8 +417,8 @@ pw_to_audfmt(enum spa_audio_format fmt, int *endianness,
}
static int
-create_stream(pwaudio *c, PWVoice *v, const char *stream_name,
- const char *name, enum spa_direction dir)
+qpw_stream_new(pwaudio *c, PWVoice *v, const char *stream_name,
+ const char *name, enum spa_direction dir)
{
int res;
uint32_t n_params;
@@ -482,62 +482,37 @@ create_stream(pwaudio *c, PWVoice *v, const char *stream_name,
return 0;
}
-static int
-qpw_stream_new(pwaudio *c, PWVoice *v, const char *stream_name,
- const char *name, enum spa_direction dir)
+static void
+qpw_set_position(uint32_t channels, uint32_t position[SPA_AUDIO_MAX_CHANNELS])
{
- switch (v->info.channels) {
+ memcpy(position, (uint32_t[SPA_AUDIO_MAX_CHANNELS]) { SPA_AUDIO_CHANNEL_UNKNOWN, },
+ sizeof(uint32_t) * SPA_AUDIO_MAX_CHANNELS);
+ /*
+ * TODO: This currently expects the only frontend supporting more than 2
+ * channels is the usb-audio. We will need some means to set channel
+ * order when a new frontend gains multi-channel support.
+ */
+ switch (channels) {
case 8:
- v->info.position[0] = SPA_AUDIO_CHANNEL_FL;
- v->info.position[1] = SPA_AUDIO_CHANNEL_FR;
- v->info.position[2] = SPA_AUDIO_CHANNEL_FC;
- v->info.position[3] = SPA_AUDIO_CHANNEL_LFE;
- v->info.position[4] = SPA_AUDIO_CHANNEL_RL;
- v->info.position[5] = SPA_AUDIO_CHANNEL_RR;
- v->info.position[6] = SPA_AUDIO_CHANNEL_SL;
- v->info.position[7] = SPA_AUDIO_CHANNEL_SR;
- break;
+ position[6] = SPA_AUDIO_CHANNEL_SL;
+ position[7] = SPA_AUDIO_CHANNEL_SR;
+ /* fallthrough */
case 6:
- v->info.position[0] = SPA_AUDIO_CHANNEL_FL;
- v->info.position[1] = SPA_AUDIO_CHANNEL_FR;
- v->info.position[2] = SPA_AUDIO_CHANNEL_FC;
- v->info.position[3] = SPA_AUDIO_CHANNEL_LFE;
- v->info.position[4] = SPA_AUDIO_CHANNEL_RL;
- v->info.position[5] = SPA_AUDIO_CHANNEL_RR;
- break;
- case 5:
- v->info.position[0] = SPA_AUDIO_CHANNEL_FL;
- v->info.position[1] = SPA_AUDIO_CHANNEL_FR;
- v->info.position[2] = SPA_AUDIO_CHANNEL_FC;
- v->info.position[3] = SPA_AUDIO_CHANNEL_LFE;
- v->info.position[4] = SPA_AUDIO_CHANNEL_RC;
- break;
- case 4:
- v->info.position[0] = SPA_AUDIO_CHANNEL_FL;
- v->info.position[1] = SPA_AUDIO_CHANNEL_FR;
- v->info.position[2] = SPA_AUDIO_CHANNEL_FC;
- v->info.position[3] = SPA_AUDIO_CHANNEL_RC;
- break;
- case 3:
- v->info.position[0] = SPA_AUDIO_CHANNEL_FL;
- v->info.position[1] = SPA_AUDIO_CHANNEL_FR;
- v->info.position[2] = SPA_AUDIO_CHANNEL_LFE;
- break;
+ position[2] = SPA_AUDIO_CHANNEL_FC;
+ position[3] = SPA_AUDIO_CHANNEL_LFE;
+ position[4] = SPA_AUDIO_CHANNEL_RL;
+ position[5] = SPA_AUDIO_CHANNEL_RR;
+ /* fallthrough */
case 2:
- v->info.position[0] = SPA_AUDIO_CHANNEL_FL;
- v->info.position[1] = SPA_AUDIO_CHANNEL_FR;
+ position[0] = SPA_AUDIO_CHANNEL_FL;
+ position[1] = SPA_AUDIO_CHANNEL_FR;
break;
case 1:
- v->info.position[0] = SPA_AUDIO_CHANNEL_MONO;
+ position[0] = SPA_AUDIO_CHANNEL_MONO;
break;
default:
- for (size_t i = 0; i < v->info.channels; i++) {
- v->info.position[i] = SPA_AUDIO_CHANNEL_UNKNOWN;
- }
- break;
+ dolog("Internal error: unsupported channel count %d\n", channels);
}
-
- return create_stream(c, v, stream_name, name, dir);
}
static int
@@ -555,6 +530,7 @@ qpw_init_out(HWVoiceOut *hw, struct audsettings *as, void *drv_opaque)
v->info.format = audfmt_to_pw(as->fmt, as->endianness);
v->info.channels = as->nchannels;
+ qpw_set_position(as->nchannels, v->info.position);
v->info.rate = as->freq;
obt_as.fmt =
@@ -601,6 +577,7 @@ qpw_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
v->info.format = audfmt_to_pw(as->fmt, as->endianness);
v->info.channels = as->nchannels;
+ qpw_set_position(as->nchannels, v->info.position);
v->info.rate = as->freq;
obt_as.fmt =
--
2.40.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH 03/12] audio/pw: Pipewire->PipeWire case fix for user-visible text
2023-05-06 16:37 ` [PATCH 03/12] audio/pw: Pipewire->PipeWire case fix for user-visible text marcandre.lureau
@ 2023-05-07 14:56 ` Volker Rümelin
2023-05-10 7:36 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 26+ messages in thread
From: Volker Rümelin @ 2023-05-07 14:56 UTC (permalink / raw)
To: marcandre.lureau, Gerd Hoffmann, Paolo Bonzini,
Daniel P. Berrangé, Thomas Huth, Philippe Mathieu-Daudé,
Eric Blake, Markus Armbruster
Cc: dbassey, qemu-devel
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> "PipeWire" is the correct case.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> meson.build | 2 +-
> qapi/audio.json | 12 ++++++------
> audio/pwaudio.c | 10 +++++-----
> audio/trace-events | 2 +-
> meson_options.txt | 2 +-
> qemu-options.hx | 4 ++--
> scripts/meson-buildoptions.sh | 2 +-
> 7 files changed, 17 insertions(+), 17 deletions(-)
Reviewed-by: Volker Rümelin <vr_qemu@t-online.de>
> diff --git a/meson.build b/meson.build
> index 229eb585f7..4c44736bd4 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -3988,7 +3988,7 @@ if targetos == 'linux'
> summary_info += {'ALSA support': alsa}
> summary_info += {'PulseAudio support': pulse}
> endif
> -summary_info += {'Pipewire support': pipewire}
> +summary_info += {'PipeWire support': pipewire}
> summary_info += {'JACK support': jack}
> summary_info += {'brlapi support': brlapi}
> summary_info += {'vde support': vde}
> diff --git a/qapi/audio.json b/qapi/audio.json
> index e03396a7bc..b5c1af2b91 100644
> --- a/qapi/audio.json
> +++ b/qapi/audio.json
> @@ -327,17 +327,17 @@
> ##
> # @AudiodevPipewirePerDirectionOptions:
> #
> -# Options of the Pipewire backend that are used for both playback and
> +# Options of the PipeWire backend that are used for both playback and
> # recording.
> #
> # @name: name of the sink/source to use
> #
> -# @stream-name: name of the Pipewire stream created by qemu. Can be
> -# used to identify the stream in Pipewire when you
> -# create multiple Pipewire devices or run multiple qemu
> +# @stream-name: name of the PipeWire stream created by qemu. Can be
> +# used to identify the stream in PipeWire when you
> +# create multiple PipeWire devices or run multiple qemu
> # instances (default: audiodev's id)
> #
> -# @latency: latency you want Pipewire to achieve in microseconds
> +# @latency: latency you want PipeWire to achieve in microseconds
> # (default 46000)
> #
> # Since: 8.1
> @@ -352,7 +352,7 @@
> ##
> # @AudiodevPipewireOptions:
> #
> -# Options of the Pipewire audio backend.
> +# Options of the PipeWire audio backend.
> #
> # @in: options of the capture stream
> #
> diff --git a/audio/pwaudio.c b/audio/pwaudio.c
> index 1d108bdebb..9eb69bfd18 100644
> --- a/audio/pwaudio.c
> +++ b/audio/pwaudio.c
> @@ -1,5 +1,5 @@
> /*
> - * QEMU Pipewire audio driver
> + * QEMU PipeWire audio driver
> *
> * Copyright (c) 2023 Red Hat Inc.
> *
> @@ -800,21 +800,21 @@ qpw_audio_init(Audiodev *dev)
> assert(dev->driver == AUDIODEV_DRIVER_PIPEWIRE);
>
> pw->dev = dev;
> - pw->thread_loop = pw_thread_loop_new("Pipewire thread loop", NULL);
> + pw->thread_loop = pw_thread_loop_new("PipeWire thread loop", NULL);
> if (pw->thread_loop == NULL) {
> - error_report("Could not create Pipewire loop");
> + error_report("Could not create PipeWire loop");
> goto fail;
> }
>
> pw->context =
> pw_context_new(pw_thread_loop_get_loop(pw->thread_loop), NULL, 0);
> if (pw->context == NULL) {
> - error_report("Could not create Pipewire context");
> + error_report("Could not create PipeWire context");
> goto fail;
> }
>
> if (pw_thread_loop_start(pw->thread_loop) < 0) {
> - error_report("Could not start Pipewire loop");
> + error_report("Could not start PipeWire loop");
> goto fail;
> }
>
> diff --git a/audio/trace-events b/audio/trace-events
> index 85dbb506b2..ab04f020ce 100644
> --- a/audio/trace-events
> +++ b/audio/trace-events
> @@ -24,7 +24,7 @@ pw_read(int32_t avail, uint32_t index, size_t len) "avail=%d index=%u len=%zu"
> pw_write(int32_t filled, int32_t avail, uint32_t index, size_t len) "filled=%d avail=%d index=%u len=%zu"
> pw_vol(const char *ret) "set volume: %s"
> pw_period(uint64_t quantum, uint32_t rate) "period =%" PRIu64 "/%u"
> -pw_audio_init(void) "Initialize Pipewire context"
> +pw_audio_init(void) "Initialize PipeWire context"
>
> # audio.c
> audio_timer_start(int interval) "interval %d ms"
> diff --git a/meson_options.txt b/meson_options.txt
> index ae2017702a..8dd786c1a4 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -256,7 +256,7 @@ option('oss', type: 'feature', value: 'auto',
> option('pa', type: 'feature', value: 'auto',
> description: 'PulseAudio sound support')
> option('pipewire', type: 'feature', value: 'auto',
> - description: 'Pipewire sound support')
> + description: 'PipeWire sound support')
> option('sndio', type: 'feature', value: 'auto',
> description: 'sndio sound support')
>
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 42b9094c10..be7317d455 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -963,10 +963,10 @@ SRST
> to honor this value but actual latencies may be lower or higher.
>
> ``-audiodev pipewire,id=id[,prop[=value][,...]]``
> - Creates a backend using Pipewire. This backend is available on
> + Creates a backend using PipeWire. This backend is available on
> most systems.
>
> - Pipewire specific options are:
> + PipeWire specific options are:
>
> ``in|out.latency=usecs``
> Desired latency in microseconds.
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index 0e888e6ecd..ba697207f4 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -137,7 +137,7 @@ meson_options_help() {
> printf "%s\n" ' oss OSS sound support'
> printf "%s\n" ' pa PulseAudio sound support'
> printf "%s\n" ' parallels parallels image format support'
> - printf "%s\n" ' pipewire Pipewire sound support'
> + printf "%s\n" ' pipewire PipeWire sound support'
> printf "%s\n" ' png PNG support with libpng'
> printf "%s\n" ' pvrdma Enable PVRDMA support'
> printf "%s\n" ' qcow1 qcow1 image format support'
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 04/12] audio/pw: drop needless case statement
2023-05-06 16:37 ` [PATCH 04/12] audio/pw: drop needless case statement marcandre.lureau
@ 2023-05-07 14:58 ` Volker Rümelin
0 siblings, 0 replies; 26+ messages in thread
From: Volker Rümelin @ 2023-05-07 14:58 UTC (permalink / raw)
To: marcandre.lureau, Gerd Hoffmann; +Cc: dbassey, qemu-devel
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> audio/pwaudio.c | 10 ----------
> 1 file changed, 10 deletions(-)
Reviewed-by: Volker Rümelin <vr_qemu@t-online.de>
> diff --git a/audio/pwaudio.c b/audio/pwaudio.c
> index 9eb69bfd18..51cfc0b052 100644
> --- a/audio/pwaudio.c
> +++ b/audio/pwaudio.c
> @@ -197,16 +197,6 @@ on_stream_state_changed(void *data, enum pw_stream_state old,
>
> trace_pw_state_changed(pw_stream_get_node_id(v->stream),
> pw_stream_state_as_string(state));
> -
> - switch (state) {
> - case PW_STREAM_STATE_ERROR:
> - case PW_STREAM_STATE_UNCONNECTED:
> - break;
> - case PW_STREAM_STATE_PAUSED:
> - case PW_STREAM_STATE_CONNECTING:
> - case PW_STREAM_STATE_STREAMING:
> - break;
> - }
> }
>
> static const struct pw_stream_events capture_stream_events = {
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 05/12] audio/pw: needless check for NULL
2023-05-06 16:37 ` [PATCH 05/12] audio/pw: needless check for NULL marcandre.lureau
@ 2023-05-07 15:01 ` Volker Rümelin
0 siblings, 0 replies; 26+ messages in thread
From: Volker Rümelin @ 2023-05-07 15:01 UTC (permalink / raw)
To: marcandre.lureau, Gerd Hoffmann; +Cc: dbassey, qemu-devel
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> g_clear_pointer() already checks for NULL.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> audio/pwaudio.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
Reviewed-by: Volker Rümelin <vr_qemu@t-online.de>
> diff --git a/audio/pwaudio.c b/audio/pwaudio.c
> index 51cfc0b052..6ca4ef4f62 100644
> --- a/audio/pwaudio.c
> +++ b/audio/pwaudio.c
> @@ -834,12 +834,8 @@ fail:
> if (pw->thread_loop) {
> pw_thread_loop_stop(pw->thread_loop);
> }
> - if (pw->context) {
> - g_clear_pointer(&pw->context, pw_context_destroy);
> - }
> - if (pw->thread_loop) {
> - g_clear_pointer(&pw->thread_loop, pw_thread_loop_destroy);
> - }
> + g_clear_pointer(&pw->context, pw_context_destroy);
> + g_clear_pointer(&pw->thread_loop, pw_thread_loop_destroy);
> return NULL;
> }
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 06/12] audio/pw: trace during init before calling pipewire API
2023-05-06 16:37 ` [PATCH 06/12] audio/pw: trace during init before calling pipewire API marcandre.lureau
@ 2023-05-07 15:03 ` Volker Rümelin
2023-05-10 7:37 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 26+ messages in thread
From: Volker Rümelin @ 2023-05-07 15:03 UTC (permalink / raw)
To: marcandre.lureau, Gerd Hoffmann; +Cc: dbassey, qemu-devel
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> audio/pwaudio.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Reviewed-by: Volker Rümelin <vr_qemu@t-online.de>
> diff --git a/audio/pwaudio.c b/audio/pwaudio.c
> index 6ca4ef4f62..2b12b40934 100644
> --- a/audio/pwaudio.c
> +++ b/audio/pwaudio.c
> @@ -784,10 +784,11 @@ static void *
> qpw_audio_init(Audiodev *dev)
> {
> g_autofree pwaudio *pw = g_new0(pwaudio, 1);
> - pw_init(NULL, NULL);
>
> - trace_pw_audio_init();
> assert(dev->driver == AUDIODEV_DRIVER_PIPEWIRE);
> + trace_pw_audio_init();
> +
> + pw_init(NULL, NULL);
>
> pw->dev = dev;
> pw->thread_loop = pw_thread_loop_new("PipeWire thread loop", NULL);
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 08/12] audio/pw: factorize some common code
2023-05-06 16:37 ` [PATCH 08/12] audio/pw: factorize some common code marcandre.lureau
@ 2023-05-07 15:07 ` Volker Rümelin
0 siblings, 0 replies; 26+ messages in thread
From: Volker Rümelin @ 2023-05-07 15:07 UTC (permalink / raw)
To: marcandre.lureau, Gerd Hoffmann; +Cc: dbassey, qemu-devel
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> audio/pwaudio.c | 85 ++++++++++++++++++++-----------------------------
> 1 file changed, 34 insertions(+), 51 deletions(-)
Reviewed-by: Volker Rümelin <vr_qemu@t-online.de>
> diff --git a/audio/pwaudio.c b/audio/pwaudio.c
> index d0bc4680a6..67df53948c 100644
> --- a/audio/pwaudio.c
> +++ b/audio/pwaudio.c
> @@ -66,6 +66,9 @@ typedef struct PWVoiceIn {
> PWVoice v;
> } PWVoiceIn;
>
> +#define PW_VOICE_IN(v) ((PWVoiceIn*)v)
> +#define PW_VOICE_OUT(v) ((PWVoiceOut*)v)
> +
> static void
> stream_destroy(void *data)
> {
> @@ -630,62 +633,55 @@ qpw_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
> }
>
> static void
> -qpw_fini_out(HWVoiceOut *hw)
> +qpw_voice_fini(PWVoice *v)
> {
> - PWVoiceOut *pw = (PWVoiceOut *) hw;
> - PWVoice *v = &pw->v;
> + pwaudio *c = v->g;
>
> - if (v->stream) {
> - pwaudio *c = v->g;
> - pw_thread_loop_lock(c->thread_loop);
> - pw_stream_destroy(v->stream);
> - v->stream = NULL;
> - pw_thread_loop_unlock(c->thread_loop);
> + if (!v->stream) {
> + return;
> }
> + pw_thread_loop_lock(c->thread_loop);
> + pw_stream_destroy(v->stream);
> + v->stream = NULL;
> + pw_thread_loop_unlock(c->thread_loop);
> }
>
> static void
> -qpw_fini_in(HWVoiceIn *hw)
> +qpw_fini_out(HWVoiceOut *hw)
> {
> - PWVoiceIn *pw = (PWVoiceIn *) hw;
> - PWVoice *v = &pw->v;
> + qpw_voice_fini(&PW_VOICE_OUT(hw)->v);
> +}
>
> - if (v->stream) {
> - pwaudio *c = v->g;
> - pw_thread_loop_lock(c->thread_loop);
> - pw_stream_destroy(v->stream);
> - v->stream = NULL;
> - pw_thread_loop_unlock(c->thread_loop);
> - }
> +static void
> +qpw_fini_in(HWVoiceIn *hw)
> +{
> + qpw_voice_fini(&PW_VOICE_IN(hw)->v);
> }
>
> static void
> -qpw_enable_out(HWVoiceOut *hw, bool enable)
> +qpw_voice_set_enabled(PWVoice *v, bool enable)
> {
> - PWVoiceOut *po = (PWVoiceOut *) hw;
> - PWVoice *v = &po->v;
> pwaudio *c = v->g;
> pw_thread_loop_lock(c->thread_loop);
> pw_stream_set_active(v->stream, enable);
> pw_thread_loop_unlock(c->thread_loop);
> }
>
> +static void
> +qpw_enable_out(HWVoiceOut *hw, bool enable)
> +{
> + qpw_voice_set_enabled(&PW_VOICE_OUT(hw)->v, enable);
> +}
> +
> static void
> qpw_enable_in(HWVoiceIn *hw, bool enable)
> {
> - PWVoiceIn *pi = (PWVoiceIn *) hw;
> - PWVoice *v = &pi->v;
> - pwaudio *c = v->g;
> - pw_thread_loop_lock(c->thread_loop);
> - pw_stream_set_active(v->stream, enable);
> - pw_thread_loop_unlock(c->thread_loop);
> + qpw_voice_set_enabled(&PW_VOICE_IN(hw)->v, enable);
> }
>
> static void
> -qpw_volume_out(HWVoiceOut *hw, Volume *vol)
> +qpw_voice_set_volume(PWVoice *v, Volume *vol)
> {
> - PWVoiceOut *pw = (PWVoiceOut *) hw;
> - PWVoice *v = &pw->v;
> pwaudio *c = v->g;
> int i, ret;
>
> @@ -707,28 +703,15 @@ qpw_volume_out(HWVoiceOut *hw, Volume *vol)
> }
>
> static void
> -qpw_volume_in(HWVoiceIn *hw, Volume *vol)
> +qpw_volume_out(HWVoiceOut *hw, Volume *vol)
> {
> - PWVoiceIn *pw = (PWVoiceIn *) hw;
> - PWVoice *v = &pw->v;
> - pwaudio *c = v->g;
> - int i, ret;
> -
> - pw_thread_loop_lock(c->thread_loop);
> - v->volume.channels = vol->channels;
> -
> - for (i = 0; i < vol->channels; ++i) {
> - v->volume.values[i] = (float)vol->vol[i] / 255;
> - }
> -
> - ret = pw_stream_set_control(v->stream,
> - SPA_PROP_channelVolumes, v->volume.channels, v->volume.values, 0);
> - trace_pw_vol(ret == 0 ? "success" : "failed");
> + qpw_voice_set_volume(&PW_VOICE_OUT(hw)->v, vol);
> +}
>
> - v->muted = vol->mute;
> - float val = v->muted ? 1.f : 0.f;
> - ret = pw_stream_set_control(v->stream, SPA_PROP_mute, 1, &val, 0);
> - pw_thread_loop_unlock(c->thread_loop);
> +static void
> +qpw_volume_in(HWVoiceIn *hw, Volume *vol)
> +{
> + qpw_voice_set_volume(&PW_VOICE_IN(hw)->v, vol);
> }
>
> static int wait_resync(pwaudio *pw)
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 11/12] audio/pw: remove wrong comment
2023-05-06 16:37 ` [PATCH 11/12] audio/pw: remove wrong comment marcandre.lureau
@ 2023-05-07 15:11 ` Volker Rümelin
0 siblings, 0 replies; 26+ messages in thread
From: Volker Rümelin @ 2023-05-07 15:11 UTC (permalink / raw)
To: marcandre.lureau, Gerd Hoffmann; +Cc: dbassey, qemu-devel
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> The stream is actually created connected.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> audio/pwaudio.c | 1 -
> 1 file changed, 1 deletion(-)
Reviewed-by: Volker Rümelin <vr_qemu@t-online.de>
> diff --git a/audio/pwaudio.c b/audio/pwaudio.c
> index 38905f5be2..f74d506ec6 100644
> --- a/audio/pwaudio.c
> +++ b/audio/pwaudio.c
> @@ -537,7 +537,6 @@ qpw_stream_new(pwaudio *c, PWVoice *v, const char *stream_name,
> break;
> }
>
> - /* create a new unconnected pwstream */
> return create_stream(c, v, stream_name, name, dir);
> }
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 12/12] audio/pw: improve channel position code
2023-05-06 16:37 ` [PATCH 12/12] audio/pw: improve channel position code marcandre.lureau
@ 2023-05-07 15:13 ` Volker Rümelin
0 siblings, 0 replies; 26+ messages in thread
From: Volker Rümelin @ 2023-05-07 15:13 UTC (permalink / raw)
To: marcandre.lureau, Gerd Hoffmann; +Cc: dbassey, qemu-devel
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Follow PulseAudio backend comment and code, and only implement the
> channels QEMU actually supports at this point, and add the same comment
> about limits and future mappings. Simplify a bit the code.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> audio/pwaudio.c | 75 +++++++++++++++++--------------------------------
> 1 file changed, 26 insertions(+), 49 deletions(-)
Reviewed-by: Volker Rümelin <vr_qemu@t-online.de>
> diff --git a/audio/pwaudio.c b/audio/pwaudio.c
> index f74d506ec6..062610a704 100644
> --- a/audio/pwaudio.c
> +++ b/audio/pwaudio.c
> @@ -417,8 +417,8 @@ pw_to_audfmt(enum spa_audio_format fmt, int *endianness,
> }
>
> static int
> -create_stream(pwaudio *c, PWVoice *v, const char *stream_name,
> - const char *name, enum spa_direction dir)
> +qpw_stream_new(pwaudio *c, PWVoice *v, const char *stream_name,
> + const char *name, enum spa_direction dir)
> {
> int res;
> uint32_t n_params;
> @@ -482,62 +482,37 @@ create_stream(pwaudio *c, PWVoice *v, const char *stream_name,
> return 0;
> }
>
> -static int
> -qpw_stream_new(pwaudio *c, PWVoice *v, const char *stream_name,
> - const char *name, enum spa_direction dir)
> +static void
> +qpw_set_position(uint32_t channels, uint32_t position[SPA_AUDIO_MAX_CHANNELS])
> {
> - switch (v->info.channels) {
> + memcpy(position, (uint32_t[SPA_AUDIO_MAX_CHANNELS]) { SPA_AUDIO_CHANNEL_UNKNOWN, },
> + sizeof(uint32_t) * SPA_AUDIO_MAX_CHANNELS);
> + /*
> + * TODO: This currently expects the only frontend supporting more than 2
> + * channels is the usb-audio. We will need some means to set channel
> + * order when a new frontend gains multi-channel support.
> + */
> + switch (channels) {
> case 8:
> - v->info.position[0] = SPA_AUDIO_CHANNEL_FL;
> - v->info.position[1] = SPA_AUDIO_CHANNEL_FR;
> - v->info.position[2] = SPA_AUDIO_CHANNEL_FC;
> - v->info.position[3] = SPA_AUDIO_CHANNEL_LFE;
> - v->info.position[4] = SPA_AUDIO_CHANNEL_RL;
> - v->info.position[5] = SPA_AUDIO_CHANNEL_RR;
> - v->info.position[6] = SPA_AUDIO_CHANNEL_SL;
> - v->info.position[7] = SPA_AUDIO_CHANNEL_SR;
> - break;
> + position[6] = SPA_AUDIO_CHANNEL_SL;
> + position[7] = SPA_AUDIO_CHANNEL_SR;
> + /* fallthrough */
> case 6:
> - v->info.position[0] = SPA_AUDIO_CHANNEL_FL;
> - v->info.position[1] = SPA_AUDIO_CHANNEL_FR;
> - v->info.position[2] = SPA_AUDIO_CHANNEL_FC;
> - v->info.position[3] = SPA_AUDIO_CHANNEL_LFE;
> - v->info.position[4] = SPA_AUDIO_CHANNEL_RL;
> - v->info.position[5] = SPA_AUDIO_CHANNEL_RR;
> - break;
> - case 5:
> - v->info.position[0] = SPA_AUDIO_CHANNEL_FL;
> - v->info.position[1] = SPA_AUDIO_CHANNEL_FR;
> - v->info.position[2] = SPA_AUDIO_CHANNEL_FC;
> - v->info.position[3] = SPA_AUDIO_CHANNEL_LFE;
> - v->info.position[4] = SPA_AUDIO_CHANNEL_RC;
> - break;
> - case 4:
> - v->info.position[0] = SPA_AUDIO_CHANNEL_FL;
> - v->info.position[1] = SPA_AUDIO_CHANNEL_FR;
> - v->info.position[2] = SPA_AUDIO_CHANNEL_FC;
> - v->info.position[3] = SPA_AUDIO_CHANNEL_RC;
> - break;
> - case 3:
> - v->info.position[0] = SPA_AUDIO_CHANNEL_FL;
> - v->info.position[1] = SPA_AUDIO_CHANNEL_FR;
> - v->info.position[2] = SPA_AUDIO_CHANNEL_LFE;
> - break;
> + position[2] = SPA_AUDIO_CHANNEL_FC;
> + position[3] = SPA_AUDIO_CHANNEL_LFE;
> + position[4] = SPA_AUDIO_CHANNEL_RL;
> + position[5] = SPA_AUDIO_CHANNEL_RR;
> + /* fallthrough */
> case 2:
> - v->info.position[0] = SPA_AUDIO_CHANNEL_FL;
> - v->info.position[1] = SPA_AUDIO_CHANNEL_FR;
> + position[0] = SPA_AUDIO_CHANNEL_FL;
> + position[1] = SPA_AUDIO_CHANNEL_FR;
> break;
> case 1:
> - v->info.position[0] = SPA_AUDIO_CHANNEL_MONO;
> + position[0] = SPA_AUDIO_CHANNEL_MONO;
> break;
> default:
> - for (size_t i = 0; i < v->info.channels; i++) {
> - v->info.position[i] = SPA_AUDIO_CHANNEL_UNKNOWN;
> - }
> - break;
> + dolog("Internal error: unsupported channel count %d\n", channels);
> }
> -
> - return create_stream(c, v, stream_name, name, dir);
> }
>
> static int
> @@ -555,6 +530,7 @@ qpw_init_out(HWVoiceOut *hw, struct audsettings *as, void *drv_opaque)
>
> v->info.format = audfmt_to_pw(as->fmt, as->endianness);
> v->info.channels = as->nchannels;
> + qpw_set_position(as->nchannels, v->info.position);
> v->info.rate = as->freq;
>
> obt_as.fmt =
> @@ -601,6 +577,7 @@ qpw_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
>
> v->info.format = audfmt_to_pw(as->fmt, as->endianness);
> v->info.channels = as->nchannels;
> + qpw_set_position(as->nchannels, v->info.position);
> v->info.rate = as->freq;
>
> obt_as.fmt =
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 07/12] audio/pw: add more details on error
2023-05-06 16:37 ` [PATCH 07/12] audio/pw: add more details on error marcandre.lureau
@ 2023-05-07 15:31 ` Volker Rümelin
0 siblings, 0 replies; 26+ messages in thread
From: Volker Rümelin @ 2023-05-07 15:31 UTC (permalink / raw)
To: marcandre.lureau, Gerd Hoffmann; +Cc: dbassey, qemu-devel
> From: Marc-André Lureau<marcandre.lureau@redhat.com>
>
> PipeWire uses errno to report error details.
>
> Signed-off-by: Marc-André Lureau<marcandre.lureau@redhat.com>
> ---
> audio/pwaudio.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
Reviewed-by: Volker Rümelin <vr_qemu@t-online.de>
> diff --git a/audio/pwaudio.c b/audio/pwaudio.c
> index 2b12b40934..d0bc4680a6 100644
> --- a/audio/pwaudio.c
> +++ b/audio/pwaudio.c
> @@ -750,6 +750,7 @@ static int wait_resync(pwaudio *pw)
> }
> return 0;
> }
> +
> static void
> on_core_error(void *data, uint32_t id, int seq, int res, const char *message)
> {
> @@ -793,19 +794,19 @@ qpw_audio_init(Audiodev *dev)
> pw->dev = dev;
> pw->thread_loop = pw_thread_loop_new("PipeWire thread loop", NULL);
> if (pw->thread_loop == NULL) {
> - error_report("Could not create PipeWire loop");
> + error_report("Could not create PipeWire loop: %s", g_strerror(errno));
> goto fail;
> }
>
> pw->context =
> pw_context_new(pw_thread_loop_get_loop(pw->thread_loop), NULL, 0);
> if (pw->context == NULL) {
> - error_report("Could not create PipeWire context");
> + error_report("Could not create PipeWire context: %s", g_strerror(errno));
> goto fail;
> }
>
> if (pw_thread_loop_start(pw->thread_loop) < 0) {
> - error_report("Could not start PipeWire loop");
> + error_report("Could not start PipeWire loop: %s", g_strerror(errno));
> goto fail;
> }
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 09/12] audio/pw: add more error reporting
2023-05-06 16:37 ` [PATCH 09/12] audio/pw: add more error reporting marcandre.lureau
@ 2023-05-07 15:32 ` Volker Rümelin
0 siblings, 0 replies; 26+ messages in thread
From: Volker Rümelin @ 2023-05-07 15:32 UTC (permalink / raw)
To: marcandre.lureau, Gerd Hoffmann; +Cc: dbassey, qemu-devel
> From: Marc-André Lureau<marcandre.lureau@redhat.com>
>
> Signed-off-by: Marc-André Lureau<marcandre.lureau@redhat.com>
> ---
> audio/pwaudio.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
Reviewed-by: Volker Rümelin <vr_qemu@t-online.de>
> diff --git a/audio/pwaudio.c b/audio/pwaudio.c
> index 67df53948c..5c706a9fde 100644
> --- a/audio/pwaudio.c
> +++ b/audio/pwaudio.c
> @@ -429,6 +429,10 @@ create_stream(pwaudio *c, PWVoice *v, const char *stream_name,
> struct pw_properties *props;
>
> props = pw_properties_new(NULL, NULL);
> + if (!props) {
> + error_report("Failed to create PW properties: %s", g_strerror(errno));
> + return -1;
> + }
>
> /* 75% of the timer period for faster updates */
> buf_samples = (uint64_t)v->g->dev->timer_period * v->info.rate
> @@ -441,8 +445,8 @@ create_stream(pwaudio *c, PWVoice *v, const char *stream_name,
> pw_properties_set(props, PW_KEY_TARGET_OBJECT, name);
> }
> v->stream = pw_stream_new(c->core, stream_name, props);
> -
> if (v->stream == NULL) {
> + error_report("Failed to create PW stream: %s", g_strerror(errno));
> return -1;
> }
>
> @@ -470,6 +474,7 @@ create_stream(pwaudio *c, PWVoice *v, const char *stream_name,
> PW_STREAM_FLAG_MAP_BUFFERS |
> PW_STREAM_FLAG_RT_PROCESS, params, n_params);
> if (res < 0) {
> + error_report("Failed to connect PW stream: %s", g_strerror(errno));
> pw_stream_destroy(v->stream);
> return -1;
> }
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 10/12] audio/pw: simplify error reporting in stream creation
2023-05-06 16:37 ` [PATCH 10/12] audio/pw: simplify error reporting in stream creation marcandre.lureau
@ 2023-05-07 15:33 ` Volker Rümelin
0 siblings, 0 replies; 26+ messages in thread
From: Volker Rümelin @ 2023-05-07 15:33 UTC (permalink / raw)
To: marcandre.lureau, Gerd Hoffmann; +Cc: dbassey, qemu-devel
> From: Marc-André Lureau<marcandre.lureau@redhat.com>
>
> create_stream() now reports on all error paths.
>
> Signed-off-by: Marc-André Lureau<marcandre.lureau@redhat.com>
> ---
> audio/pwaudio.c | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
Reviewed-by: Volker Rümelin <vr_qemu@t-online.de>
> diff --git a/audio/pwaudio.c b/audio/pwaudio.c
> index 5c706a9fde..38905f5be2 100644
> --- a/audio/pwaudio.c
> +++ b/audio/pwaudio.c
> @@ -486,8 +486,6 @@ static int
> qpw_stream_new(pwaudio *c, PWVoice *v, const char *stream_name,
> const char *name, enum spa_direction dir)
> {
> - int r;
> -
> switch (v->info.channels) {
> case 8:
> v->info.position[0] = SPA_AUDIO_CHANNEL_FL;
> @@ -540,13 +538,7 @@ qpw_stream_new(pwaudio *c, PWVoice *v, const char *stream_name,
> }
>
> /* create a new unconnected pwstream */
> - r = create_stream(c, v, stream_name, name, dir);
> - if (r < 0) {
> - AUD_log(AUDIO_CAP, "Failed to create stream.");
> - return -1;
> - }
> -
> - return r;
> + return create_stream(c, v, stream_name, name, dir);
> }
>
> static int
> @@ -577,7 +569,6 @@ qpw_init_out(HWVoiceOut *hw, struct audsettings *as, void *drv_opaque)
> r = qpw_stream_new(c, v, ppdo->stream_name ? : c->dev->id,
> ppdo->name, SPA_DIRECTION_OUTPUT);
> if (r < 0) {
> - error_report("qpw_stream_new for playback failed");
> pw_thread_loop_unlock(c->thread_loop);
> return -1;
> }
> @@ -621,7 +612,6 @@ qpw_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
> r = qpw_stream_new(c, v, ppdo->stream_name ? : c->dev->id,
> ppdo->name, SPA_DIRECTION_INPUT);
> if (r < 0) {
> - error_report("qpw_stream_new for recording failed");
> pw_thread_loop_unlock(c->thread_loop);
> return -1;
> }
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 02/12] tests/lcitool: add pipewire
2023-05-06 16:37 ` [PATCH 02/12] tests/lcitool: add pipewire marcandre.lureau
@ 2023-05-10 7:35 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 26+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-05-10 7:35 UTC (permalink / raw)
To: marcandre.lureau, qemu-devel
Cc: Gerd Hoffmann, Wainer dos Santos Moschetta, Beraldo Leal,
Thomas Huth, Markus Armbruster, Alex Bennée, dbassey,
Daniel P. Berrangé, Eric Blake, Paolo Bonzini
On 6/5/23 18:37, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
Maybe a bit more verbose:
"Add pipewire dependency to the lcitool mapping and run
'make lcitool-refresh' to generate the updated files."
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> tests/docker/dockerfiles/alpine.docker | 1 +
> tests/docker/dockerfiles/centos8.docker | 1 +
> tests/docker/dockerfiles/debian-amd64-cross.docker | 1 +
> tests/docker/dockerfiles/debian-amd64.docker | 1 +
> tests/docker/dockerfiles/debian-arm64-cross.docker | 1 +
> tests/docker/dockerfiles/debian-armel-cross.docker | 1 +
> tests/docker/dockerfiles/debian-armhf-cross.docker | 1 +
> tests/docker/dockerfiles/debian-mips64el-cross.docker | 1 +
> tests/docker/dockerfiles/debian-mipsel-cross.docker | 1 +
> tests/docker/dockerfiles/debian-ppc64el-cross.docker | 1 +
> tests/docker/dockerfiles/debian-s390x-cross.docker | 1 +
> tests/docker/dockerfiles/fedora.docker | 1 +
> tests/docker/dockerfiles/opensuse-leap.docker | 1 +
> tests/docker/dockerfiles/ubuntu2204.docker | 1 +
> tests/lcitool/projects/qemu.yml | 1 +
> 15 files changed, 15 insertions(+)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 03/12] audio/pw: Pipewire->PipeWire case fix for user-visible text
2023-05-06 16:37 ` [PATCH 03/12] audio/pw: Pipewire->PipeWire case fix for user-visible text marcandre.lureau
2023-05-07 14:56 ` Volker Rümelin
@ 2023-05-10 7:36 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 26+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-05-10 7:36 UTC (permalink / raw)
To: marcandre.lureau, qemu-devel
Cc: Gerd Hoffmann, Wainer dos Santos Moschetta, Beraldo Leal,
Thomas Huth, Markus Armbruster, Alex Bennée, dbassey,
Daniel P. Berrangé, Eric Blake, Paolo Bonzini
On 6/5/23 18:37, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> "PipeWire" is the correct case.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> meson.build | 2 +-
> qapi/audio.json | 12 ++++++------
> audio/pwaudio.c | 10 +++++-----
> audio/trace-events | 2 +-
> meson_options.txt | 2 +-
> qemu-options.hx | 4 ++--
> scripts/meson-buildoptions.sh | 2 +-
> 7 files changed, 17 insertions(+), 17 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 06/12] audio/pw: trace during init before calling pipewire API
2023-05-06 16:37 ` [PATCH 06/12] audio/pw: trace during init before calling pipewire API marcandre.lureau
2023-05-07 15:03 ` Volker Rümelin
@ 2023-05-10 7:37 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 26+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-05-10 7:37 UTC (permalink / raw)
To: marcandre.lureau, qemu-devel
Cc: Gerd Hoffmann, Wainer dos Santos Moschetta, Beraldo Leal,
Thomas Huth, Markus Armbruster, Alex Bennée, dbassey,
Daniel P. Berrangé, Eric Blake, Paolo Bonzini
On 6/5/23 18:37, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> audio/pwaudio.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2023-05-10 7:37 UTC | newest]
Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-06 16:37 [PATCH 00/12] audio: pipewire backend improvements marcandre.lureau
2023-05-06 16:37 ` [PATCH 01/12] libvirt-ci: update submodule to cover pipewire marcandre.lureau
2023-05-06 16:37 ` [PATCH 02/12] tests/lcitool: add pipewire marcandre.lureau
2023-05-10 7:35 ` Philippe Mathieu-Daudé
2023-05-06 16:37 ` [PATCH 03/12] audio/pw: Pipewire->PipeWire case fix for user-visible text marcandre.lureau
2023-05-07 14:56 ` Volker Rümelin
2023-05-10 7:36 ` Philippe Mathieu-Daudé
2023-05-06 16:37 ` [PATCH 04/12] audio/pw: drop needless case statement marcandre.lureau
2023-05-07 14:58 ` Volker Rümelin
2023-05-06 16:37 ` [PATCH 05/12] audio/pw: needless check for NULL marcandre.lureau
2023-05-07 15:01 ` Volker Rümelin
2023-05-06 16:37 ` [PATCH 06/12] audio/pw: trace during init before calling pipewire API marcandre.lureau
2023-05-07 15:03 ` Volker Rümelin
2023-05-10 7:37 ` Philippe Mathieu-Daudé
2023-05-06 16:37 ` [PATCH 07/12] audio/pw: add more details on error marcandre.lureau
2023-05-07 15:31 ` Volker Rümelin
2023-05-06 16:37 ` [PATCH 08/12] audio/pw: factorize some common code marcandre.lureau
2023-05-07 15:07 ` Volker Rümelin
2023-05-06 16:37 ` [PATCH 09/12] audio/pw: add more error reporting marcandre.lureau
2023-05-07 15:32 ` Volker Rümelin
2023-05-06 16:37 ` [PATCH 10/12] audio/pw: simplify error reporting in stream creation marcandre.lureau
2023-05-07 15:33 ` Volker Rümelin
2023-05-06 16:37 ` [PATCH 11/12] audio/pw: remove wrong comment marcandre.lureau
2023-05-07 15:11 ` Volker Rümelin
2023-05-06 16:37 ` [PATCH 12/12] audio/pw: improve channel position code marcandre.lureau
2023-05-07 15:13 ` Volker Rümelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).