Commit Graph

12602 Commits

Author SHA1 Message Date
Christian Glombek
34ae5ce649 module-raop-sink: Fix setting sess.ts-direct prop 2024-06-27 05:44:50 +02:00
Arun Raghavan
3f35b80402 spa: aec: webrtc: Fix multichannel processing
Missed this parameter while porting to webrtc-audio-processing 1.0.
2024-06-25 15:34:30 -04:00
Barnabás Pőcze
7674b15fab pipewire-v4l2: move open*() flag check into function
This commit moves the check that determines whether the mode
argument of `open*()` exists into a separate function.

With that, the check is fixed because previously it failed to
account for the fact that `O_TMPFILE` is not a power of two.

Furthermore, add `assert()`s in the fortified variants that
ensure that no mode is required by the specified flags.
2024-06-25 19:10:13 +02:00
Wim Taymans
9d1d1fcbef impl-port: add port.group property
Can be used to group ports together. Mostly because they are all from
the same stream and split into multiple ports by audioconvert/adapter.

Also useful for the alsa sequence to group client ports together.

Also interesting when pw-filter would be able to handle streams in the
future to find out what ports belong to what streams.
2024-06-24 13:38:09 +02:00
Quentin
54c3fa06ed Update oc.po 2024-06-24 09:53:51 +00:00
Arun Raghavan
92c9b27c94 pw-cli: Dump object info on events
This prints changed state, props and params when run with -m and running
the `info` command. We try to print only things that have changed. It
would probably be good to make the props (and params) print a diff of
what's changed as well.
2024-06-21 16:08:24 -04:00
Arun Raghavan
8cd857733b module-rtp: Check if packet receive works to track receiving state
If the sender is reset, the RTP stream may return, but may no longer
correspond to the stream for which we loaded this instance of
module-rtp-source. A power cycle or network reset on Dante devices
causes a new SDP and SSRC to be selected, for example.

So let's make sure we don't consider invalid receives while tracking our
"receiving" state. Arguable, we should bail entirely if this happens.
2024-06-21 15:39:47 -04:00
Pauli Virtanen
6b6e9c4ea9 bluez5: make node.group valid JSON
The node.group property is parsed as JSON, and as it here contains ":"
it needs to be quoted accordingly. Fixes pw_strv_parse errors in logs.
2024-06-21 13:29:30 +03:00
Vlad Pruteanu
88d9d58333 bluez5: bap: Rework broadcast code length check
Co-authored-by: P V <pav@iki.fi>
2024-06-20 21:06:32 +00:00
Vlad Pruteanu
4c1271805e bluez5: bap: Fix parsing of broadcast code
This fixes the endianness of the parsed broadcast code. It also
fixes pontetial out-of-bouns write by using a bigger, temporary
bcode string, then, after checking it's length, copying it's content
to big_entry->broadcast_code.
2024-06-20 21:06:32 +00:00
Michael Tretter
1b7cf61632 gst: pipewiresink: wait for activated buffer pool before updating buffers
PipeWire expects the SPA_TYPE_OBJECT_ParamBuffers to be valid after
setting SPA_PARAM_Format. The pipewiresink knows the final buffer size
only after the pipewirepool has been activated.

There is a race between PipeWire asking the pipewiresink for the buffers
and GStreamer activating the buffer pool. If GStreamer has not activated
the buffer pool before PipeWire asks for the Buffer params, PipeWire
won't allocate buffers with the correct type and size.

The chance of hitting this window increases, if the upstream GStreamer
element doesn't use the buffer pool. In this case the buffer pool is
activated by the first buffer that arrives at the pipewiresink, which
may take some time.

