Commit graph

7124 commits

Author SHA1 Message Date
Wim Taymans
4d5ed3f292 modules: document metadata module 2025-01-27 16:13:14 +01:00
Wim Taymans
e210925c24 modules: document the metadata factory a little 2025-01-27 15:52:48 +01:00
Wim Taymans
aecb406a96 modules: document link-factory context.objects 2025-01-27 15:24:42 +01:00
Wim Taymans
8b02e5f737 stream: fix ticks calculation 2025-01-24 16:39:16 +01:00
Wim Taymans
fa15af376f context: avoid some scaling overflows
Make a macro to scale without overflows and use this in the context.
2025-01-24 16:23:01 +01:00
Wim Taymans
eb462302b7 docs: fix indentation of properties 2025-01-24 16:23:01 +01:00
Michael Tretter
0468712fea stream: fix ticks calculation if rate is 0/0
If the rate is 0/0, converting nsec to ticks doesn't work and will
result in 0 ticks, and it is not possible to convert ticks back to a
timestamp.

This can be reproduced by connecting a GStreamer pipewiresrc to a
libcamera node. The libcamera-utils has a rate of 0/0 and the
pipewireclock won't be able to determine a correct time with that.  This
error was caused by Commit 89993a3cc6 ("gst: enable the pipewire ticks
as a clock source").

Fix this by using the nsec as ticks and setting the appropriate rate.
2025-01-24 16:03:42 +01:00
Wim Taymans
5d35986329 doc: document module-link-factory 2025-01-24 15:35:46 +01:00
Wim Taymans
19d78ef195 module: improve loopback docs 2025-01-24 13:13:23 +01:00
Wim Taymans
40c1552402 modules: improve profiler docs
The profiler now can have arguments.
2025-01-24 12:53:13 +01:00
Wim Taymans
830bd19ca2 rtp: take into account ipv4/ipv6 when calculating header size
Calculate the header_size based on the IP version instead of using a
hardcoded value.

Fixes #4524
2025-01-24 12:45:05 +01:00
Taruntej Kanakamalla
180967bb64 gst: pipewirepool:fix lock evasion in release_buffer 2025-01-24 10:51:29 +00:00
Arun Raghavan
800cd53c56 gst: sink: Whitespace fixups 2025-01-23 10:17:19 -05:00
Arun Raghavan
9ece286c90 gst: Fix up some debug logs
Copy-pasto in the pause code, plus let's use GST_DEBUG_OBJECT() so
we can track which pool is affected.
2025-01-23 10:17:19 -05:00
Wim Taymans
de7016f155 filter: mark RT safe methods 2025-01-22 15:21:40 +01:00
Wim Taymans
122170ad62 stream: mark functions with RT safe
Add some docs about the process function being a realtime thread and
mark the functions you can call in realtime threads.

Fixes #4521
2025-01-22 13:04:59 +01:00
Wim Taymans
96d593cc34 rtp: idle the source when in timeout
Idle the source when no packets are received and resume when new packets
arrive.

Add a stream.may-pause property to pause the stream when no packets are
received during the timeout window.

Make sure the rtp.streaming property is updated correctly and as soon as
we get the first packet.

Fixes #4456
2025-01-21 16:51:31 +01:00
Wim Taymans
a44afd84ff sap: only send bye + new SAP when SDP changed
Reorganize some code to separate the creation and sending of the SAP
message.

Check if when the node changed, we have an actual change in the SDP
before we send BYE and the new SAP message. It's possible that nothing
changed, for example when the node simply changed state or an unrelated
property.
2025-01-21 15:43:10 +01:00
Wim Taymans
4b24619160 rtp-source: avoid bitfield races
The different bits are written to from different threads.
2025-01-20 14:00:21 +01:00
Wim Taymans
7da9c2b25d examples: surround loop_iterate() with enter() and leave()
See #4476
2025-01-20 12:00:02 +01:00
Wim Taymans
b97dd00f26 loop: add some more docs about loop_control
Add a gmainloop integration example.

See #4467
2025-01-20 11:48:07 +01:00
Wim Taymans
78649b12f6 thread-loop: clarify some docs about locking 2025-01-20 10:04:09 +01:00
Wim Taymans
d36a867788 gst: only return the custom flag when in _render()
Make a custom ACQUIRE flag and if it's set, return the custom error
when the pool is empty.
2025-01-17 17:08:07 +01:00
Wim Taymans
c7ccc5abca gst: handle blocking in the _render() function
When we do any other blocking in the render function, we should unblock
and call _wait_preroll() when we go to PAUSED.

We can have this situation when all the buffers are queued in the
pw_stream and we get a new _render() call. We can't get more buffers
from the pool and so we must block and wait.  When we go to PAUSED we
need to unlock and go to _wait_preroll(). Implement this by setting a
pool paused flag that is set when the sink goes to paused, we can then
return a special value that does the wait_preroll().

See !2248
2025-01-17 16:33:15 +01:00
Wim Taymans
c81910a51c gst: use gst_buffer_get_size() to get the buffer size
_get_sizes() contains the padding and we don't want to copy that.
2025-01-17 12:19:07 +01:00
Taruntej Kanakamalla
86e7429039 gst: pipewiresink: don't flush bufferpool in PLAYING_TO_PAUSED
Setting bufferpool to flushing state in PAUSED state is preventing the
buffer flow if there is a seek/flush event.
Instead, set the bufferpool to flushing during the `flush-start` event
and clear it during the `flush-stop`

Deactivate/activate the stream during flush event only if the sink is
in the PLAYING state. In the PAUSED or READY state, the stream would be
inactive and we do not want to alter that
2025-01-17 13:03:34 +05:30
Wim Taymans
c62905d911 pulse-server: clear old data when jumping forwards
When we write samples, check if we make a jump in the ringbuffer and
clear the samples we jumped over.

If we don't do this, the reader side might pick up old samples that we
didn't write or clear but that are now available for reading after we
made a jump in the ringbuffer.

This migh not be exactly what pulseaudio does but it is good for now.

Fixes #4464
2025-01-16 16:21:22 +01:00
Wim Taymans
cf7e917024 pulse-server: make a function to silence a buffer 2025-01-16 16:16:39 +01:00
Taruntej Kanakamalla
c0a6a7ea32 gst: handle flush event in pipewiresink
flush the pw buffers to the stream's queue during a FLUSH_START event
and return the unqueued pw buffers, if they are dropped/released without
being rendered, so they can be available to be dequeued for the subsequent
`acquire` calls
2025-01-15 17:03:21 +00:00
Taruntej Kanakamalla
b70e99c41a stream: new api to return unused buffer
Push the buffer back to `dequeued` in case of playback and capture.
This will help avoid starvation during events like seek/flush
2025-01-15 17:03:21 +00:00
Wim Taymans
24bcacc619 conf: remove client-rt.conf
We now automatically move non-rt clients into non-rt threads so the
client-rt.conf is obsolete.

Move the module-rt in client.conf and add conditions to disable modules.

Transparently load client.conf in case applications still specify
client-rt.conf.

Custon configuration in the client-rt.conf.d/ should be moved to
client.conf.d/
2025-01-14 12:40:05 +01:00
Pauli Virtanen
08700a9eb5 pipewire: use local real time timestamps in logging
Wireplumber and other system services use local real time timestamps in
logging, so it's more convenient if also PW uses them.

Add env var for selecting the timestamp type, default to "local".
2025-01-13 13:48:22 +00:00
Philippe Normand
13c869801c gst: core: Fixup connection error handling
Commit b57b5703d6 made use of `spa_strerror()`
which is incorrect here because pw_connect sets `errno`, so we should use
`strerror()`.
2025-01-12 11:42:29 +00:00
Philippe Normand
b57b5703d6 gst: core: Properly report connection errors 2025-01-12 11:15:04 +00:00
Wim Taymans
1030000890 network-utils: handle inet_ntop errors 2025-01-09 16:28:51 +01:00
Wim Taymans
509e769aa5 core: inherit the default.clock.quantum-limit from the server
Copy the server value to the context so that the locally allocated
buffers match the server quantum-limit and we don't cause xruns because
of too small buffers.

See #4490
2025-01-09 11:38:07 +01:00
Wim Taymans
feaa36560d pulse-server: increase max rate to 768000
Fixes #4482
2025-01-08 17:23:15 +01:00
Wim Taymans
3cf9ccf4a7 filter-graph: handle NULL in and out
We need to pass exactly n_inputs and n_outputs pointers to the process
function but make it possible to set some to NULL so that the data is
ignored.
2025-01-07 10:42:04 +01:00
Wim Taymans
49f48a5fda filter-graph: separate data and size for filter graph
Remove the chunk and add separate arrays with data and n_samples. This aligns
better with other methods and makes it possible to more easily reuse
arrays of pointers as input and output.
2025-01-07 10:38:32 +01:00
Wim Taymans
9f9e962dd6 filter-graph: pass spa_pod in get_props 2025-01-07 09:31:48 +01:00
Wim Taymans
c5ae456b9e filter-graph: pass dict to activate functions
This makes it possible to expand it more later.
2025-01-07 09:23:23 +01:00
Elliot Chen
419bc600a8 pipewiresink: split buffer and send them in turn if needed
For some streams, the buffer size is changed and may exceed
the acquired buffer size which is acquired from the pool of
pipewiresink. Need split buffer and send them in turn for
this case.
2025-01-03 15:58:37 +09:00
Arun Raghavan
974117f41a module-rtp: Fix previous typo fix
We want to track the difference between the PTP timestamp (now) and the
last RTP send, not the synthesized next RTP timestamp (which will always
be smoothly incrementing).
2024-12-31 15:24:46 -05:00
Arun Raghavan
c143e89118 module-rtp: Fix typo in check for lagging sender 2024-12-31 11:58:03 -05:00
Arun Raghavan
088d8011f2 tools: Document a couple of missing short form args for pw-loobpack 2024-12-31 11:22:49 -05:00
Elliot Chen
152a6683ef pipewiresink: active stream after finishing preoll when changing state from paused to playing 2024-12-30 11:48:34 +09:00
Niklas Carlsson
51e7ed3421 filter-chain: add sqrt plugin
To take the square root of the signal.
2024-12-20 17:58:08 +00:00
Niklas Carlsson
d7718dbcb7 filter-chain: add abs plugin
To calculate the absolute value of the signal.
2024-12-20 17:58:08 +00:00
Pauli Virtanen
e4ff13a75d module-loopback: support latencyOffsetNsec Prop
Add support for latencyOffsetNsec Prop, which just controls the nsec
part of the ProcessLatency.

This is needed to support latency offset in Pulseaudio apps when using
loopbacks as front-end nodes to underlying sinks.
2024-12-15 20:10:01 +00:00
Barnabás Pőcze
c556cced91 pipewire: module-raop-sink: remove unused function 2024-12-14 23:28:43 +01:00