Commit Graph

514 Commits

Author SHA1 Message Date
Aaro Altonen c140498971 Give RTP payload format to Connection
The payload format must be known when creating the Connection object
because Connection owns the frame queue and frame queue needs the format
in order to allocate correct media-specific headers for transactions
2019-10-08 08:13:49 +03:00
Aaro Altonen d9065aa564 Create send_vecio() function
This is a generic way of sending multiple packets with one system call.

It takes a pointer to vecio_buf (mmsghdr on Linux, TRANSMIT_PACKETS_ELEMENT
on Windows) and vecio_buf length and calls either sendmmsg(2) or TransmitPackets()
2019-10-02 11:41:06 +03:00
Aaro Altonen 9d6f58db59 Make fragment buffer size configurable 2019-09-30 09:53:09 +03:00
Aaro Altonen dec078f7b7 Add hook functions for RTCP packets 2019-09-30 09:34:46 +03:00
Aaro Altonen 9eca881371 Add code for resolving fragment relocations 2019-09-30 09:01:59 +03:00
Aaro Altonen 1cf8ec8d40 Make probation zone size configurable 2019-09-30 08:58:01 +03:00
Aaro Altonen a7b39c7d97 Update README 2019-09-30 08:57:45 +03:00
Aaro Altonen 8b38a9eef4 Make payload size and number of fragments/syscall configurable 2019-09-27 08:15:17 +03:00
Aaro Altonen 669733def9 Separate benchmarks to sending and receiving 2019-09-25 10:43:26 +03:00
Aaro Altonen be3c7fd5e4 Rewrite HEVC fragment receiver to use one common frame structure
Now both active and inactive frames reside in the same structure
making the code much cleaner.

Windows support for the receiver started
2019-09-25 10:28:58 +03:00
Aaro Altonen 0a7a5b455d Fix double free in frame.cc
Only probation OR payload should be freed but not both
2019-09-24 09:17:20 +03:00
Aaro Altonen 6d7c243184 Set the marker bit of last fragment to 1 2019-09-24 09:15:13 +03:00
Aaro Altonen 2b58b25f08 Add support for HEVC slices
The API didn't change much, if user wishes to use HEVC slices
(and thus preserve the state between push_frame() calls), he must
call the push_frame() with RTP_SLICE and RTP_MORE flags, like this:

push_frame(conn, data, 123, RTP_SLICE | RTP_MORE);
push_frame(conn, data, 456, RTP_SLICE | RTP_MORE);
push_frame(conn, data, 789, RTP_SLICE | RTP_MORE);
push_frame(conn, data, 100, RTP_SLICE);

RTP_MORE preserves the state between push_frame() calls and when the
last slice is given to kvzRTP, the RTP_MORE flags must be removed.
This flushes the frame queue and deinitializes it.
2019-09-24 09:15:06 +03:00
Aaro Altonen bdded6ef7b Fix optimistic HEVC receiver
Some of the more complex relocations still don't work, invalid and
duplicate packets wreck havoc and frame reallocation is missing but
it's already able to receiver stream with very large packets gracefully.
2019-09-13 12:59:41 +03:00
Aaro Altonen ebc914e95b Separate optimistic and regular HEVC receivers to different files
Separate them to different files and make it configurable which to use.
By default the normal receiver is used and if use gives __RTP_USE_OPTIMISTIC_RECEIVER__
then the optimistic receiver is started.
2019-09-13 08:52:01 +03:00
Aaro Altonen a7ec35bd87 Update gitignore 2019-09-12 08:06:02 +03:00
Aaro Altonen 2b34d2f6b0 Remove the msghdr struct from frame queue
mmsghdr struct already contains msg_hdr struct so this header
duplication is unnecessary
2019-09-12 07:59:30 +03:00
Aaro Altonen c4de5397fb Disable RTP probation zone by default
It makes more sense to disable it by default, especially when it's not
platform-independent and has negative side effects (larger memory footprint)
2019-09-11 11:58:12 +03:00
Aaro Altonen 3577b87379 Create optimistic HEVC fragment receiver
Small frames work, larger frames are sometimes dropped. This is supposed
to reduce the amount of copying but the performance will degrade as
network load increases
2019-09-11 11:33:41 +03:00
Aaro Altonen 78401d6fa8 Add probation zone for RTP frames
Probation zone lives below the actual payload and can be used as a
temporary storage for fragments that cannot be relocated.