Instead of not updating the Buffer params when the buffer pool is not
active, wait for the buffer pool to become active.
2024-06-20 21:05:45 +00:00
Michael Tretter
21358526d5 gst: pipewiresink: extract gst_pipewire_sink_update_params
Add a helper function for updating the params instead of handling it in
the pool_activated callback. This allows to explicitly set the params
from the element.
2024-06-20 21:05:45 +00:00
Michael Tretter
6468e5338f gst: pipewirepool: print buffer type with numeric value
If the buffer type is invalid, the short_name will be (null). Printing
the numeric value helps the reader to understand the (null) type.
2024-06-20 21:05:45 +00:00
Barnabás Pőcze
6acfb53884 pipewire: module-roc-sink: explicity specify sender packet encoding
roc-toolkit commit 03d29eb97211ca87593566998c5087590c1bae38 [0]
("Add sample_format() and pcm_format() to SampleSpec") made
a change in how the packet encoding is determined. Specifically:

  This commit introduces small breaking change in C API:
  when we search for packet_encoding compatible with
  frame_encoding, we now take into account format too.

  It means that if you use ROC_FORMAT_PCM_FLOAT32 in frame_encoding,
  ROC_PACKET_ENCODING_AVP_L16_STEREO will not be selected automatically
  anymore, and you need to specify it manually via packet_encoding.

This causes module-roc-sink to fail to set up the ROC sender:

  roc_api: bad configuration: failed to select packet_encoding matching frame_encoding, set roc_sender_config.packet_encoding manually

So specify `ROC_PACKET_ENCODING_AVP_L16_STEREO` explicitly
as the packet encoding. This seems to work with roc-toolkit 0.3,
so the required version is not changed.

Fixes #4070

[0]: 03d29eb972
2024-06-20 21:04:40 +00:00
Wim Taymans
ea7e0e9152 spa: revert peer_enum_params node event again
It's not used anymore because it does work so well.

The problem is that while it transparently proxies param enums on
ports to peers, it fails to emit events when those peer
params change in a way that would make the enum result change as well.
This makes it quite hard to use this correctly.
2024-06-20 10:22:45 +02:00
Michael Tretter
7b8b6d92d9 gst: pipewiresink: decrease log level of on_process to LOG
on_process is called whenever a buffer may be queued. This happens for
every buffer. The correct log level is LOG.
2024-06-19 15:43:06 +00:00
Michael Tretter
3b581b2417 gst: pipewiresink: print stream state as string
Print the state of the stream not only as the numeric value, but also
print the name of the state to help the reader.

While at it, add the sink element to the log output to be able to
identify the sink that received the state change.
2024-06-19 15:43:06 +00:00
Arun Raghavan
4d14531444 module-rtp: Drop redundant include 2024-06-19 11:16:09 -04:00
Arun Raghavan
9559b9382b module-rtp: Propagate cleanup.sec to module-rtp-source
This might be specified on a `create-stream`, but then not actually
applied as a module argument, and thus be ignored.
2024-06-19 11:15:17 -04:00
Arun Raghavan
2c7272a13a module-rtp: Set receiving state on stream as a property
There isn't a good way to surface this information to the module owner
yet, so let's publish the information on the stream so we can try to
manage things in policy.
2024-06-19 10:49:51 -04:00
Wim Taymans
41691f8bc9 module-vban: fix some implicit float conversions 2024-06-18 16:05:36 +02:00
Wim Taymans
51bf143a77 module-rtp: fix fmodf usage 2024-06-18 16:01:41 +02:00
Wim Taymans
a76d262db6 modules: fix compilation 2024-06-18 15:47:02 +02:00
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
ae7ec595a2 1.1.83 2024-06-18 12:47:40 +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
Wim Taymans
50870aac57 impl-node: move node_peer functions to impl-node 2024-06-18 09:49:01 +02:00
Wim Taymans
33f1a713cd impl-node: set active_driver_id
This is the driver id that the client has received and is using right
now. We don't use this yet but it could be used in the future to check
if a client has the most up to date info.
2024-06-18 09:47:33 +02:00
Robert Rosengren
3cbda26f07 gst: src: disable active state when only going to PAUSED
The pipewiresrc starts the stream in active state but should be inactive
if only going to PAUSED state. This patch sets the stream to inactive
when wait_started has returned in the GStreamer state tranistions.

Also resets internal started state when going PAUSED -> READY.

Fixes #4049
2024-06-17 15:11:48 +02:00
Wim Taymans
a07f73ce82 impl-node: add more backwards compat
Make sure newer clients can work with an older server:

- Add client and server versions in the activation
- On older server, clients needs to trigger peers without CAS of status
- On older server, jack transport is started with command.
- Use client version to know when to set the INACTIVE/FINISHED
  state on the server instead.
