Commit graph

10027 commits

Author SHA1 Message Date
Wim Taymans
3873256211 alsa: free properties
When we simply update the properties of an existing stream, don't leak
the properties.
2023-01-19 15:32:29 +01:00
Wim Taymans
d11fb766c6 module-pipe: improve properties on nodes
Actually move the stream properties in stream.props object for the pipe
tunnel module.
Set pipe.filename on the node. Remap this to device.string in pulse.
Add some more default properties on the pipe nodes.

See #2973
2023-01-19 11:05:54 +01:00
Wim Taymans
cb8d9f38b2 stream: handle the case where io is NULL
Some older servers set the io area after starting the node and so the
node runs first without io areas, just return an error instead of
crashing.

Fixes #2964
2023-01-19 10:19:14 +01:00
Wim Taymans
1126fbd26c filter-chain: simplify a little
We can reuse the array of filenames for the single filename case
and remove some duplicate code.
Handle some errors better.
2023-01-18 18:22:34 +01:00
Wim Taymans
30057967dd module-filter-chain: fix array size 2023-01-18 18:06:19 +01:00
Wim Taymans
9d66de446b convolver: parse array from filename 2023-01-18 16:59:25 +00:00
Barnabás Pőcze
051d223d73 filter-chain: review suggestions 2023-01-18 16:59:25 +00:00
Dmitry Sharshakov
2251b9b1d9 filter-chain: allow multiple filters for convolver
Choose the closest match to reduce resampling loss. If match is not equal, resample.

Keep the backwards compatibility retaining `filename` property. When both set, `filenames` takes priority
2023-01-18 16:59:25 +00:00
Arun Raghavan
134a20c3c5 spa: Minor documentation copy-pasto fix 2023-01-18 16:59:05 +00:00
Wim Taymans
6207d98ff1 spa: add debug log context
Make a real debug context with a log function and move it to a new file.
This way we don't need to redefine a macro.
Make a new context for debugging to a log file. Make new functions to
debug to a log file.
Move the stringbuffer to string utils.
Integrate file/line/func and topics into the debug log.
We can remove some more things from the pipewire log_object function and
also add support for topics.
2023-01-18 17:51:16 +01:00
Wim Taymans
3c67821c4a spa: add context to debug functions
Add new spa_debugc_ funnctions that take a context. The user should also
redefine the spa_debugc macro to handle the context.

Use this to let some plugins log the pod and format to the log without
using the global logger.

Also use this to remove our custom pod logger function by reusing the
spa one with a custom context.
2023-01-18 13:12:16 +01:00
Wim Taymans
f472fd736d fix includes
Only include debug we need. We usually only need the debug types.
2023-01-18 13:12:16 +01:00
Wim Taymans
5e58e03da7 spa: redirect adapter log to logfile
Fixes #2923
2023-01-18 13:12:16 +01:00
Pauli Virtanen
4b408e2978 bluez5: fix reported BAP profile index 2023-01-17 20:14:14 +02:00
Pauli Virtanen
37d78ce29e bluez5: disable LE Audio if using legacy bluez API 2023-01-17 19:58:42 +02:00
Pauli Virtanen
a372c89544 bluez5: lc3: handle multiple PACs in capabilities
BlueZ may send multiple PACs in the capabilities delimited by zero LTV.
Handle this case by selecting the "best" one.

The configuration size may also for BAP generally be different from PAC
size.
2023-01-17 19:58:42 +02:00
Wim Taymans
37a5dca31e module-echo-cancel: update docs with monitor.mode property 2023-01-17 13:18:13 +01:00
Wim Taymans
edd3113c43 pulse-server: add remaining formats
The ones that have no pulseaudio equivalent will be filtered out when we
parse or create messages.

See !1499
2023-01-17 12:26:06 +01:00
Wim Taymans
a979c0f430 keys: don't remove deprecated symbols by default
Add a new macro to mark deprecated keys. The macro will emit a warning
about the symbol being deprecated.
PW_ENABLE_DEPRECATED will suppress the deprecation warning.
Add PW_REMOVE_DEPRECATED to completely remove the deprecated symbols.

