Commit graph

12636 commits

Author SHA1 Message Date
Wim Taymans
7758bb2bb7 jack: jack_get_time() returns microseconds
As found by David García Goñi

Fixes #4128
2024-07-29 10:26:24 +02:00
Wim Taymans
b86ac34deb jack: don't check timestamps in mixdown
jack_port_get_buffer() can be called with 0 frames, This is to restrict
the available space in the returned midi buffer after mixdown. While we
mixdown, we should not check timestamps so that all midi events are
added to the mixdown buffer.

Fixes qsynth.
2024-07-29 10:26:13 +02:00
Wim Taymans
ad9dc1ec81 modules: don't unload module on stream error
Unloading the module on stream errors is a bit too much because a
suspend can clear the stream error again (or the error might not be
fatal)

This can happen for example when negotiation fails on some stream ports
(wireplumber tries to link the midi ports to audio ports) and it's
better to not completely fail on that.

Fixes #4121
2024-07-18 14:27:54 +02:00
Wim Taymans
08d14b7d51 impl-node: always INACTIVATE when stopping
A remote node is prepared when the Start command sync reply has been
received.

If we however quickly switch from active to inactive, the
pending reply is cancelled but the remote node will have set the
FINISHED status and will be ready to be scheduled.

Make it so that we always set the INACTIVE status when the node is
canceled and unprepared, even if we didn't get the reply and the node
was not prepared.

Fixes #4122
2024-07-18 14:27:16 +02:00
Daniel Lundqvist
4902646e73 module-jack-tunnel: Properly propagate error from dlopen()
dlopen() does not set errno on failure, rather you're supposed to call
dlerror() to get the latest error. dlerror() return a string so
instead return -ENOENT from weakjack_load_by_path().

Depending on errno weakjack_load() could think it successfully loaded
the library, and later module-jack-tunnel would crash because it call
a NULL function pointer.
2024-07-18 14:27:01 +02:00
Frédéric Danis
b19c3501e7 bluez5: backend-native: Send error for not supported event only as AG
The HS/HF roles should not sent error messages, only commands.
2024-07-18 14:26:32 +02:00
Pauli Virtanen
9478414773 alsa-card-profiles: revert HDMI/AC3 profiles
They don't work on all HDMI output devices, and availability is
not detected so they're available also when they don't work.

Selecting the profiles on non-working devices results to

spa.alsa: plug:{SLAVE="a52:0,'hw:0,3'"}p: snd_pcm_start: Broken pipe

and noise output to speakers. Revert these profiles from stable branch
for now as the break things.

This reverts commit 916d2cdb28.
This reverts commit d6c17681da.
2024-07-14 12:01:31 +03:00
Wim Taymans
1ba71c1be2 node-driver: 5 seconds of freewheel timeout is enough
We retry to run the graph every 5 seconds in case it didn't complete. A
10 seconds timeout feels quite long.
2024-07-12 12:30:42 +02:00
Wim Taymans
5f934b2b95 node: add a clock XRUN_RECOVER flag
Make a new flag that is set when the process function is called because
of a recover from a graph xrun.

Use this flag in the freewheel driver to detect a recover and to avoid
scheduling a new timeout. We should schedule a new timeout only when the
process function was called after completion.

This fixes export in ardour some more when the initial driver timeout
didn't complete (when, for example, some nodes were still starting up).
2024-07-12 12:30:37 +02:00
Eli Schwartz
3e210e4cf2 meson: fix conflicting use of feature-based dependency lookups
When spa-plugins is enabled, the gio-2.0 global dependency is
overwritten.

When bluez support is enabled, OR when gsettings is enabled, the gio-2.0
dependency is then detected as found. This means that
pipewire-module-protocol-pulse can end up enabling gsettings support
even if it has been forcibly turned off.

Rename the meson variables to ensure they are looked up separately.
2024-07-12 10:28:29 +02:00
Wim Taymans
f9689df37d 1.2.1 2024-07-12 09:24:23 +02:00
Wim Taymans
d55f5ef608 module-raop: remove unused deprecated header 2024-07-12 08:58:43 +02:00
Wim Taymans
16f629d224 thread: make it possible to set a custom create function
Make a property to pass a custom function pointer to create threads
instead of pthread_create.

Use this in jack instead of bypassing the thread utils create function,
which gives the wrong thread rt priority with rtkit.

Fixes #4099
2024-07-12 08:58:32 +02:00
Wim Taymans
f357798715 v4l2: Improve format and control enumeration
Use dynamic pod builder so that we can also build complex formats.

Make sure we zero the format before we parse it or else we end up with
potentially uninitialized values.

When ENUM_FRAMESIZES or VIDIOC_ENUM_FRAMEINTERVALS return EINVAL for the
first index, make a dummy result and continue with that. This will
trigger an intersect withe filter so that we end up with something valid
instead of nothing.

Handle 0 framerates without crashing.

See #4063
2024-07-12 08:58:09 +02:00
Wim Taymans
1447b660b5 v4l2: use a dynamic pod builder to handle larger PropInfo
The labels from the vivid driver need more space so use a dynamic
builder to make sure we can handle them.

See #4063
2024-07-12 08:57:53 +02:00
Wim Taymans
beb485799d module-snapcast: don't hardcode the JSON message id
Use a counter to make it increment for each message.
2024-07-12 08:57:43 +02:00
Wim Taymans
6da99d7070 module-protocol-simple: use interface address as server address
Move the address:port parsing code to the net helper. Add a default
address option.

Pass the interface address to protocol-simple and use this as the
default address for listening.

This makes sure that when the user passes tcp:3400 that we don't end up
publishing 0.0.0.0:3400 but the actual address of the interface we are
listening on so that the snapcast discover can use this to notify the
snapcast server.

