Commit Graph

87 Commits

Author SHA1 Message Date
Martin Pulec
229e9015a0 transmit.cpp: small rewrite 2022-09-16 16:01:11 +02:00
Martin Pulec
801a66d9b8 transmit.cpp: prevent infinite loop
When packat size is too low (< 180 IPv6 or 160 IPv4 - 96 B + headers),
looping in an infinite loop occured.

Steps to reproduce:

    uv -t testcard -m 150!
2022-09-16 16:01:11 +02:00
Martin Pulec
0b8cc39f9c removed perf tool
It was almost never used since added.
2022-08-17 17:24:34 +02:00
Martin Pulec
04c2d245d0 fixed Win compile warnings (from CI) 2022-08-11 10:42:45 +02:00
Martin Pulec
f103a9e53f tx_init: remove one indention level 2022-07-20 11:07:40 +02:00
Martin Pulec
cbc548d384 Added+use dynamic rate limiter
Added a rate limiter that occasionally allows excessive frames.

It permits using 1.5x frame time for frame 2x bigger that moving
average if 4 normal frames (using .75x frame time) were emitted
inbetween.

This mode is now default (for video, audio doesn't use rate limiter).
2022-07-20 11:05:40 +02:00
Martin Pulec
f42cafcedf get_packet_rate: needless use of long long 2022-07-19 09:51:14 +02:00
Martin Pulec
5be9d658e4 transmit.cpp: compute packet rate in separate func 2022-07-19 09:51:11 +02:00
Martin Pulec
1a31999f1a utils/misc: split to misc and macros.h
Some macros are quite common so it is perhaps more wise to use a
separate header.

Also moved ref_count_init_once and ref_count_terminate last to misc.h.
2022-06-06 11:06:06 +02:00
Martin Pulec
a354d2ab56 replaced some occurences of get_bpp with int version 2022-05-24 14:09:03 +02:00
Martin Pulec
8eccc3bcdd fixed uncompressed packet splitting
Fixes problem described (and partially fixed) by commit 13b44851.

The idea is to use least common multiple of all pixel format alignments
(in pixels) and split only on this boundry (in source pixfmt byte
length) because we don't know destination pixfmt alignment requirement.
2022-05-23 15:59:37 +02:00
Martin Pulec
1327c0619f transmit H.264: use rtpenc_h264_get_next_nal
Also removed remaining H.264 codestream parsing/splitting code - it was
a bit over-engineered.
2022-05-04 10:20:57 +02:00
Martin Pulec
d1f3206077 RTP: work also with time in NS 2022-03-18 08:52:32 +01:00
Martin Pulec
8b793e9772 rtpenc_h264: use RTPENC_STATE_DECLARE 2022-03-11 10:48:49 +01:00
Martin Pulec
57fcc088cb transmit: moved packet size computation to separate func 2022-03-11 10:48:42 +01:00
Martin Pulec
6d5cbde4fa transmit video multipliers: simplified pattern
Simply send multiplied packets sequentially, like for mult:3:

0 0 0 1 1 1 2 2 2 ....

This simplifies the code while the old one was already defunct (at least
the access to packet sizes' list was wrong since recent rewrite).
2022-03-11 10:19:50 +01:00
Martin Pulec
eb9b00b6e9 rtpenc_h264 rewritten
- store the buffer+size with _init
- return also pointer to data and EOF flag from _parse
- use longs instead of unsigned for buffer lengths
2022-03-11 10:19:50 +01:00
Martin Pulec
df16e3f17a transmit: compute pixel format alignment only once 2022-03-11 10:19:50 +01:00
Martin Pulec
806d456db5 transmit: moved gcd/lcm to utils/math.h 2022-03-11 10:19:49 +01:00
Martin Pulec
3b1eff5cc3 transmit: rewrite get_data_len
- renamed to get_video_pkt_len()
- use alignment var that is common denominator for both pixel formats
  and FEC symbols
2022-03-11 10:19:49 +01:00
Martin Pulec
600b5c92fa transmit: use array for mult_pos
+ declare some vars when initialized (audio_tx_send())
2022-03-11 10:19:19 +01:00
Martin Pulec
a778460fba Compute packet sizes only once 2022-03-11 10:02:02 +01:00
Martin Pulec
5b62e4e884 rtpenc_h264: allocate on stack 2022-03-04 16:28:58 +01:00
Martin Pulec
8bded29c1c rtpenc_h264: hide API 2022-03-04 16:28:58 +01:00
Martin Pulec
e712578f43 Added audio RS encoding 2021-11-30 17:09:29 +01:00
Martin Pulec
0c4c8627e7 Transmit: moved FEC symbol size check to sep. func 2021-11-30 17:09:26 +01:00
Martin Pulec
1b3b27eb7c Updated copyright dates for modified files 2021-11-08 15:43:14 +01:00
Martin Pulec
3dfc94a83a Transmit: allow setting of rate limiter with control socket 2021-10-05 10:15:54 +02:00
Martin Pulec
e90cdeb647 Removed msg_change_fec_data, use msg_universal
Removed msg_change_fec_data, use msg_universal instead.

This is a more versatile solution allowing further extensions without
a need to modify the global structure at an expese of worse type control.
As a replacement, a tag starting msg_universal::text is used/suggested.
2021-10-05 09:16:59 +02:00
Martin Pulec
96589f7fd8 Fixed inconsistent format_audio_header declaration 2021-09-06 13:04:37 +02:00
Martin Pulec
2a10512164 FEC->PT: added media_type parameter 2021-08-24 19:17:06 +02:00
Martin Pulec
6ade6e0ba9 transmit: refactor/clean header/pt setting 2021-08-24 19:17:02 +02:00
Martin Pulec
3663843682 renamed fec_video_payload_hdr_t to fec_payload_hdr_t
Can be used for audio as well.
2021-08-23 11:00:28 +02:00
Martin Pulec
855deb056c Audio RTP header formatting to separate function 2021-08-23 11:00:28 +02:00
Martin Pulec
8f557a97d6 Replaced audio/audio.h with audio/types.h includes
audio/audio.h should not be used as a catch-all header for audio.
2021-08-11 15:58:58 +02:00
Martin Pulec
35a09bb1ab Server mode: minor improvements
- adjust receiver in rtp_process_data() - in previous location, the
packet might have been freed (in unusual scenario)
- do not check if sending to blackhole for every packet - do the check
only once per frame
2021-06-29 16:53:52 +02:00
Martin Pulec
f4e509caa9 Do not crash on >1 channels with RFC OPUS
Print an error message instead.
2021-04-01 10:30:55 +02:00
Martin Pulec
4712b4aecb Show usage for -f help 2021-03-09 16:05:36 +01:00
Martin Pulec
8f296fb815 Transmit: do not exceed MTU for audio with encryption
Encryption overhead (nonce etc.) was not taken into account when
computing package sizes.
2020-11-06 16:01:08 +01:00
Martin Pulec
913d026649 Traffic shaper: correctly clear fixed-rate flag 2020-11-03 11:01:56 +01:00
Ben Roeder
8aa20b599f LDGM to Reed–Solomon 2020-10-29 19:50:40 +00:00
Martin Pulec
13b448514a Partially fixed packet splitting
This partially reverts a0cc3db5.

Fixes command: uv -t testcard:1920:1080:25:RGBA --param decoder-use-codec=UYVY -d sdl

The selection of correct split is quite tricky because even though 4 is
suffiecient for RGBA, using the UYVY decoder increases the size to 8
because the line-decoder obviously needs to process 2 pixels (aligned
at 2-pixel boundry). So the sender has no prior knowledge which
splitting the receiver requires.

Currently it is only a workaround using LCM from a value 48 (suitable
for RG48->R12L conversion) and pixel format block size.
2020-07-17 14:23:18 +02:00
Martin Pulec
31d9809fcd Updated documentation
Updated authors, copyright to 3-clause BSD (where possible) and file-level Doxygen
2019-11-09 13:47:11 +01:00
Martin Pulec
9c7b18f117 Traffic shaper: use adapive capped bitrate
Use adaptive capped bitrate if a limit bitrate value is specified.
Previously packets were emitted exactly at the specified bitrate which
is now an optional. Now, by default, the shapper shapes equally to
a frame time or capped bitrate (if the packet rate would be lower).
2019-09-27 12:10:12 +02:00
Martin Pulec
137a7013ba Traffic shaper: parsing to function + help 2019-09-26 18:37:50 +02:00
Martin Piatka
be5eb344f8 transmit: free rtpenc_h264_state when done 2019-08-23 13:17:34 +02:00
Martin Pulec
a0cc3db591 Transmit: correctly split packets
Correctly split packets for different pixel formats - previously there
was preset 48 B boundary which was least common multiple for then
present pixel formats (v210 has 16, RGB 3). However, R12L is not covered
since it uses block of 36 bytes.

From now on, we are splitting the packets according to the needed
boundary of pixel format (or arbitrarily for compressed). As a side effect,
the packets may be slightly bigger up to MTU size.
2019-02-22 16:38:29 +01:00
Martin Pulec
384f6ef97f Transmit: same buf. number for all substreams
Keep the same buffer number for all substreams of the frame in RTP
payload header.
2019-02-14 14:55:21 +01:00
Martin Pulec
baf069b7c5 H.264 std: simplified a bit
Note that RTCP SR are now send slightly in a different way - previously
the timestamp used was T-1.
2018-12-17 10:57:52 +01:00
Martin Pulec
9f6048e144 Added RFC 2435 compliant RTP JPEG transport
Compliant JPEGs can be now sent with SDP or RTSP.
2018-12-17 10:37:53 +01:00