Fixes #2952
2023-01-17 11:58:04 +01:00
Wim Taymans
ccedf1722a filter-chain: fix AVX dsp_sum index increment
Fixes #2965
2023-01-17 09:24:00 +01:00
Wim Taymans
1d9640af5a spa: Fix audioconvert overflow when scaling
Add SPA_SCALE32_UP that scales a uint32 without overflow.
Use this for scaling the threshold in ALSA.
Fix the scaling in audioconvert of the buffer size, the scaling was
wrong and it was also causing an overflow resulting in choppy sound in
some cases.

See #2680
2023-01-16 18:28:31 +01:00
Wim Taymans
32a7c85c84 alsa: guard against some invalid values
Avoid division by 0 and other strange things when invalid values
are detected.

Fixes #2953
2023-01-16 16:05:17 +01:00
Wim Taymans
68d9c33078 module-echo-cancel: allow per stream AUDIO_POSITION settings
Keep per stream audio info. We copy the global rate and format to
everything but allow for the channel positions to be overwritten
per stream. Invalid channel positions will revert to the default
again.

With a taget.object, this makes it possible to link the echo cancel
stream to specific pro audio sink ports.

Fixes #2939
2023-01-16 15:11:02 +01:00
Wim Taymans
e86acd8930 module-rt: improve rt settings
Refactor get_rt_priority_range().
When we can't set the requested priority, use rlimit to clamp it
and try again. If this clamped value is bigger than RT_PRIO_MIN,
we can allow this.

The result is that the RTPRIO is set to the max of the user rlimit
RTPRIO, as long as it's more than 11. Previously it would fall back
to RTKit.
2023-01-16 13:08:37 +01:00
Wim Taymans
28aa9ebe64 pulse-server: add more valid formats
Add some more formats that can be used in pipewire streams so that
pulseaudio will see them as valid devices/streams.

It is possible that this will result in an invalid format on the client
when there is no pulseaudio format defined, but that is ok.

See !1499
2023-01-16 11:05:06 +01:00
Thomas Weißschuh
6f84bef2b0 pulse-server: split device info validation into dedicated function 2023-01-16 11:05:06 +01:00
Szabolcs Szőke
bb1f595b53 adapter: support custom prefix for device ports
Prefixes can be disabled for device ports by providing an empty string
2023-01-16 08:25:41 +00:00
Barnabás Pőcze
375cc73b9d doc: specify Doxygen OUTPUT_DIRECTORY as an absolute path
Currently, doxygen is run by ninja in the top-level build directory,
therefore the "doc" folder is always created there. However, when
pipewire is built as a subproject, it should not touch the top-level
build directory because it can cause conflicts and because the
documentation won't be created where meson thinks it will be,
so the "doxygen" target will always be dirty and installation will fail.
2023-01-15 15:08:47 +00:00
Dmitry Sharshakov
7b355d5628 convolver: add gain when resampling to preserve volume 2023-01-15 11:53:30 +00:00
Dmitry Sharshakov
e0cc072100 filter-chain: use equal rate for capture and playback
If only one of rates is provided, propagate it. If both are provided and are inequal, warn.

This configuration appears to be broken for obvious reasons
2023-01-14 19:52:47 +00:00
Sanchayan Maity
65f3a9c481 cpu-arm: Fix incorrect free
A bug was introduced with the refactoring in da26563. In arm_init,
the buffer passed to spa_cpu_read_file is allocated and it is just
going to return that. So cpuinfo will actually point to buffer on
the stack, which need not be freed with a call to free.

The crash resulting with the incorrect free.

root@dragonboard-845c:~# pipewire --version
munmap_chunk(): invalid pointer
[  185.037284] audit: type=1701 audit(1659949975.843:14): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=2243 comm="pipewire" exe="/usr/bin/pipewire" sig=6 res=1
Aborted
root@dragonboard-845c:~# wireplumber --version
munmap_chunk(): invalid pointer
[  193.453693] audit: type=1701 audit(1659949984.255:15): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=2244 comm="wireplumber" exe="/usr/bin/wireplumber" sig=6 res=1
Aborted

Backtrace from the crash

