Commit graph

4344 commits

Author SHA1 Message Date
Wim Taymans e3ffcbefb6 spa: fix volume plugin compilation 2024-06-18 15:44:26 +02:00
Wim Taymans f7d59bcea7 fix compilation some more
The math M_*f symbols are GNU extensions.
2024-06-18 15:41:12 +02:00
Wim Taymans 69251948ee vulkan: fix compilation 2024-06-18 15:16:06 +02:00
Wim Taymans 1ae4374ccf Fix compilation with -Werror=float-conversion
Better make the conversions explicit so that we don't get any surprises.

Fixes #4065
2024-06-18 12:17:56 +02:00
Arnav Singh 2501b347ef
spa: bluez: fix crash when receiving signal from modemmanager
6e581deb91 added an `spa_autoptr(DbusMessage) m`
for the new message sent out when a signal is received from modemmanager.
However this ended up shadowing the original `m` function arg,
so the code that wanted to interrogate the original arg with
`dbus_get_message_path` etc ended up interrogating this `NULL` value instead.
This triggered a NULL-check in `dbus_get_message_path` and caused
the process to abort.

Original downstream report: https://gitlab.com/postmarketOS/pmaports/-/issues/2886
2024-06-15 10:11:38 -07:00
Vlad Pruteanu 1466d0ae78 bluez5: bap: Use a string instead of int array to set Broadcast code
Currently, the user sets the Broadcast Code via an array of integers
in the config file. However, the Bluetooth Core Specification indicates
that it should be set via a 16 byte string. This commit replaces the old
implementation with the one required by the spec.

Tested the commit with the example provided in the Core Spec:
Broadcast Code: Børne House
Result from btsnoop log:
< HCI Command: LE Create Broadcast Isochronous Group (0x08|0x0068) plen 31
...
Broadcast Code[16]: 000000006573756f4820656e72b8c342

The result matches the example given in the spec.
2024-06-14 06:05:14 +00:00
Wim Taymans b421331275 doc: clarify the dither.noise
Fixes #4057
2024-06-13 11:38:26 +02:00
Wim Taymans 0115042adb buffer: add that the mapoffset is page aligned 2024-06-13 10:22:58 +02:00
Wim Taymans 9592b0af2a examples: fix mapoffset in examples
The mapoffset should be using in the mmap call as the offset.

Mapping the whole memory before the offset and then ignoring the part
before it seems like it can work but it actually has some problems:

1. some drivers (v4l2) use the mapoffset to calculate the buffer to map
2. we waste resources for mapped but unused pages.