It's part of the larger memory block so the fragments that are copied
to probation zone are spatially very close to their actual place in
the array making relocation faster
2019-09-11 11:18:09 +03:00
Aaro Altonen 07c0dd1bcc Replace the overwritten byte before exitint from __get_hevc_start() 2019-09-11 11:16:01 +03:00
Aaro Altonen 098287098c Create formats folder for all different media types
This makes the folder structure much cleaner and media-specific
files are more clearly separated from RTP/RTCP etc. files
2019-09-11 11:14:24 +03:00
Aaro Altonen f642569ae5 Fix frame queue flush bug in rtp_hevc.cc
More flag made it possible to give more data to the frame queue
(and thus return from __push_hevc_frame()).

This is not actually possible because the fragment headers are stored
on the stack. That is why postponing the frame queue flush is not a good idea.
2019-09-11 10:16:12 +03:00
Aaro Altonen 0a8c70e17b Update gitignore 2019-09-11 10:10:09 +03:00
Aaro Altonen a07803b16f Improve HEVC start code searching
This improvement gives a 100 MB/s boost to our send performance in
ideal conditions
2019-09-11 10:06:52 +03:00
Aaro Altonen 5a85b1463b Fix Live555 send benchmark 2019-09-08 14:51:23 +03:00
Aaro Altonen 3016ce4c92 Don't overwrite previous results 2019-09-08 14:50:35 +03:00
Aaro Altonen 454ba45c29 Implement fragmentation for JRTPLIB, oRTP and ccRTP 2019-09-07 16:01:24 +03:00
Aaro Altonen fb54d469b9 Increase the payload size to maximum
Now the max payload is 1441 + overhead totalling 1500 bytes (MTU)
2019-09-06 12:47:26 +03:00
Aaro Altonen 7242be636c Create test script 2019-09-06 10:41:57 +03:00
Aaro Altonen de2211ce40 Update benchmarking README 2019-09-06 10:11:47 +03:00
Aaro Altonen 0166171b18 Fix oRTP send benchmarking code 2019-09-06 09:54:36 +03:00
Aaro Altonen 8c6d7dcaed Fix FFmpeg send benchmark 2019-09-04 07:24:31 +03:00
Aaro Altonen 9c378444ce Fix live555 sending 2019-09-02 19:19:13 +03:00
Aaro Altonen 9c1558c7a8 Add benchmarking code for oRTP and FFmpeg 2019-09-02 19:18:20 +03:00
Aaro Altonen b277510304 Add benchmarking code
Add benchmark code for JRTPLIB, ccRTP, Live555 and kvzRTP.
The results are not available at the moment
2019-09-02 12:46:28 +03:00
Aaro Altonen 1f40fe724a Crate diff_now_us() 2019-08-31 08:06:43 +03:00
Aaro Altonen 8b809499a3 Remove HEVC start codes from smaller frames too 2019-08-30 09:04:12 +03:00
Aaro Altonen 8bdc98b975 Rewrite HEVC sending to use one system call per user buffer 2019-08-30 09:04:02 +03:00
Aaro Altonen 9e4bdb2999 Move the frame queue from writer to conn
This way we can get rid of the dynamic cast in __push_hevc_frame()
For readers the queue is nullptr so there's no memory overhead
2019-08-26 07:58:10 +03:00
Aaro Altonen 67e17693a7 Remove fragment types from the public HEVC API
They're only used internally
2019-08-21 09:12:39 +03:00
Aaro Altonen 977a53c11b Remove the payload type from push_frame()
Make it mandatory to specify the payload when creating reader/writer.
Reader needs to type anyway because it must start the correct frame
receiver. For writer it's not absolutely necessary but this makes
the API cleaner
2019-08-21 08:49:35 +03:00
Aaro Altonen c041a9c703 Set all frame pointers to NULL initially 2019-08-21 08:37:22 +03:00
Aaro Altonen 72cd31ab64 Rewrite examples
Examples are now in two categories:
    - Simple examples that demonstrate the core concepts
    - Full examples that show how the library can be used from
      application's perspective

Simple example also contains two subfoldres: rtp and rtcp:
    - rtp holds code snippets that show the RTP interface
    - rtcp contains all snippets that have something to do with RTCP
2019-08-21 08:04:45 +03:00
Aaro Altonen 6e10a0d912 Update README 2019-08-21 07:35:58 +03:00
Aaro Altonen 1aa5b69bcc Update example codes to use new writer API 2019-08-19 10:50:15 +03:00
Aaro Altonen d94237a12f Fix memory leaks 2019-08-19 10:46:25 +03:00
Aaro Altonen 9a50ae1224 Don't report error if we don't have any participants 2019-08-19 09:08:25 +03:00
Aaro Altonen 079a1c1622 Fix RR/SR parsing 2019-08-19 09:08:06 +03:00
Aaro Altonen d8d20e43d3 Create RTCP object conditionally
Because the order of creation matters when initializing RTP connection,
RTCP was not initialized when create_rtcp() was called. Creating the
object when it's needed fixes the issue
2019-08-16 12:11:37 +03:00