(gdb) bt
!0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
!1  0x0000fffff7d8edd8 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
!2  0x0000fffff7d4a390 in __GI_raise (sig=sig@entry=6) at /usr/src/debug/glibc/2.36-r0/sysdeps/posix/raise.c:26
!3  0x0000fffff7d37498 in __GI_abort () at abort.c:79
!4  0x0000fffff7d83374 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0xfffff7e5fc20 "%s\n") at /usr/src/debug/glibc/2.36-r0/sysdeps/posix/libc_fatal.c:155
!5  0x0000fffff7d988c0 in malloc_printerr (str=str@entry=0xfffff7e5a7f0 "munmap_chunk(): invalid pointer") at malloc.c:5660
!6  0x0000fffff7d98aac in munmap_chunk (p=p@entry=0xffffffffd258) at malloc.c:3054
!7  0x0000fffff7d9d068 in __GI___libc_free (mem=mem@entry=0xffffffffd268) at malloc.c:3375
!8  0x0000fffff7cd36cc in arm_init (impl=impl@entry=0xaaaaaaac8c48) at /usr/src/debug/pipewire/1.0-r0/spa/plugins/support/cpu-arm.c:97
!9  0x0000fffff7cd391c in impl_init (factory=<optimized out>, handle=0xaaaaaaac8c48, info=0xffffffffe548, support=<optimized out>, n_support=<optimized out>) at /usr/src/debug/pipewire/1.0-r0/spa/plugins/support/cpu.c:264
!10 0x0000fffff7f3a234 in load_spa_handle (lib=<optimized out>, factory_name=factory_name@entry=0xfffff7f6d768 "support.cpu", info=info@entry=0xffffffffe548, n_support=1,
    support=support@entry=0xfffff7fb0488 <global_support+88>) at /usr/src/debug/pipewire/1.0-r0/src/pipewire/pipewire.c:280
!11 0x0000fffff7f3a5b0 in add_interface (factory_name=factory_name@entry=0xfffff7f6d768 "support.cpu", type=type@entry=0xfffff7f62310 "Spa:Pointer:Interface:CPU", info=info@entry=0xffffffffe548,
    support=0xfffff7fb0430 <global_support>) at /usr/src/debug/pipewire/1.0-r0/src/pipewire/pipewire.c:358
!12 0x0000fffff7f3b3f8 in pw_init (argc=argc@entry=0xffffffffea5c, argv=argv@entry=0xffffffffea50) at /usr/src/debug/pipewire/1.0-r0/src/pipewire/pipewire.c:661
!13 0x0000aaaaaaaa1104 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/pipewire/1.0-r0/src/daemon/pipewire.c:79
(gdb) f 8
!8  0x0000fffff7cd36cc in arm_init (impl=impl@entry=0xaaaaaaac8c48) at /usr/src/debug/pipewire/1.0-r0/spa/plugins/support/cpu-arm.c:97
97      /usr/src/debug/pipewire/1.0-r0/spa/plugins/support/cpu-arm.c: No such file or directory.
(gdb) info locals
flags = 122
cpuinfo = 0xffffffffd268 "processor\t: 0\nBogoMIPS\t: 38.40\nFeatures\t: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop\nCPU implementer\t: 0x51\nCPU architecture: 8\nCPU variant\t.
line = 0xaaaaaaac8ce0 "\310\252\252\252\n"
buffer = "processor\t: 0\nBogoMIPS\t: 38.40\nFeatures\t: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop\nCPU implementer\t: 0x51\nCPU architecture: 8\nCPU variant\t: 0x7\nCPU pa"...
arch = <optimized out>
__func__ = "arm_init"
2023-01-14 19:51:33 +00:00
Lukas Rusak
da7673ca6e
spa: fix documentation for SPA_FORMAT_AUDIO_position
spa_audio_position isn't a valid enum. The actual enum is spa_audio_channel

