Commit Graph

149 Commits

Author SHA1 Message Date
Martin Pulec
ab5d2a5cac control_socket acquire: get the pointer from priv_data
Do not assume that (struct module) is first in the (struct control_state)
anymore in particular and in any structure in general.
2025-06-18 08:49:44 +02:00
Martin Pulec
99588ababe remove module.deleter 2025-06-17 12:35:38 +02:00
Ben Roeder
a62fe80c3f Fix spelling errors throughout codebase
Corrected various spelling mistakes in comments, documentation, and
variable names across the project. Changes include:
- Documentation files (CONTRIBUTING.md, README.md, etc.)
- Source code comments in C/C++ files
- Function parameter names and descriptions

No functional changes were made.
2025-06-01 18:03:40 +01:00
Martin Pulec
5724761356 support for non-Linux POSIX systems 2025-05-30 08:10:31 +02:00
Martin Pulec
91595b6dcd tx/h265: fix CID 480258 2025-04-10 16:16:49 +02:00
Martin Pulec
465f939b86 tx_send_h265: emit AP if possible
It is perhaps not worth sending VPS/SPS/PPS in separate packets.
2025-04-04 09:27:29 +02:00
Martin Pulec
770c44a737 rtsp server: support for sending H.265 2025-04-04 09:27:27 +02:00
Martin Pulec
4caf732be1 rtp.h: do not include config_*.h 2025-03-26 11:06:46 +01:00
Martin Pulec
41daf835a1 tx_init: allow NULL for encryption
Refactoring done in 1ab725d57 (2024-08-05) changed the behavior not to
expect NULL pointer, because common_opts.encryption is a char array now.
But tx_init calls also audio/playback/mixer, which crashes since then so
be less rigid in this case.
2024-10-30 11:47:35 +01:00
Martin Pulec
9b9105f6ae tx audio R-S warning: use the correct max_len
The data_len var used to compute packet_count may be lesser than its
initial value (tx->mtu - hdrs_len) because it might have been decreased
to number of remaining bytes of the last packet.

Returned back data_len to the do-loop and compute the value as
max_len.
2024-09-11 15:28:30 +02:00
Martin Pulec
8ff8a78592 tx audio: warn if Reed-Solomon is inadequate
refer to GH-408
2024-09-11 14:48:52 +02:00
Martin Pulec
39042d99ee audio_tx_send_standard: fixed static PT for MP3
In case that the input has 1 channel and 8 kHz, the packet type was not
set to 14, because the first if branch was entered instead of else-if
(not setting anything).
2024-08-09 09:23:00 +02:00
Martin Pulec
6508780adc audio_tx_send_standard: fixed PCMA/U dyn type
Fixed the condition that applied only if fixed PT was used for the
audio. But dynamic packet type is used when more channels are used,
in which case the condition didn't hold, which caused the stream not
being handled appropriately (interleaving the channels).
2024-08-09 09:23:00 +02:00
Martin Pulec
7330d9c181 audio_tx_send_standard: fixed bps for PCMA/U
The actual BPS is 1 (8-bits) regardless what .get_bps() returns (that
has a different semantics, see the comment).
2024-08-09 09:23:00 +02:00
Martin Pulec
1ab725d575 moved some common transmission opts to struct 2024-08-09 09:22:55 +02:00
Martin Pulec
0c1f301327 openssl_encrypt: allow cipher selection 2024-08-06 16:24:52 +02:00
Martin Pulec
9dccd8a3f7 tx encryption: do not send invalid frame
If encryption fails, do not pass the data further since it will abort
on data_len <= 0 assertion in RTP.
2024-08-06 15:42:43 +02:00
Martin Pulec
0b4f1e4b7b fec mult: handle invalid vals reasonably
do not assert on invalid value but rather print an error
2024-07-16 16:20:40 +02:00
Martin Pulec
7d199f6ff0 tx set_fec: added nodup option
added option `nodup` to disable 1st pkt duplication (previous commit)
2024-07-16 16:20:40 +02:00
Martin Pulec
9fb3240457 tx set_fec: fec_cfg always not-NULL 2024-07-16 16:20:39 +02:00
Martin Pulec
f96fb9777d Increase FEC resilliancy with low traffic
Duplicate first packet to increase resilliancy in cases when the traffic
is low, usually a single packet of some inter-frame compression like
H.264/HEVC. But it will similarly do the job when more packets per frame
are used.

First packet is duplicated instead of the last one because the last packet
can have less symbols than the first if there is more than 1
packet, eg. `DDDD|DF` (D - primary data; F - FEC, | - packet bounadry).

refers to GH-361
2024-07-16 16:20:39 +02:00
Martin Pulec
cbefa757a7 do not use VLA for packet buffers
Clang 18 complains on that in C++ code and it is unneeded since we are
limitted by the maximal (RTP) packet MTU.
2024-03-25 14:24:10 +01:00
Martin Pulec
0d32e24b81 audio_tx_send_standard: MP3/Opus send 1 channel
Send only one channel in RFC-compliant mode even if there are more,
just print an error.