- Async clients need to trigger peers on old server.
2024-06-17 12:07:09 +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
Wim Taymans
e045ef0e4c impl-node: add compat with old nodes 2024-06-14 12:41:03 +02:00
Wim Taymans
c89a68b0b4 impl-node: handle node <-> driver links with node_peer
Also handle the relation between a node and the driver with pw_node_peer,
like we do with the links.

Because these are refcounted, we only make one peer for a node that is
linked to another node that is also the driver (pw-play -> sink) and we
save some fds as well as some admin stuff and overhead for the refcounts.

This in return then results in less problems getting all the refcounts
right when adding/removing nodes.
2024-06-14 11:52:59 +02: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
b7af52e3fb impl-node: partially revert target rework
We can't let a client decrement the required state because if it crashes
or fails to decrement, the graph becomes unschedulable.
2024-06-13 17:40:55 +02: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
Barnabás Pőcze
eed7eb1556 pw-dump: sync on metadata change so that changes are displayed soon
In order to show metadata changes when monitoring, a sync must be
triggered just like it is done for other objects, to make sure that
`dump_objects()` is called some time later and the changed metadata
objects are shown.

Otherwise metadata changes would never be displayed unless there
was a change to a different type of object, whose event handlers
do trigger a sync.

Fixes #4053
2024-06-13 00:04:11 +02:00
Wim Taymans
d04a28daef impl-node: clean up the configuration of the Position io area
Set the new IO Position after we removed the node from the old driver
and before the new driver is going to schedule the node. This makes
a little more sense.
2024-06-12 09:56:57 +02:00
Wim Taymans
1d0d67da1c jack: queue free of old mem in node_set_io as well
Avoid freeing the old io Position area before the data loop has managed
to get a pointer to it. Queue a free operation that will be executed
from the main loop after the data loop has the io area.

Fixes a crash when stressing jack clients to switch between drivers.
2024-06-12 09:54:12 +02:00
Arun Raghavan
9da01413a1 gst: sink: Disable active state setting when going to PAUSED
On first start, the stream is set to be active when connected. However,
when the element is going to PAUSED and not subsequently to PLAYING,
this is incorrect behaviour.

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4049
2024-06-12 06:58:44 +00:00
Michael Tretter
a9bf5fa24a gst: fix JPEG format
Since commit f400ff2050 ("gst: Check for video/ caps before parsing
for info") JPEG support in the GStreamer elements is broken as JPEG is
not recognized as a video format anymore.

gst_video_info_from_caps is able to handle "video/" and "image/"
formats. Therefore, the check needs to allow "image/" too.

While at it, cleanup the formatting to make the check more readable.
2024-06-12 06:56:03 +00:00
Michael Tretter
3b68b5088b gst: pipewiresrc: move correct brace under HAVE_GSTREAMER_DMA_DRM
The HAVE_GSTREAMER_DMA_DRM belongs to the inner brace, not the outer
brace, since the inner if statement is under HAVE_GSTREAMER_DMA_DRM.

While doesn't make a difference to the compiler, but confuses a reader.

Put the other brace under the HAVE_GSTREAMER_DMA_DRM.
2024-06-12 06:56:03 +00:00
Wim Taymans
b0ce5d0dd8 jack: don't call free_link from the data thread
We are not allowed to call free_link from the data thread because it
does free() and some pw_mem calls which should only be called from the
main thread.

To solve this, pause the core, queue a free_link operation on the data
thread, which will be scheduled after the previous remove_link operation
completes, free the link and then resume the core. Blocking and resuming
the core is necessary because we can't block for completion of the
invoke calls (the jack method is not allowed to block) and we must
ensure that nothing can happen with the memory (like reuse the mem_id)
before we have cleaned it up.

Fixes a crash in jack with create/destroy link stress.
2024-06-11 17:17:32 +02:00
Wim Taymans
cdfe95c091 pw-link: avoid crash when proxy was already destroyed
When a link already exists, the link will fail and the proxy will be
destroyed and the pointer set to NULL. Avoid doing things with the NULL
pointer when cleaning up.
2024-06-11 15:57:44 +02:00
Wim Taymans
c48c444566 pw-link: avoid memleak when proxy create fails 2024-06-11 15:57:21 +02:00
George Kiagiadakis
8da35df0bf gst: use G_DECLARE_FINAL_TYPE for all classes 2024-06-11 12:51:51 +00:00