Commit graph

3351 commits

Author SHA1 Message Date
Wim Taymans
b46d8a8c92 alsa: force playback start when buffer is full
When we try to play data but the ringbuffer is full, we need to start
the device or else we will stay in this situation forever and stay
silent.

Fixes #2830
2022-11-16 20:45:38 +01:00
Wim Taymans
50a24ac69e acp: do probing in 44100 Hz again
Some devices don't seem to work when probed in 48000 so bring it back
to 44100 until we figure out what is going on.

Fixes #2718
2022-11-15 16:30:26 +01:00
Wim Taymans
086ad336ad audioconvert: redo setup when format changes 2022-11-15 16:29:46 +01:00
Wim Taymans
bf3516ba04 audioadapter: perform setup again after a PortConfig
After the ports are reconfigured, we need to perform the setup again so
that buffers and processing can happen with the right settings.

This fixes an issue when autoswitching between A2DP and HFP with
bluetooth headsets when there is also a stereo capture device available.
The input stream of the browser is quickly reconfigured between stereo
and mono with only a Pause command in between, clearing the setup state
is enough to redo the setup when going back to Playing.

Fixes #2764
2022-11-15 15:40:47 +01:00
Barnabás Pőcze
14e044a92c spa: bluez: backend-native: fix filtered number memory leak
The `number_filtered` variable was dynamically allocated but never freed.
2022-11-14 16:15:21 +00:00
Wim Taymans
93d2571b30 libcamera: fix device id assignment
Find a free id from the available ids instead of just taking the current
number of devices, which would give assign the same id to multiple
cameras when: added 0, added 1, removed 0, added 1.
2022-11-14 16:04:21 +01:00
Wim Taymans
a57590e334 libcamera: emit device removal event
We need to emit the device id with NULL info to emit a device remove
event.

Also indent some code properly.
2022-11-14 15:38:16 +01:00
Wim Taymans
4da154c3a9 libcamera: handle errors better
Make sure we disconnect the request complete handler when we failed
to start.
Stop the camera when we failed to queue our requests.
2022-11-14 13:24:07 +01:00
Wim Taymans
bf8981ef61 libcamera: fix setting controls
Use the set_control function of v4l2 and libcamera also to set
properties from a sequence.
2022-11-14 11:22:53 +01:00
Wim Taymans
cfb226b0fb v4l2: improve debug
Add device path to debug lines.
2022-11-14 11:22:53 +01:00
Dmitry Sharshakov
e0c9f87d78 bluez5: backend-native: prevent string overflow
Fixes -Wfortify-source when building
2022-11-13 15:13:33 +03:00
Wim Taymans
04aa803d7e test: avoid compiler warnings when SSE is not enabled
Refactor the sample test and run the test against itself to make
sure we use all variables at least once.
2022-11-11 12:09:22 +01:00
Wim Taymans
8d6ff6137d audioadapter: remove checks for format
This is meant to be a filter for the follower format and can thus
contain wildcards.
2022-11-09 16:29:04 +01:00
Wim Taymans
85ffe68ea3 Revert "adapter: removed unused follower_current_format"
This reverts commit 6c963ed933.

This code was meant to set a filter on the format for the follower
but is not implemented yet.

Problem is that the unit tests and wireplumber call this code and would
need to be patched.
2022-11-09 16:24:49 +01:00
Wim Taymans
6c963ed933 adapter: removed unused follower_current_format 2022-11-09 16:03:18 +01:00
Wim Taymans
b07e0c1445 audioconvert: debug in and out positions 2022-11-09 15:19:46 +01:00
Wim Taymans
bb002a3eef test: add test for 6p1 to 5p1 with remapped REAR
See #2809
2022-11-09 09:41:21 +01:00
Wim Taymans
39bfc0cb56 test: add more 5p1 to 6p1 tests
See #2809
2022-11-09 09:24:03 +01:00
Wim Taymans
25e3144887 audioconvert: skip upmix when moving channels
When we use SIDE for REAR, don't try to upmix REAR channels and vice
versa.
2022-11-09 09:24:03 +01:00
Wim Taymans
a500abaf90 tests: add some more 6p1 conversion tests
Also add a 6p1 to 5p1 downmix test.

See #2809
2022-11-08 18:10:11 +01:00
Wim Taymans
cadb7b4910 audioconvert: set SSE flag on SSE function
Or else it might be selected even when we don't run on an SSE capable
machine.
2022-11-08 18:09:02 +01:00
Wim Taymans
c8e2c4fcd6 audioconvert: debug the conversion matrix with info level 2022-11-08 17:39:16 +01:00
Wim Taymans
9cfc0eff48 audioconvert: upmix RC 2022-11-08 17:38:55 +01:00
Wim Taymans
f6d7d4372b libcamera: add Format to node params as well 2022-11-08 16:24:27 +01:00
Wim Taymans
67dcb72295 loop: don't assert in cleanup
Just issue a warning instead of asserting. Firefox does strange things
to the fds that make things crash otherwise.
2022-11-08 15:45:55 +01:00
Wim Taymans
cb18c5877b libcamera: check for item in map correctly
Fixes #2817
2022-11-08 10:41:18 +01:00
Pauli Virtanen
e96b0ed4a8 alsa: minor fixes in seq code
port_enum_params should use right param id for SPA_PARAM_Format.

