Commit graph

31 commits

Author SHA1 Message Date
Wim Taymans
47ee9ef10a module-rtp: set the EMPTY flag on empty buffers
And make sure other flags are reset.
2025-07-03 20:57:19 +02:00
Wim Taymans
e825a6ae6c modules: reduce some errors from warn to info
Some of the more common errors (caused by packet loss, network jitter, ...)
should be reported with INFO unless there is some indication about how
to fix the problem.

Fixes #4559
2025-02-18 16:24:52 +01:00
Wim Taymans
cfc8d414a9 module-rtp: fix SSRC warnings
Fix indentation and also suppress the SSRC warning for other formats
than audio.
2025-02-17 10:21:17 +01:00
Arun Raghavan
25e58995f5 module-rtp-sap: Silently ignore other SSRCs if we know the receiver SSRC
If we know the receiver SSRC from the SAP, we can happily ignore packets
on other SSRCs.
2025-02-15 22:32:12 -05: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
45eee02a99 module-rtp: Account for in-flight samples in RTP receive
When not using PTP as the driver, it is possible that packet receive and
the process() callback are out of sync, meaning that the target buffer
fill level might be off by upto one ptime's worth of samples
occasionally. This would make the DLL hunt for the target rate, and
cause a constantly varying delay.

Accounting for the delta between the packet receive time and the
process() time allows us to eliminate this jitter, resulting in much
more consistent rate matching.
2024-11-27 11:48:50 +00:00
Wim Taymans
e1fc3de595 modules: use pw_stream_set_rate() some more 2024-11-22 09:55:36 +01:00
Wim Taymans
804df3389a modules: use pw_stream_set_rate() when we can 2024-11-22 09:49:27 +01:00
Wim Taymans
a53bc035c0 module-rtp: calculate payload_size based on MTU
The actual payload size depends on the MTU but should not include the
IP/UDP and RTP headers.

Fixes #4396
2024-11-11 11:49:20 +01:00
Jonas Holmberg
6223715918 module-rtp: Fix rtp timestamps
Because of operator precedence the timestamps where set to 0 if
set_timestamp was 0.
2024-10-23 16:12:55 +02:00
Arun Raghavan
292d6f5ca2 module-rtp: More u64 format fixes
Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4241
2024-08-28 21:55:15 -04:00
Wim Taymans
a77a6f3959 modules: for format string for u64
Fixes #4241
2024-08-28 16:21:30 +02:00
Arun Raghavan
48c2e95165 module-rtp: Clamp buffer fill level check on send side
This is based on target_buffer which is likely to be much smaller than
BUFFER_SIZE (currently 4MB). This is already done on the receive side.
2024-08-27 01:38:10 +00:00
Arun Raghavan
9f643fec7e module-rtp: Allow aes67 send with a non PTP clock
Our current AES67 sender setup requires that that PTP driver drive the
entire graph. This adds support for allowing the AES67 RTP sink to be
driven by an arbitrary driver, while still using the PTP driver for
sending data on the network.

When aes67.driver-group is specified a pw_filter is created with no
ports, node.always-process = true and node.group set to the
aes67.driver-group. When set to PTP, this gives us process callbacks at
the PTP rate which we use to get the current PTP time in the RTP sender
by interpolating the clock snapshots from the pw-filter.

Implementation ideas from Wim Taymans. Co-authored with Sanchayan Maity.

For a detailed reference, refer the following papers by Fons Adriaensen.
- Using a DLL to filter time
  (https://kokkinizita.linuxaudio.org/papers/usingdll.pdf)
- Controlling adaptive resampling
  (http://kokkinizita.linuxaudio.org/papers/adapt-resamp.pdf)
2024-08-27 01:38:10 +00:00
Arun Raghavan
9ccf62d4f6 module-rtp: Increase write timestamp tolerance
We allow a quantum of jitter in the write timestamp. The previous value
of 32 seems to be empirically determined, using the actual quantum
allows us to reason about this better.
2024-08-27 01:38:10 +00: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
Jonas Holmberg
64d75b6b2e module-rtp-sink: Send all remaining packets when stopping
Don't close rtp_fd until all packets have been sent by the timer, if
the timer is running when the stream is stopped.
2024-04-16 07:50:33 +00:00
Wim Taymans
5082e9f458 module-rtp: only stop timer when it was running 2024-02-15 17:48:58 +01:00
Wim Taymans
78055736a2 module-rtp: add packet timer
When multiple packets need to be flushed (because sess.latency is set
and larger than ptime) use a timer to space the packets uniformly in
the current quantum to avoid bursts.

See !1873
2024-01-30 10:06:27 +01:00
Wim Taymans
9a5609de2b modules: move some spa_debug_mem to the log
Instead of dumping to stderr, write it to the log file.
2024-01-11 17:49:50 +01:00
Dmitry Sharshakov
1fe6feac56 module-rtp: improve logging priorities
Previous state was useless for real debug at the current implementation level
2023-12-20 09:35:22 +00:00
Christian Glombek
9eba60a635 module-rtp/stream: Add ability to set marker on first packet 2023-10-09 10:52:25 +02:00
Wim Taymans
126e03ec73 rtp: add option to ignore SSRC
This is useful when there is a fixed receiver and the sender can be
restarted.
2023-07-06 12:55:28 +02:00
Wim Taymans
51a970f5b7 module-rtp: fix writing of audio samples
Always write samples according to the current write position, only use
the graph timestamp to align.
2023-03-13 15:14:41 +01:00
Wim Taymans
bcc052f5f1 module-rtp: move stream init to specific media types
Move the stream function setup to a stream specific method.
Keep a separate stream format, that can be different later from the
rtp format once we add encoding.
Rename some methods to make them more unique.
2023-03-12 18:40:36 +01:00
Wim Taymans
f841a0d3f1 module-rtp: send journal feedback
Parse the journal and send feedback.
Handle the NO and RS commands.
2023-03-10 10:47:03 +01:00
Wim Taymans
c5effbd979 module-rtp: add timer for ck requests
Scale RTP timestamps against the clock, allow some jitter.
Make method to query current RTP timestamps.
2023-03-09 13:14:23 +01:00
Wim Taymans
8e5b9da177 module-rtp: fix direct timestamps
fix some other properties.
2023-03-09 13:14:23 +01:00
Wim Taymans
7a31278511 module-rtp: improve properties and some cleanups 2023-03-09 13:14:22 +01:00
Wim Taymans
7da031c969 module-rtp: add new rtp-session module
The module uses the apple session setup for managing peer connections.

Make a generic rtp stream object, make midi and audio implementations.
2023-03-09 13:14:21 +01:00