Commit graph

4328 commits

Author SHA1 Message Date
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
Stefan Ursella 9c31cf1271 alsa: read hw synced ring buffer position when caller is not the same pcm
When the caller is a different pcm it is not shure that the
IRQs are synchronised. So read the real ring buffer position.
2024-05-05 09:31:54 +00:00
Barnabás Pőcze da1dbc1120 treewide: fix C++20 compilation error wrt. designated initializers
C++20 introduced designated initializers similar to the ones found
in C99, however, in C++ designated initializers cannot be mixed
with non-designated initializers. GCC rejects mixed initializers
with an error.
2024-05-03 07:16:57 +00:00
Barnabás Pőcze d80989ab56 treewide: fix errno assignments
Do not set `errno` to a negative value.
2024-05-01 09:28:17 +00:00
Wim Taymans 44f2ed7579 alsa: add sync.id in acp properties 2024-04-30 10:14:30 +02:00
Lukas Rusak 9e88aafa30 alsa-pcm: don't force quantum for iec958 formats
This fixes an issue introduced in 771f71f622
where the quantum is forced and may break applications the specify their
own quantum.

Signed-off-by: Lukas Rusak <lorusak@gmail.com>
2024-04-30 09:34:19 +02:00
Wim Taymans 8ff40e6252 loop: improve in_thread handling of invoke queue
Because we now have a dedicated queue per thread, we can simply add our
invoke item to the queue and then flush all the queues when we are
running in the thread of the loop.

This simplifies some things and removes potential out-of-order messages
that got queued while flushing.
2024-04-29 15:56:00 +02:00
Wim Taymans de0db48f17 loop: create a per-thread queue
Keep a thread local queue. This makes it possible for multiple threads
to write to the ringbuffer.

There is a lock to protect the list of queues. It can only be contended
when new queues are created in the threads but this can be done at
thread startup.

Fixes #3983
2024-04-29 15:17:45 +02:00
Wim Taymans c76424da36 loop: move invoke queue to separate object
Make an internal queue object that implements the invoke queue.

Because we can not do invokes concurrently from different threads, this
is required to make per-thread invoke queues later.
2024-04-29 12:10:48 +02:00
Pauli Virtanen ac35ecf329 journal: prepend code location to messages at debug log levels
Debug and trace log messages are often written based on the stderr
logging, where code location is always visible.

journalctl does not show the code location without extra tricks,
which makes user-submitted debug logs from journal more cryptic.

Make journal log more similar to stderr logs by prepending the code
location and log level in the log message when the log topic
level is >= DEBUG.
2024-04-28 16:02:28 +03:00
Wim Taymans 9bb5780cc2 meta: add explicit sync metadata and data type
Change the GenericFd data type to SyncObj. It's probably better to
explicitly state the data type than to make something generic. Otherwise
we would need to transfer the specific fd type somewhere else and there
is no room for that in the buffer and the the metadata is not a good idea
either because it can be modified and corrupted at runtime.

Add the SyncTimeline metadata. This contains 2 points on two timelines
(SyncObj datas in the buffer). The buffer can be accessed when the
acquire_point is signaled on the timeline and when the buffer
can be released, the release_point on the timeline should be signaled.
2024-04-25 09:55:19 +02:00
Barnabás Pőcze 6a26e6dd3f treewide: fix some format string issues
Use the proper specifier, and cast to a known type where the type
is not guaranteed by any standard.

See #3975
2024-04-25 07:24:10 +00:00
Wim Taymans 04bda2c28c spa: proxy tag and latency to peer of the mixer
We can probably do this better later but right now we do all of the tag
and latency handling bypassing the mixers.

Fixes #3970
2024-04-19 15:32:08 +02:00
Wim Taymans 2d87310b60 thread: add support for thread affinity 2024-04-18 17:45:35 +02:00
Wim Taymans e1e0a886d5 stream: improve async handling
We can remove most of the special async handling in adapter, filter and
stream because this is now handled in the core.

Add a node.data-loop property to assign the node to a named data-loop.

Assign the non-rt stream and filter to the main loop. This means that
the node fd will be added to the main-loop and will be woken up directly
without having to wake up the RT thread and invoke the process callback
in the main-loop first. Because non-RT implies async, we can do all of
this like we do our rt processing because the output will only be used
in the next cycle.
2024-04-18 15:20:07 +02:00
Wim Taymans 34be6c76a6 v4l2: fix printf format 2024-04-18 12:48:09 +02:00
Ashok Sidipotu 9062182985 spa: v4l2: encode device id into a json array 2024-04-18 14:02:55 +05:30