Commit graph

60 commits

Author SHA1 Message Date
Christian Glombek
4067b3a985 module-rtp/stream: Fix setting marker_on_first prop for RAOP 2024-06-27 06:04:56 +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
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
c3d4abd7f1 modules: use acquire/release loop
Expose the acquire_loop/release_loop functions and use them in the
modules.

Make sure the nodes created from the module use the same data loop as
the module. We need to ensure this because otherwise, the nodes might
be scheduled on different data loops and the invoke or timer logic will
fail.
2024-04-22 16:19:02 +02:00
Jonas Holmberg
09088b376f rtp_stream: Use the log topic of the module
Set log topic to the topic of the module linked with stream instead of
logging with "default" topic.
2024-04-17 07:13:53 +00: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
4ffd74ef46 module-rtp: handle state change errors better
Make a new function to set the rtp stream in the error state.

When we fail to start the stream, set the error state. Otherwise (like
when we try to use an invalid interface name) the socket create will
fail but the stream will still try to send data to the invalid socket.
2024-03-25 12:22:11 +01:00
Wim Taymans
f4e391dd41 stream: add pw_stream_get_nsec() to get current time
Make a method to get the current time to compare agains the pw_time-now
field. This is currently CLOCK_MONOTONIC but make this into a method
so that we can more easily change it later.
2024-03-04 12:59:26 +01:00
Wim Taymans
5082e9f458 module-rtp: only stop timer when it was running 2024-02-15 17:48:58 +01:00
Jonas Holmberg
4715fa1775 module-rtp: Add source/destination.ip to props
Make it possible to change source.ip in module-rtp-source and
destination.ip in module-rtp-sink.
2024-02-08 09:30:58 +00:00
Arun Raghavan
0c37adb665 module-rtp: Add some sender latency validation
Just a sanity check on config.
2024-01-30 21:26:14 +00: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
c37f9f9cf0 module-rtp: use sess.latency.msec also for sender
Use the sess.latency.msec also for the sender and use it to control the
NODE_LATENCY. Make it a float to be in line with the other time values.
Set is to a default of ptime, which was what it used to be.

This makes it possible to set the ptime to a smaller value than the
sess.latency.msec so that we send out multiple packets per quantum.
This will result in some bursty output for now but with a timer that can
be improved later.

Update the docs a little, mention the new rtp.ptime and rtp.frametime.
2024-01-25 15:49:41 +01:00
Wim Taymans
ec825086f1 module-rtp: use helpers to convert between samples and msec
And make sure we don't do any useless float to double conversions.
2024-01-25 15:30:04 +01:00
Wim Taymans
9458367a50 module-rtp: Fix framecount vs ptime check
We should use framecount instead of impl->psamples.
2024-01-25 15:12:25 +01:00
Dmitry Sharshakov
401df6e199 module-rtp-sap: review
Co-authored-by: Barnabás Pőcze <pobrn@protonmail.com>
2024-01-22 16:41:06 +00:00
Dmitry Sharshakov
7abb896aef module-rtp-sap: support PTP management protocol
Request current clock sync status to know the grandmaster identity for SAP announcements
2024-01-22 16:41:06 +00: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
065e819f18 TODO: module-rtp: buffering for sender
This should be done to match packet size requirements (e.g. 1 ms) while allowing user's software to run at higher buffer size to not stutter.

This will require scheduling multiple rtp_audio_flush_packets calls per one rtp_audio_process_capture call
2023-12-20 09:35:22 +00: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
Dmitry Sharshakov
873e6119b8 module-rtp: handle framecount attribute 2023-12-20 09:35:22 +00:00
Dmitry Sharshakov
533161a766 module-rtp: add framecount to the SDP
Required for RAVENNA hardware.

Co-authored-by: Dewi Seignard <dewiweb@gmail.com>
2023-12-20 09:35:22 +00:00
Wim Taymans
5e750f6fb8 modules: place floats in properties in JSON format
Using %f will result in a locale dependent format and might not parse
with JSON parsers or even our own spa_atof() function.
2023-12-14 11:50:30 +01:00
Arun Raghavan
63bb128948 rtp-stream: Set rtp.ptime on senders not receivers
The pw_stream direction is inverted from what we want (input => sender).
2023-11-23 01:28:20 -05:00
Wim Taymans
acbe75d9a1 rtp-stream: senum -> seqnum 2023-10-09 11:12:21 +02:00
Christian Glombek
cbac8c9040 module-rtp/stream: Add support for RAOP 2023-10-09 10:52:25 +02:00
Christian Glombek
8704aaa044 module-rtp/stream: Add getter for pw_stream state 2023-10-09 10:52:25 +02:00
Christian Glombek
89d935c9f6 module-rtp/stream: Add setter for property 2023-10-09 10:52:25 +02:00
Christian Glombek
1200bd7d20 module-rtp/stream: Add getter for property 2023-10-09 10:52:25 +02:00
Christian Glombek
35330cf461 module-rtp/stream: Add param_changed method
This method can be used to access the param_changed method of the
underlying pw_stream.

Also adds new public functions rtp_stream_set_param and
rtp_stream_update_params which plum things through to pw_stream_set_param
and pw_stream_update_params respectively.
2023-10-09 10:52:25 +02: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
Dmitry Sharshakov
991e3928d4 rtp-stream: do not set false ptime values 2023-06-20 06:51:30 +00:00
Sebastian Jaeckel
d08439316b rtp/stream: calculate and format the ptime property as float 2023-05-24 08:32:42 +00:00
Wim Taymans
026c55c0ce module-rtp: don't deref io_position when NULL 2023-03-16 11:26:20 +01: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
6230154677 module-rtp: include config.h to get HAVE_OPUS 2023-03-13 12:50:32 +01:00
Wim Taymans
59d5d93878 module-rtp: fix compilation without opus 2023-03-12 19:04:14 +01:00
Wim Taymans
345582dd15 module-rtp: add opus encoding 2023-03-12 18:40:36 +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
f3230ca2e6 module-rtp: fix sender latency
The sender should ask for a latency that matches the packet size, not
the playout latency, that is for the receiver only.
2023-03-10 17:29:43 +01:00
Wim Taymans
2429674970 Merge branch 'master' into 'fix_san_build'
# Conflicts:
#   src/modules/module-rtp/apple-midi.h
2023-03-10 10:10:25 +00: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
Barnabás Pőcze
82e30d46a9 pipewire: module-rtp: fix compilation with UBSan
The type of `0xffff` is `int`, and UBSan does not like
when that value is shifted left by 16 bits, which causes
e.g.

  case APPLE_MIDI_CMD_IN:

to not compile with the following error:

  error: case label does not reduce to an integer constant

One could use `0xffffu` to force the type to be `unsigned int`,
or simply use `0xffff0000` which has no shifts. This patch
does the latter.
2023-03-10 00:00:51 +01:00
Barnabás Pőcze
57cd5611d1 pipewire: module-rtp: add missing include
Include `stdint.h` in `apple-midi.h` to make it self-contained.
2023-03-10 00:00:32 +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
933743581b module-rtp: fix rtp.media property
Use sess.media for the media type (audio/midi) because rtp.media is used
in the SDP to describe the media (midi and audio are both are audio).
2023-03-09 13:14:22 +01:00
Wim Taymans
be09198249 module-rtp: port source and sink to new stream 2023-03-09 13:14:22 +01:00