Commit Graph

9748 Commits

Author SHA1 Message Date
Wim Taymans
46123cfcec v4l2: improve debug 2022-11-05 13:11:43 +01:00
Wim Taymans
0e8ea21098 v4l2: fix compilation on older versions 2022-11-04 21:26:19 +01:00
Wim Taymans
b6f1935cfb v4l2: fix streaming compliance test
Add sequence number to frames.
Fix mmap tracking.
Improve debug.
Set right flags on dupped fds.
Handle blocking dqbuf.
Set timestamp and field on buffers.
Dequeue buffers in streamoff.
2022-11-04 17:34:04 +01:00
Wim Taymans
7631316186 buffer: add option to reverse filter priority
By default, buffer negotiation favours the default property values of
the output node. Make this configurable and reverse this logic when the
output is a driver.

This makes it so that a stream connecting to a source will negotiate
with the preferences of the stream and not the source.

An example is a stream that wants 4 buffers from v4l2-source, because
v4l2-source has a default of 4 buffers, this will always result in 4
buffers, ignoring the preference of the stream.
2022-11-04 15:22:01 +01:00
Wim Taymans
503bb94645 v4l2: we can request just 1 buffer perfectly fine 2022-11-04 15:21:32 +01:00
Wim Taymans
4186e3da6b v4l2: implement G/S_PRIORITY
Return busy when reqbufs is called from an fd that is not the owner
of the current reqbufs.
2022-11-04 13:14:46 +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
5a299e5685 v4l2: improve debug 2022-11-04 11:00:56 +01:00
Wim Taymans
4a92f355ad v4l2: fix enum_input, don't clear the index 2022-11-04 11:00:19 +01:00
Wim Taymans
8900722f55 v4l2: only accept CAPTURE buffer types in try_fmt 2022-11-04 10:59:39 +01:00
Wim Taymans
5a262b4bd3 v4l2: return a default format from G_FMT 2022-11-04 10:59:13 +01:00
Wim Taymans
73ad5d9057 v4l2: set colorspace 2022-11-04 10:58:50 +01:00
Wim Taymans
0f13d5a65e v4l2: reuse fd when opening the same path
When we open the same device multiple times, reuse the file structure
and dup the fd.
2022-11-04 10:36:49 +01:00
Wim Taymans
4cb1c790a4 v4l2: set the description correctly
The description needs to match what is expected by the compliance
test.
2022-11-03 17:36:55 +01:00
Wim Taymans
9aff5dfc8f v4l2: make bus_info compliant
It needs to start with something accepted by the compiance test.
2022-11-03 17:35:48 +01:00
Wim Taymans
2c4b574b8f v4l2: handle errors better
Only store the eventfd when valid or else we will try to close an
invalid fd.
Keep the errno value around, just in case it gets overwritten by
the free_file call.
2022-11-03 17:34:00 +01:00
Wim Taymans
faab559568 v4l2: handle multiple /dev/videoX nodes
Associate each PipeWire video source to a video device and let
applications probe and open multiple sources.
2022-11-03 13:27:49 +01:00
Wim Taymans
fbd3885ff1 v4l2: small cleanups
Improve size scoring.
Check video size after parsing.
2022-11-03 13:25:44 +01:00
Wim Taymans
866ef2ef21 v4l2: improve debug of fourcc 2022-11-03 13:25:10 +01:00
Wim Taymans
a6e3ac68d2 v4l2: use the node description as the card name 2022-11-03 13:23:26 +01:00
Wim Taymans
cd9dc974f5 v4l2: improve error debugging 2022-11-03 13:22:38 +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
c30d743198 pw-top: initialize info struct with 0
So that we don't accidentally print uninitialized values.
2022-11-03 13:08:48 +01:00
Wim Taymans
e3a4797063 pw-top: support MJPG and H264 formats 2022-11-02 17:14:40 +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
3e4da8e8e4 filter-chain: emit en error when graph fails 2022-11-02 12:58:37 +01:00
Wim Taymans
f6e76f8356 filter-chain: add more default LADSPA search paths
Add /usr/lib/ladspa and LIBDIR to the default search path as well.
2022-11-02 12:57:16 +01:00
Wim Taymans
8ab70d02dc stream: guard against node destroy 2022-11-02 12:56:45 +01:00
Wim Taymans
ef8114ff0c filter-chain: improve some error messages 2022-11-02 12:42:31 +01:00
Wim Taymans
6bb73124aa filter-chain: improve some float handling
Avoid some double to float conversions.
Use fmin and fmax.
2022-11-02 12:41:20 +01:00
Wim Taymans
f801dc0886 pulse-server: keep read index in sync
Keep the ringbuffer and read_index variable in sync or else we might ask
for more data than maxlength and cause an overflow.

Fixes #2799
2022-11-02 11:43:30 +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
Wim Taymans
c5f7d3a728 param: improve pw_param
Add a sequence number to pw_param.
Add param_info to param_update to filter out the params of the latest
sequence number.

This can be used to track params from a certain sequence number. Update
node, port and device.
2022-10-30 14:57:04 +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
Ashok Sidipotu
f383956b7b module-pipe-tunnel: Update the description of the module. 2022-10-28 07:07:43 +00:00
Ashok Sidipotu
315b2d1ad5 module-pipe-tunnel: Initialize the target.node property
Initialize the PW_KEY_TARGET_OBJECT property on the stream node based on the
user config.
2022-10-28 07:07:43 +00: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
a989230cb5 introspect: update the info more carefully
Only change the fields we care about and leave the other ones
untouched in the created info.
2022-10-27 20:09:25 +02:00
Wim Taymans
d2aa240767 introspect: handle NULL result from info updates 2022-10-27 20:06:54 +02:00
Wim Taymans
552d4516b6 params: count params per id from 0
Only increment the index when we find the requirested param, this
makes the params go from index 0 to the last instead of starting at some
random index. The random index is not really a problem but it is also
no so nice.
2022-10-27 19:20:40 +02:00
Wim Taymans
f0328a1f8d protocol-native: improve logging
Add an end marker in the log for the message.
Log the output messages with the right log topic.
2022-10-27 18:04:14 +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
Wim Taymans
122252ce52 alsa: add brackets for clarity 2022-10-27 09:12:06 +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