Commit Graph

488 Commits

Author SHA1 Message Date
Aaro Altonen cfbeda2ccc Create script for parsing the benchmark results 2020-03-27 12:04:30 +02:00
Aaro Altonen 223503ab16 Create script for running the benchmarks 2020-03-26 12:24:24 +02:00
Aaro Altonen 7b47c899ca Rewrite kvzrtp sender/receiver benchmarking code 2020-03-26 12:23:15 +02:00
Aaro Altonen 687e99286f Restructure benchmarking directory
Remove code for libraries that are no longer benchmarked and
create directories for kvzrtp, ffmpeg and gstreamer.
2020-03-26 11:23:58 +02:00
Aaro Altonen bc6bfe7af0 Release all partial frames when the receiver is stopped 2020-03-20 10:25:37 +02:00
Aaro Altonen 1566a0e1eb Release memory of duplicate frames 2020-03-20 10:25:18 +02:00
Aaro Altonen ccceae2713 Deallocate the transaction after the frame has been sent 2020-03-20 10:24:22 +02:00
Aaro Altonen 0b95f496a6 Set RTP payload format correctly
RTP format was not set using the set_payload() function which
caused the clock rate to be 0. This in turn caused packets to appear
as duplicate or late by even minutes.
2020-03-20 09:23:12 +02:00
Aaro Altonen b522bb33a4 Decrease the select() timeout to 1000 us
This seems to work the best with high-quality video stream on Windows
2020-03-12 08:27:26 +02:00
Aaro Altonen de631fff5e Silence the socket error from recvfrom()
The function calling recvfrom() will print an error if necessary
2020-03-12 08:26:37 +02:00
Aaro Altonen 922e216e29 Add missing files to the project file 2020-03-11 07:43:33 +02:00
Aaro Altonen ba17309063 Do not set srtp_ conditionally to nullptr
SRTP pointer is available even if crypto is disabled
2020-03-11 07:42:35 +02:00
Aaro Altonen 1c7c0ab0aa Set select() parameter correctly on every iteration
The socket must be set to the read_fds on every iteration or else
the select() will fail after the first try
2020-03-11 07:41:40 +02:00
Aaro Altonen 86cf34c6e7 Set Start and End flags properly on Windows
MinGW seems to employ some very aggressive optimizations that
sometimes create invalid packets because both Start and End
flags are set simultaneously.

This fixes the problem where an intra frame seems to be dropped
every now and then. Nothing was actually dropped but kvzRTP
received an invalid packet and thus discarded the whole frame

To be honest, I have no idea why this worked but it did anyway.
2020-03-11 07:33:15 +02:00
Aaro Altonen f109ced043 Don't store session objects to RTP context
Let user create as many sessions as wanted with the same IP.
kvzRTP really does not care how many sessions with the same IP is
going on so forcing only one session per IP made no sense.

Now, however, the burden of releasing the session object is on the
caller when the application exits.
2020-03-06 07:54:38 +02:00
Aaro Altonen 3c197ceb15 Set socket's state to non-blocking on Windows 2020-03-06 07:33:06 +02:00
Aaro Altonen 1b684381d7 Release all resources when the session is destroyed 2020-03-06 07:32:32 +02:00
Aaro Altonen 26e6010f62 Use select()/MSG_DONTWAIT to implement non-blocking socket 2020-03-03 08:22:29 +02:00
Aaro Altonen 54c603478d Merge branch 'VisualStudioMeme' into 'master'
Visual studio meme

See merge request TIE/ultravideo/kvz-rtplib!1
2020-03-03 07:17:57 +02:00
Joni Räsänen 53b0c65e32 Fix a non-compiling typo in windows code for socket. 2020-02-27 15:11:35 +02:00
Aaro Altonen ffeced2ff9 Return the generic frame to user
During refactoring, this line was commented but I forgot to uncomment
it when commiting the new architecture.