Fix typoed , instead of ; at end of line. Pop frame before putting
state.offset, in case there would be padding added (apparently usually
no).
2022-11-08 09:33:56 +00:00
Pauli Virtanen
e381a26de9 bluez5: don't put side effects into spa_log_* arguments
spa_log_* are macros such that their arguments don't get executed if the
log topic is not enabled.
2022-11-07 20:22:45 +02:00
Dmitry Sharshakov
02a4758043 bluez5: aac, lc3plus: report bitpool changes
Behavior similar to SBC. This makes return value useful for media-sink logger.
2022-11-07 16:32:53 +00:00
Dmitry Sharshakov
1bea58c20b bluez5: media-sink: fix bitpool increase
The free buffer check must happen before writing to check for leftover data in buffers. In case data is left over from previous submission, bitpool mustn't be increased.
Also improved logging by adding bitpool to the log message.
2022-11-07 16:32:53 +00:00
Dmitry Sharshakov
79b95e083a bluez5: backend-native: report HFP AG battery indicator to UPower 2022-11-07 16:32:17 +00:00
Wim Taymans
492920ca35 test: add another 6.1 channelmix test
Reorder the bitmask in the natural channel order to avoid confusion.
Add another test with RL/RR/RC channels.

See #2809
2022-11-06 10:57:25 +01:00
Wim Taymans
ccec687104 test: add unit test for 6.1 up and downmix
See #2809
2022-11-05 17:12:35 +01:00
Wim Taymans
503bb94645 v4l2: we can request just 1 buffer perfectly fine 2022-11-04 15:21:32 +01:00
Wim Taymans
ccf2891070 v4l2: fix buffer amount check
When we get buffers from the driver, check if we have at least as many
as we requested. If we have more, that's ok, we will simply not queue
them.

Previously we would ignore the input number of buffers and use the
allocated amount to fill up the buffer array, which might be too small
and then we crash.
2022-11-04 13:10:55 +01:00
Wim Taymans
ec5f2d7337 v4l2: add Format on the node as well
So that we can see the format in pw-top
2022-11-04 13:10:17 +01:00
Wim Taymans
44d743ed95 spa: make all format parsing fields optional
Just like the optional build, make all field parsing optional. This
will leave the fields with their default values if they are not parsed
from the param.

We can then remove our custom functions and use the generic ones in
various places.
2022-11-03 13:13:07 +01:00
Wim Taymans
74447acedb Add some more format checks
The format parse functions don't really check if the parsed values
make any sense so we need to to this ourselves.
2022-11-03 13:10:32 +01:00
Wim Taymans
e0c0d9806f libcamera: clear format info
Or else we end up with invalid data for the fields that did not get
initialized when parsing the format param.
2022-11-02 17:14:01 +01:00
Wim Taymans
51e8ff7d8e libcamera: add EnumFormat param to the node 2022-11-02 10:35:48 +01:00
Wim Taymans
ef4b9745b2 libcamera: handle canceled requests
When a request is canceled, recycle it so we don't run out of buffers.
Implement getting and setting controls.
2022-10-31 19:03:55 +01:00
Wim Taymans
71d58e6445 v4l2: implement setting controls 2022-10-31 11:33:45 +01:00
Jaroslav Kysela
a2278a5f70 spa: support the speakers (output) only case in report_jack_state()
The Realtek ALC4080 USB audio device (integrated in the
motherboards) can detect the presence on all I/O jacks.

If user connects only speakers, it's a valid case.

BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2744
2022-10-29 20:22:06 +02:00
Wim Taymans
e6fd5888ee param: add a new user seq field in the param-info
Add a new seq field in the param-info struct. Users can use this
field to keep track of pending param updates.

Store the latest seq number of the param update in the seq field. Remove
all params that don't match the sequence number because they are too
old. This avoids duplicate old params in pw-dump output.

Rework the pulseaudio manager with this same method.
2022-10-27 20:10:33 +02:00
Wim Taymans
855bebf0ea audioconvert: update started field better
Set up the adapter and then set the started field to true before we
Start the follower and converter. It is possible that the follower will
start processing immediately so the started state needs to be set
correctly.

Similarly, first perform the Pause and Suspend calls on the follower
and converter before clearing our buffers and format so that things
are stopped properly.

See #2764
2022-10-27 10:29:15 +02:00
Pauli Virtanen
cc4e5a89b4 bluez5: fix BAP codec sink flag usage
MEDIA_CODEC_FLAG_SINK means the local endpoint is sink. Have this the
same way for BAP, no need to invert it.
2022-10-26 20:14:34 +03:00
Pauli Virtanen
d0d783541d bluez5: reduce the number of registered Opus endpoints
The different source modes can share the same endpoint.
2022-10-26 18:59:26 +03:00
Pauli Virtanen
d94832942e bluez5: allow codecs to share endpoints
AVDTP in principle allows 62 endpoints, but in practice it appears some
devices (Samsung Galaxy Buds2 Pro, Redmi Buds 3 Lite, probably others)
fail to connect A2DP when the number is somewhere above 24.  A2DP
connection works when initiated from the Central, but not when the
device itself does it, so these devices are not fully broken.  We should
reduce the number of registered A2DP endpoints to avoid running into
problems with such broken devices.

Some of our source codecs are the same actual codec with the same
configuration, and don't need separate source endpoints.

Allow codecs to not have a registered endpoint (fill_caps == NULL), and
tolerate codecs with the same endpoint name.  In codec switch, keep
track separately which of the codecs with the same endpoint name the
local endpoint is currently associated with.
2022-10-26 18:59:26 +03:00
Pauli Virtanen
99406aefea bluez5: deal with missing endpoint path in selectproperties 2022-10-26 18:59:26 +03:00
Wim Taymans
0396ca4931 libcamera: let the session manager set pause-on-idle 2022-10-25 20:27:14 +02:00