The point is that even though the default audio capture channel count
is 1, some devices may not support mono (eg. DeckLink) and produce more
channels (usually 2) anyways.
2024-02-05 11:36:48 +01:00
Martin Pulec
f716083050 validate_std_audio: check also channel count for mp3 2024-02-05 10:43:50 +01:00
Martin Pulec
c64cc2df9c audio_tx_send_standard: validation to separate fn 2024-02-05 10:43:49 +01:00
Martin Pulec
fcc7190bc6 transmit: support for RFC 2550 MP3 packetization
the packet header is very simple (just fragment offset)
2024-02-05 09:40:49 +01:00
Martin Pulec
b97ee630ef transmit audio: validate Opus having 1 ch earlier
\+ fixed the message a bit not to imply that the RFC-compilant mode
itself allows only one channel, it is UG constraint.
2024-02-05 09:40:49 +01:00
Martin Pulec
f3fb8afdc0 tx_send_base (video): simplified sending (mult)
see also similar change for audio in commit 6c07a3e43 (2023-07-27)

The previous solution was using some cumbersome solution, perhaps
repeating the sequence (with mult:3) like `111222333444`.

Rewritten to be easier; also nwo the multiplication is as follows:
`123412341234`, which is perhaps better than the previous variant.
2024-01-17 16:50:05 +01:00
Martin Pulec
cf6f7cbe9d transmit vid.: comp last pkt sz in get_packet_sizes
Correctly set last packet size from get_packet_sizes() so that it doesn't
need to be adjusted later.
2024-01-17 16:50:05 +01:00
Martin Pulec
e22c97bd54 transmit: packet count - multiply always
simplification
2024-01-17 16:50:02 +01:00
Martin Pulec
5b0b996164 transmit: prefix FEC ss printout with MOD_NAME 2024-01-04 10:51:32 +01:00
Martin Pulec
aaa59980a9 transmit: print symbol size always in debug2
The symbol size is printed only once (or more precisely few times,
because it is guarded by a thread-local variable and the sending may
pick a different runner). This, however, doesn't give representative
numbers when frame sizes differ (== compressed) because then may also FEC
symbol sizes so print it unconditionally at least with debug2 log level.

refers to GH-361
2024-01-04 10:44:56 +01:00
Martin Pulec
40a7d04ec1 unit_evaluate[_dbl]: added endptr param 2023-11-29 15:27:32 +01:00
Martin Pulec
9ebb942635 FEC: very small help improvement 2023-11-27 16:41:28 +01:00
Martin Pulec
1b76001575 transmit: optimize includes
+ RTP: do not require config.h and WORDS_{BIG,LITTLE}ENDIAN (use
__BYTE_ORDER__ instead)
2023-11-27 16:41:24 +01:00
Martin Piatka
405e18f7f2 transmit: Fix crash when NULL parent module is passed 2023-11-10 11:41:10 +01:00
Martin Pulec
8747eae19c Revert "do not use source TS as RTP TS by default"
This reverts commit 2f1bfa9340.
2023-10-16 16:19:57 +02:00
Martin Pulec
73b5a85d2d Revert "format_audio_header: do not use audio_frame2"
This reverts commit a81b19d231.
2023-10-16 16:19:57 +02:00
Martin Pulec
68eeafca5e Revert "audio transmit: new sending API"
This reverts commit bf35242e78.
2023-10-16 16:19:56 +02:00
Martin Pulec
cdef66a141 Revert "audio TX: use the packet API"
This reverts commit 8da83d3e92.
2023-10-16 16:19:56 +02:00
Martin Pulec
f0e7333d88 transmit: use constant for hdr lens
+ move the computation to a function
2023-09-20 09:53:30 +02:00
Martin Pulec
2c8dd6743e transmit: moved stat reporting after send loop
it simplifies the code and facilites eventual refactor
2023-09-20 09:24:47 +02:00
Martin Pulec
4a745780e2 lavc video: header_inserter - support HEVC
\+ ignore leading AUD NALU if present (add own 4B start code instead) -
it could have produced problems when AUD+SPS+PPS is prepended to regular
frame that is not an IDR frame
2023-08-25 11:54:33 +02:00
Martin Pulec
d17c5ea24c removed platform_time.c + references
get_time_in_ns() should be used instead time_since_epoch_in_ms(). Having
both may be misleading and may lead to errors when interchanged.
2023-08-08 15:32:29 +02:00
Martin Pulec
3639d00dbf replaced not thread-safe *rand48 functions
Use rand_s() in Windows and random() in POSIX systems.
2023-08-02 10:07:19 +02:00
Martin Pulec
8da83d3e92 audio TX: use the packet API
It needs to be enabled explicitly, anyways - at least Opus won't work
with former UG versions. For 40 ms frame, it produces 2 packets. When
merged into one packet, the decoder is unable to decompress.
2023-08-01 12:01:05 +02:00
Martin Pulec
bf35242e78 audio transmit: new sending API
Added API allowing sending multiple compressed packets (eg. by Opus)
with the same timestamp.
2023-08-01 10:26:15 +02:00
Martin Pulec
a81b19d231 format_audio_header: do not use audio_frame2
rewrite for further changes
2023-08-01 10:26:15 +02:00
Martin Pulec
6c07a3e43f audio_tx_send: send indiviual channel with a func
Send channels sequentially with a new function to simplify the code.

Also removed the the cumbersome multiplier packet interleaving - not
sure if it worked as expected (having sliding n-packet interleave window
for n-multiplied stream).

Now we simply send all packets of the frame as without multiplication
and then repeated with M-bit set to the latest packet. It is much easier
and it is  supposed to work approximately the same or even better.
2023-08-01 10:26:15 +02:00
Martin Pulec
452a59e317 audio_tx_send: removed rate-limiting
Currently not used and so it needlessly complicates the code. If later
needed, it can be re-added and possibly in a better way.
2023-08-01 10:26:15 +02:00