Commit graph

3463 commits

Author SHA1 Message Date
Carlos Rafael Giani e9a2c6aa34 Rename "compressed-offload to "Compress-Offload" in the code 2023-01-24 08:44:14 +00:00
Sanchayan Maity 6a034cc398 Add support for ALSA compressed offload
See
https://docs.kernel.org/sound/designs/compress-offload.html
https://github.com/alsa-project/tinycompress
2023-01-24 08:44:14 +00:00
Carlos Rafael Giani f3914e494c spa: Add ENCODED audio format to compressed format builder results
WirePlumber checks for the ENCODED audio format to determine if the
format is compressed/encoded. Without this info, it is not able
to automatically link compressed audio nodes.
2023-01-24 08:44:14 +00:00
Wim Taymans b66b9f70c4 spa: add APE format 2023-01-24 08:44:14 +00:00
Wim Taymans e535d4c6c4 spa: add FLAC format 2023-01-24 08:44:14 +00:00
Wim Taymans efbce802e4 spa: add ALAC format 2023-01-24 08:44:14 +00:00
Wim Taymans 603c28223b spa: add AMR type 2023-01-24 08:44:14 +00:00
Wim Taymans de5015c77b spa: add Real Audio format 2023-01-24 08:44:14 +00:00
Wim Taymans 6c962d8258 spa: add WMA type 2023-01-24 08:44:14 +00:00
Wim Taymans d24b3f29b2 spa: add vorbis type 2023-01-24 08:44:14 +00:00
Wim Taymans 2ac8a3f4e2 spa: add AAC format 2023-01-24 08:44:14 +00:00
Wim Taymans 844a3d8534 spa: add mp3 type 2023-01-24 08:44:14 +00:00
Wim Taymans 9e0a7c26f7 spa: add bitrate and blockAlign format props 2023-01-24 08:44:14 +00:00
Pauli Virtanen f292818961 bluez5: dbus-monitor: call remove hooks always
Call remove hooks always. We don't rely on this currently, but may be
clearer like this.
2023-01-24 08:27:56 +00:00
Pauli Virtanen 039759ceaf bluez5: use spa_debug_log_mem, not spa_log_hexdump 2023-01-24 08:27:56 +00:00
Pauli Virtanen fef0981488 bluez5: fixup BLE MIDI selinux README
The SELinux configuration should allow passing sockets also from PW to
bluetoothd.
2023-01-24 08:27:56 +00:00
Pauli Virtanen 25f36e4334 bluez5: add info key indicating glib mainloop is usable 2023-01-24 08:27:56 +00:00
Pauli Virtanen 93a473eff6 bluez5: prevent unloading spa-bluez5.so
GObject is not compatible with unloading shared libraries using it, so
add linker flags preventing that.
2023-01-24 08:27:56 +00:00
Pauli Virtanen 661569febc bluez5: use GDBus in midi-node 2023-01-24 08:27:56 +00:00
Pauli Virtanen 89542289ac bluez5: use GDBus in midi-server 2023-01-24 08:27:56 +00:00
Pauli Virtanen f1b5575ec3 bluez5: use GDBus in midi-enum 2023-01-24 08:27:56 +00:00
Pauli Virtanen de595a78ff bluez5: add GDBus-based object monitor framework 2023-01-24 08:27:56 +00:00
Pauli Virtanen 8d438d26ab bluez5: remove libdbus object manager wrappers 2023-01-24 08:27:56 +00:00
Pauli Virtanen bd45f846fc bluez5: midi: refcounting and other correctness fixes
Use stdalign.h instead of union.
Fix some refcounting and return values.
Fail early in add_filters.
Minor style cleanups.
Less magical spa_dbus_async_call.
2023-01-24 08:27:56 +00:00
Pauli Virtanen 2f8691b64f bluez5: add comments on possible SELinux + BLE MIDI issues 2023-01-24 08:27:56 +00:00
Pauli Virtanen e13fed1a80 bluez5: midi: put node nick in GATT Characteristic User Description
As server, put node nick in GATT Characteristic User Description, so
that clients have some information which endpoint is which in case we
have multiple.  This is not in BLE MIDI standard, but cannot hurt.

As client, make use of that information, if present.
2023-01-24 08:27:56 +00:00
Pauli Virtanen 2ef126885a bluez5: midi-node: implement server role 2023-01-24 08:27:56 +00:00
Pauli Virtanen d30a0c5ee6 bluez5: add MIDI server/peripheral implementation dbus part 2023-01-24 08:27:56 +00:00
Pauli Virtanen fe11bfdba0 bluez5: implement Bluetooth MIDI nodes
Implement BLE MIDI node, providing an input and output port.  MIDI data
received is normalized and produced on output port.  Data from input
port is converted to BLE MIDI and sent to the device.

Event timestamps come from device clock, whose offset to wall clock we
determine by correlating packet reception times with their timestamps.
The jitter in packet reception is likely much larger than device clock
error, so we average over that.
2023-01-24 08:27:56 +00:00
Pauli Virtanen fe3ca50818 bluez5: Add BLE MIDI parser/writer tests 2023-01-24 08:27:56 +00:00
Pauli Virtanen 5d6f25e8f0 bluez5: implement BLE midi data writer 2023-01-24 08:27:56 +00:00
Pauli Virtanen e3cf7f6d87 bluez5: implement BLE MIDI parser 2023-01-24 08:27:56 +00:00
Pauli Virtanen 931e8da3ea bluez5: implement Bluetooth MIDI device enumeration
Add monitor for enumerating connected Bluetooth MIDI devices.
2023-01-24 08:27:56 +00:00
Pauli Virtanen a07dfbbdb9 bluez5: add convenience helper for dbus pending calls 2023-01-24 08:27:56 +00:00
Pauli Virtanen 42e463f726 bluez5: add abstraction for remote DBus objects
Add framework for enumerating remote objects via DBus object manager
interfaces.
2023-01-24 08:27:56 +00:00
Pauli Virtanen 57956ad100 bluez5: add abstraction for local DBus object manager
Add framework for exposing local objects via DBus object manager
interfaces.
2023-01-24 08:27:56 +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 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
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 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