The problem with the mapoffset is that it needs to be page aligned and
that used to be a problem in the past. Nowadays PipeWire no longer set
the mapoffset for any of the memory that it allocates.
2024-06-13 10:11:29 +02:00
Wim Taymans fe5a29ac2a v4l2: improve logging a little
Add the device to the error log lines.
2024-06-11 12:15:05 +02:00
Vlad Pruteanu 34b17a6269 bluez5: bap: Enable control of Broadcast Encryption
Add "encryption" parameter to bluez5.bcast_source.config entry in
the configuration file. This allows the user to control the use of
Broadcast encryption.
2024-06-11 07:17:17 +00:00
Alexandre Rossi d6c17681da
add alsa plugin profiles for HDMI/AC3 (Fix #3832) 2024-06-07 11:20:01 +02:00
Wim Taymans 4d7c81bd90 v4l2: support meta_videotransform on buffers
Advertise support for the videotransform metadata.
Make a new meta.videotransform.transform property to configure the
desired video transformation in the metadata.

This makes it possible for a session manager or other rules to set
a custom transformation on the source.

See #4034
2024-06-07 10:54:46 +02:00
Wim Taymans 6bb1d0476d spa: add enum type info for transformation 2024-06-07 10:54:46 +02:00
Stefan Ursella 898f854ca7 alsa-pcm: check if bound ctls are valid before using it.
When bound_ctl info cannot be read this array elem info
is set to NULL in 'fetch_bind_ctl'. So when we iterate
the bound_ctl array we always have to check this.
2024-06-07 07:21:45 +00:00
Wim Taymans 1d9a00a66f v4l2: fix string size
vendor_id and product_id are encoded as 0xHHHH and so it needs 7 chars
with the 0.

See #4034
2024-06-06 16:25:24 +02:00
Silviu Florian Barbulescu e4432190f7 Add broadcast sink support for multiple BISes 2024-05-30 13:37:27 +00:00
Vlad Pruteanu 0b5f716526 bluez5: bap: Support Mono Channel Allocation
The Bluetooth SIG Assigned Numbers Document has been updated and a
value of 0 for the Channel Allocation is now allowed, with the
meaning of "Mono".
2024-05-28 16:42:08 +03:00
Arun Raghavan 2f9a5e0694 alsa: Use hw:X for accessing card ctl
In ACP mode, we might be accessing front:0 as the PCM, and using that
string to generate the ctl device name does not make sense. In
PulseAudio, we used the card index to generate a hw:X string, and we
replicate that here.

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4028
2024-05-28 10:39:24 +03:00
Silviu Florian Barbulescu 5be2f5e096 Resolve problems found on review 2024-05-27 16:08:36 +00:00
Barnabás Pőcze 625c0f5784 Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Barnabás Pőcze <pobrn@protonmail.com>
2024-05-27 16:08:36 +00:00
Silviu Florian Barbulescu 1259829ac3 Remove device and transport for broadcast source on interfaces_removed 2024-05-27 16:08:36 +00:00
Silviu Florian Barbulescu ab87eba149 Add support for the broadcast source multiple BIS implementation in BlueZ. 2024-05-27 16:08:36 +00:00
Diego Viola 7410755c03 Fix typos
found them with codespell.

Signed-off-by: Diego Viola <diego.viola@gmail.com>
2024-05-22 09:19:34 +02:00
Wim Taymans 8a24ad3073 acp: handle some errors better
Handle allocation failure and size overflow.
2024-05-20 11:22:46 +02:00
Pauli Virtanen a63aa6329b spa: fix integer overflows etc. in spa_pod_compare_value
Add macro SPA_CMP to do 3-way comparisons safely, and use it to avoid
signed integer overflows.

Fix also float/double comparisons (previously 0.1 == 0.8 since cast to
return type int).

Fix Id/Bool comparisons so they can return negative value.
2024-05-20 09:11:25 +00:00
Pauli Virtanen b94d6e53a1 bluez5: use initial SCO RX wait workaround only for USB controllers
Kernel-provided MTU does not work for USB controllers and the correct
packet size to send can be known currently only from RX. So we are
waiting for RX to get it.

The known problem is USB-specific, we shouldn't need the workaround for
other transport types.

Don't wait for POLLIN for non-USB controllers on connect, but ready
things on POLLOUT as usual.

For non-USB controllers, pick some sensible packet sizes to use
initially, before we switch to same size as for RX.
2024-05-18 13:53:45 +03:00
Barnabás Pőcze 8e495a3a2c spa: libcamera: remove unused includes 2024-05-15 08:31:03 +00:00
Barnabás Pőcze 55fafe8f0b spa: libcamera: remove two unused members 2024-05-15 08:31:03 +00:00
Barnabás Pőcze 87368c8e4f spa: libcamera: remove wrong prefix from log message 2024-05-15 08:31:03 +00:00
Barnabás Pőcze b7ef5c92bc spa: libcamera: remove unnecessary snprintf() 2024-05-15 08:31:03 +00:00
Barnabás Pőcze 9eab76d862 spa: libcamera: don't calculate id twice 2024-05-15 08:31:03 +00:00
Silviu Florian Barbulescu bb1c2c3272 Fix review comments, added METADATA_VALUE_MAX_LEN and removed entry_key in configure_bis. 2024-05-15 08:11:50 +00:00
Pauli Virtanen 345131475c bluez5: cleanup bluez5.bcast_source.config parsing
Also fix doc.
2024-05-15 08:11:50 +00:00
Silviu Florian Barbulescu 44d96ed4b9 bluez: on metadata, parse remove the length field, and deduce the length from the value plus type 2024-05-15 08:11:50 +00:00
Silviu Florian Barbulescu be3e87f485 Add code to fix problem found at review 2024-05-15 08:11:50 +00:00
Silviu Florian Barbulescu 2bff4a9337 bluez: Configure the BlueZ broadcast source
This is the first draft where the configuration is done based on BIS information loaded from the config file.
2024-05-15 08:11:50 +00:00
Wim Taymans 37224ac84c alsa-seq: configure pool sizes better
The default kernel pool size on the input is 200 cells. A cell is
about 28 bytes long so the maximum message that can be received in one
go is about 5600 bytes. This causes problems when using amidi to upload
larger sysex messages because they simply can't be received by the
sequencer.

It if however possible to increase this limit with the set_client_pool()
function. Increase the pool size to at least the quantum_limit * 2.
This ensures we can receive and send at least 2 quantums of raw data,
which should be a fairly long sysex message.

Make a min and max value for the pool size. There is an upper limit of
2000 in the kernel but make this configurable and clamp the final
pool size to the min/max.

Make the MAX_EVENT_SIZE 256, because this is how the sequencer seems to
splits the input data as well and it results in less wasted space in the
output buffer.

See #4005
2024-05-13 15:25:52 +02:00
Wim Taymans ea0ba1162e alsa-seq: warn when receive fails
This can happen when allocation fails or the message is too long.
2024-05-13 15:17:21 +02:00
Wim Taymans 89edb9f6c5 control: use quantum_limit for midi buffer size
Instead of the arbitrary default.
2024-05-10 11:49:31 +02:00
Wim Taymans 7e87bd9b34 alsa-seq: try to not overflow the output buffer
Keep some room in the output buffer to store the worst case event
and save it for the next cycle.
2024-05-10 11:33:44 +02:00
Wim Taymans e897a8afc4 control: warn when we overflow the control buffer 2024-05-09 19:33:30 +02:00
Wim Taymans cb8330c798 alsa-seq: handle large control events
Handle the case where the control event is large and needs to be
encoded into multiple midi events.
2024-05-09 18:49:00 +02:00
Wim Taymans 7dcfe81690 alsa-seq: improve midi encode some more
snd_midi_event_encode() will reset the encoder when it returns an
encoded event. It is possible that the function returns with an encoded
event when the internal buffer is full, in that case we need to push the
event and continue encoding without reseting the encoder.

0 is not a snd_midi_event_encode() error, so don't handle it like
one.
2024-05-09 18:32:14 +02:00
Wim Taymans 1c056661b6 alsa-seq: handle fragmented midi messages
The messages, mostly sysex, can be split over multiple control message.

This happens when we read large messages from the sequencer, the
snd_seq_event_input function returns split messages that we transfer to
control messages directly.

When we send those messages out, however, the encoder wants the complete
message before it will return a valid event that we can send out. Keep
on calling the encoder with the control events until we get a complete
message that we can send out.

Fixes #4005
2024-05-09 16:18:29 +02:00
Wim Taymans 050976adf6 control: also handle ANY ports for enum_param 2024-05-09 15:23:50 +02:00
Wim Taymans 8b23a8a89e loop: flush items in the order they were added
Add a count to each invoke item that is updated with an increasing
loop atomic counter. Flush items from the queues based on their count
so that items are flushed in the order they were added even if they
were added to different queues.
2024-05-08 12:21:54 +02:00
Wim Taymans fac0d47c23 impl-port: swap io areas instead of doing cycle math
Instead of doing (cycle+1) & 1 for output ports, simply swap the io
areas depending on the port direction (0 = input, 1 = output) and
just to cycle&1 for all ports.
2024-05-08 10:45:53 +02:00
Robert Mader b3ff293263 spa: libcamera: fix RGB mappings
Libcamera formats are generally little-endian, matching DMA DRM
fourccs, while PW ones are big-endian. Thus we have to invert the
order.

Only RGB and BGR where tested, as these are the formats currently
supported by the software ISP. This fixes inverted red and blue in
Snapshot on the Librem5 and Pinephone (OG).

See also gstlibcamera-utils.cpp in libcamera.
2024-05-06 07:41:33 +00:00
Pauli Virtanen 22ac5f85cc json: fix high surrogate escapes
Surrogate escapes must add not or 0x10000, as the specified bits go up
0xfffff.
2024-05-05 15:15:54 +03:00