Fixes #4093
2024-07-12 08:57:27 +02:00
Pauli Virtanen
916d2cdb28 alsa-card-profiles: reduce priority of HDMI/AC3 profiles
These don't appear to work correctly on all hardware, even if ACP thinks
they are present, so reduce their priority
2024-07-12 08:57:06 +02:00
Pauli Virtanen
a5e4ef7d11 spa: alsa: recognize plug+a52 as a52 device strings
HDMI/AC3 profiles use plug+a52 for a52 output, and should be handled
like a52.
2024-07-12 08:56:51 +02:00
Pauli Virtanen
aa74a502d0 spa: utils: explicitly preserve errno in spa_cleanup handlers
The cleanup handlers like free(), close(), etc. aren't necessarily
guaranteed to preserve errno, so do it explicitly.

This allows for usage in functions that return NULL + errno to signal
errors.
2024-07-12 08:56:44 +02:00
Pauli Virtanen
e7e1d25a89 spa: alsa: fix multiple %f in node device strings of nodes
ACP allows multiple %f in device strings (cf pa_alsa_open_by_template),
but we replace only one of them when emitting the nodes. The a52
profiles in default.conf use multiple %f and probably don't work.

Fix to replace also multiple %f when emitting ACP device nodes.
2024-07-12 08:56:20 +02:00
Pauli Virtanen
b80d115140 conf: fix context.exec args parsing
The 'args' can be either JSON array, or a string.  If a string it should
not be parsed as JSON for a second time, but instead split at
whitespaces.
2024-07-12 08:56:01 +02:00
David Coles
51b3778f7c loop: fix update_timer handling of solo repeat argument
I believe the intent here is that if a `interval` is provided
but `value` is unset, then `value` should default to `period`
so the timer first fires after one `interval`.

Since `interval` is always a relative duration, `value` should
be interpreted as a relative duration, not an absolute one.
2024-07-12 08:54:23 +02:00
Robert Mader
8dfae10746 gst: src: Reset transform on stream stop
When a stream is stopped, chances are high that downstream elements
change or get reset, i.e. don't remember a previously send rotation
event. Thus reset the transform value in order to ensure we create a new
one on the next stream start.

In order to not regress the case when downstream *does* remember the
orientation and the buffer orientation changes from e.g.
`TRANSFORMATION_90` to `TRANSFORMATION_None` between stream
stop and restart, initialize the remembered transform to an invalid
value and ensure we always send a rotation event, even for
`TRANSFORMATION_None`.
2024-07-09 13:08:42 +02:00
Robert Mader
2fcb90f661 gst: stream: Destroy stream before clearing variable
`pw_stream_destroy()` chains up to `on_remove_buffer()` in
GstPipeWireSrc which again needs the stream to still be around to call
`pw_stream_queue_buffer()` on it. By using `g_clear_pointer()` it will
already have been cleared, causing crashes.

Revert to the behavior from before the commit mentioned below and add a
comment in order to avoid regressing in a future cleanup.

Fixes: 0c40c0147 (gst: factor out the stream management and some common variables in a new class)
2024-07-09 13:08:26 +02:00
Wim Taymans
d08df293a9 impl-node: set INACTIVE state on server
Don't wait for the client to set the INACTIVE state, do it on the
server. We already decremented the target required so we don't want to
schedule the node anymore.

Fixes some xruns when removing nodes in a stress test.
2024-07-03 18:04:01 +02:00
Wim Taymans
525360d70a impl-node: disable async for driver nodes
Make it so that a driver node can never be scheduled async. It could
possibly make sense when the driver node is not currently driving the
graph but when it drives the graph it always needs to be sync. This
also simplifies the target activation because we can simply check the
async state and ignore if the node is driving or not.

Also make sure that we never make an async link with a driver output port.
This does not make sense because the driver node will always be
triggered sync first and before the async node so we can simply make
a sync link.

This fixes the modified (only generate 1 buffer) video-src -> video-play
case where the buffer never arrives in video-play because of the
useless async link.

Fixes #4092
2024-07-03 14:49:49 +02:00
Wim Taymans
e6c0014f94 context: Fix node collect with groups and sync enabled
Keep track of the sync nodes we added to a driver and bring in the other
nodes from the same sync group, group or link groups. This makes it
possible to have disjoint sync groups each with their own driver.

Fixes export in ardour8

Fixes #4083
2024-07-01 16:09:03 +02:00
Wim Taymans
82b9fa118f module-raop: only set softVolume when valid 2024-07-01 11:27:17 +02:00
Wim Taymans
b8d07e40d6 impl-node: fix required state for async driver nodes
When the node activation.required was incremented because it was a
driver, only decrement it in that case, regardless of the current driver
state of the node.

This fixes the case of KODI where the required field gets out of sync
and things become unschedulable.

Fixes #4087
2024-07-01 10:58:12 +02:00
Wim Taymans
7b4c0dd5ec 1.2 2024-06-27 15:31:45 +02:00
Wim Taymans
1e5d9cc635 impl-node: increment async driver nodes required field
A driver can't be async, we always need to be able to trigger it
to start it so increment the required field.

Fixes an issue with asunc drivers such as the video-src example or gnome
screen sharing.
2024-06-27 13:22:52 +02:00
Barnabás Pőcze
7732d0e3e5 pipewire: module-raop-sink: use uint32_t for sample rate
32 bits are enough, and additionally this also fixes an incorrect
format string, which caused the default `audio.rate` to be
incorrectly set on some platforms, such as 32-bit arm ones.

Fixes #4080
2024-06-27 09:46:45 +02:00
Christian Glombek
4067b3a985 module-rtp/stream: Fix setting marker_on_first prop for RAOP 2024-06-27 06:04:56 +02:00
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