Now audio should work again
2020-02-25 09:49:04 +02:00
Aaro Altonen 1a80b054c9 Add initial version of SRTP
Encryption and decryption works to both directions using ZRTP keys
Authentication and SRTCP support missing
2020-02-25 09:48:02 +02:00
Aaro Altonen 1bc2249045 Ignore ICMP Port Unreachable messages
If the receiver is not listening to the port we're sending packets to,
we receive an ICMP Port Unreachable message to our socket which causes
recvfrom() to fail when it's called the next time. By ignoring these
messages we can continue the session
2020-02-25 09:30:44 +02:00
Aaro Altonen d02eab6d81 Release all resources when session is destroyed 2020-02-25 09:24:16 +02:00
Aaro Altonen 15cd6db226 Rewrite benchmark code to use the new API 2020-02-21 10:07:17 +02:00
Aaro Altonen 1976d15aee Pass sender to media-specific push_frame() 2020-02-21 07:10:36 +02:00
RLamm 6c017cf9fc Merged the current master to the visual studio branch 2020-02-18 15:11:04 +02:00
Aaro Altonen a8d6b2ae70 Add missing includes to frame.hh 2020-02-18 07:42:28 +02:00
Aaro Altonen e244373a23 Fix Windows code
Add missing files to kvzrtp.pro and fix a type cast in poll.cc
2020-02-17 07:32:17 +02:00
Aaro Altonen cf08bdd883 Fix example codes and add HEVC slice example
RTCP/HQ configuration is still missing from the examples because
I have yet to figure out how to integrate proper configuration or
RTCP to the new architecture
2020-02-17 07:32:07 +02:00
RLamm 8ab83b415c First version, which compiles with VS 2020-02-14 14:24:42 +02:00
Aaro Altonen 91c838aea1 Edit README 2020-02-13 09:34:54 +02:00
Aaro Altonen ed937e9957 Put SRTP/ZRTP/all crypto behind __RTP_CRYPTO__ compile flag
The initial idea was to integrate Crypto++ to kvzRTP to make usage
very easy but as it turns out, the compilation of that library is quite
complex so it's better to use the Makefiles they provide.

This means that kvzRTP shall have one extra dependency IF application
wishes to use SRTP/ZRTP: Crypto++. The compilation and linking should
be quite straight-forward and if application wants to use SRTP/ZRTP
it must make the decision when kvzRTP is compiled by providing
-D__RTP_CRYPTO__ flag for the compiler and by adding -lcryptopp to
link list of the application.
2020-02-13 08:44:18 +02:00
Aaro Altonen f8c1a3933a Document the public API 2020-02-13 07:50:50 +02:00
Aaro Altonen 2a1e3d23be Merge branch 'develop' 2020-02-12 07:31:47 +02:00
Aaro Altonen 77b1a64a86 Merge branch 'fixes' into develop 2020-02-12 07:31:40 +02:00
Aaro Altonen a789d98220 Uncomment send code in formats/generic.cc
During refactoring these were commented out but I forgot to
uncomment them
2020-02-10 10:25:59 +02:00
Aaro Altonen 826db93907 Do not print error message if validate_rtp_frame() failed
The chances that ZRTP is enabled are quite high and because those
messages are received to the same socket as media, the error messages
would likely flood the log so better turn them off.
2020-02-10 10:24:26 +02:00
Aaro Altonen 35458dc00f Ignore invalid header version if ZRTP has been enabled 2020-02-10 10:23:12 +02:00
Aaro Altonen b71824f609 Fix ZRTP session initialization
Only the first initialization is DHMode, all the rest should be
Multistream Mode (implemented later)
2020-02-10 10:21:59 +02:00
Aaro Altonen b8a02ce5f9 Merge branch 'new-arch' into develop 2020-02-10 09:35:26 +02:00
Aaro Altonen 8f21d0d4b5 Fix include paths for ZRTP-related files 2020-02-10 09:35:10 +02:00
Aaro Altonen 4e9631f160 Remove connection object from the project
It has no longer any use, all the logic is split between media_stream,
receiver and sender.
2020-02-10 09:35:06 +02:00
Aaro Altonen c1ef0955f7 Add missing configuration functionality to media_stream 2020-02-10 09:04:52 +02:00
Aaro Altonen 6e008f8e59 Add missing hook-related functionality to media_stream 2020-02-10 08:50:36 +02:00
Aaro Altonen 6d2b856c29 Redesign kvzRTP's architecture
Now for each call (or IP) there will be a separate session which
shall contain one or more multimedia streams. Each session has a
single ZRTP object and each multimedia session shall have a single
socket which both the sender and receiver use to enable hole punching
on all platforms.

Each multimedia stream shall also have a single SRTP instance which
derives keys from the common ZRTP session.
2020-02-07 12:22:58 +02:00
Aaro Altonen a32b6c785e Create new sender/receiver classes that are totally separate
The previous architectural design was starting show its limitations,
one of the most limiting factor being that readers and writers had
their own connection objects which caused some problems with hole
punching.

This is the first commit of a whole new architecture where the top
object is RTP session which contains media streams which in turn contain
an RTP sender and a receiver. This design choice allows the kvzRTP to use
one socket for both the receiver and the sender and thus mitigates the
hole punching problem that appears on Windows.
2020-02-07 09:27:17 +02:00
Aaro Altonen e6adc09751 Do not break from the loop if an invalid fragment is received
It is highly likely that an invalid fragment will be received so
stopping the receiver after that and restarting the call after each
invalid fragment is very user-hostile
2020-02-05 08:33:36 +02:00
Aaro Altonen 46c88b4b0b Check the correct handler with assert 2020-02-05 08:33:08 +02:00
Aaro Altonen 95a77e0108 Fix HEVC start code lookup
__get_hevc_start() read beyond the buffer bounds, now hopefully fixed
2020-02-04 12:07:05 +02:00