Signed-off-by: Lukas Rusak <lorusak@gmail.com>
2023-01-13 21:25:36 -08:00
Wim Taymans
792defde27 adapter: only add port name override when not empty
This makes it possible to add an empty string to keep the original
port name.
2023-01-13 17:52:24 +01:00
Wim Taymans
7072f2b78a spa: fix switch on media_subtype 2023-01-13 17:39:33 +01:00
Josh Lay
5b42c07b15 Add support for GSX 1000 v2 2023-01-13 12:19:30 +00:00
Wim Taymans
9a580362a7 spa: fix includes 2023-01-13 11:41:38 +01:00
Wim Taymans
00ae289a14 spa: reorganize params
Split files into separate files.
Move type annotations to a matching -types.h files.
Move helpers to matching -utils.h files.
Add helpers to parse generic audio and video info.
2023-01-13 11:02:51 +01:00
Dylan Aïssi
4e9c3b26d9 doc: remove duplicate FULL_PATH_NAMES field
FULL_PATH_NAMES is defined twice. Remove the one set to YES
since including the full path breaks reproducible builds.

See https://reproducible-builds.org/docs/build-path/
2023-01-12 18:09:54 +01:00
Dylan Aïssi
4329961a67 man: fix typo in pw-link: Whithout -> Without 2023-01-12 18:08:28 +01:00
Dylan Aïssi
d653f26343 man: fix typo in pw-cat: seperator -> separator 2023-01-12 18:07:57 +01:00
Robert Mader
6bf47e0bfa pipewiresrc: Always advertise support for DmaBuf
Quoting https://docs.pipewire.org/page_dma_buf.html section "v4l2":
```
It's the the responsibility of the producer while the add_buffer event
to choose DMA-BUF as the used buffer type even though no modifier is
present, if it can guarantee, that the used buffer is mmapable.
```

As Gstreamer internally can mmap dmabufs just fine, support this case.
This enables dmabuf support with V4L2 and libcamera.

This was also tested against Gnome-Shell, which correctly handles this
case and only chooses DmaBuf if the negotiated format has a modifier,
i.e. if the Gstreamer peer supports the format with
`GST_CAPS_FEATURE_MEMORY_DMABUF`.

Fixes 602aa7d541
2023-01-12 11:27:27 +00:00
Robert Mader
17c53577e8 gst: Log buffer memory type
This is helpful when one wants to ensure the right memory type is used,
independently from the negotiated format.
2023-01-12 11:27:27 +00:00
Robert Mader
714b438814 libcamera: Check format info for correct flags and modifier 2023-01-12 11:22:25 +00:00
Robert Mader
c61b9a09b8 video: Add SPA_VIDEO_FLAG_MODIFIER flag
The drm format modifier value `0` is actually `DRM_FORMAT_MOD_LINEAR`,
a commonly used modifier. Unfortunately there appears to be no value
that can savely used as placeholder for "no value", as e.g.
`DRM_FORMAT_MOD_INVALID` is often used to indicate an implicit modifier.

Thus add a new flag that clearly indicates whether the modifier
value is set or not, add it to `spa_video_info_raw` and the util
functions.

Closes https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2943
2023-01-12 11:22:25 +00:00
Wim Taymans
da26563a83 cpu: clean up
Change read_file to spa_cpu_read_file and remove static because it might
not be used for some cpus.
Use spa_cpu_read_file in arm cpu detection.
2023-01-12 12:20:30 +01:00
Wim Taymans
bba452695e 0.3.64 2023-01-12 10:31:04 +01:00
Dmitry Sharshakov
09f00b5086 v4l2: support setting target source 2023-01-11 11:43:37 +00:00
Wim Taymans
afedd107a8 Revert "video: Add extra field indicating if modifier value is valid"
This reverts commit 1e6920c33b.

Causes an ABI break.
2023-01-11 12:21:42 +01:00
Wim Taymans
bdc0720bcb Revert "libcamera: Implement proper dmabuf negotiation support"
This reverts commit 950b62a8d8.

It depends on ABI break
2023-01-11 12:21:32 +01:00
Robert Mader
950b62a8d8 libcamera: Implement proper dmabuf negotiation support
According to https://docs.pipewire.org/page_dma_buf.html, i.e. announce
each format once with, once without `SPA_FORMAT_VIDEO_modifier`
property.

Note: currently libcamera always uses `DRM_FORMAT_MOD_LINEAR` (`== 0`),
so `pix.modifier()` returning `0` does not mean that no modifier is
supported.

This is needed for clients using the new DMABuf negotiation pattern,
such as gstpipewiresrc after 602aa7d5.
2023-01-11 01:39:42 +01:00