Commit Graph

514 Commits

Author SHA1 Message Date
Aaro Altonen 74a7207f90 Disable assert() and LOG_DEBUG() by default 2020-04-21 14:50:54 +03:00
Aaro Altonen 7bcc1b2bd2 Add config getters for sender/receiver 2020-04-21 11:34:11 +03:00
Aaro Altonen ea570f15ee Fix compiler warnings 2020-04-21 08:57:37 +03:00
Aaro Altonen fc0aa107ad Update copyright 2020-04-21 08:46:54 +03:00
Aaro Altonen d571e8f3a7 Update README 2020-04-21 08:05:07 +03:00
Aaro Altonen 2e94da9962 Reset select() parameters before calling it on every iteration
At least on Windows (and possibly on Linux), FD_SET must be called
always before calling select() or else it won't work and on Linux
the struct timeval values are changed to relect the amount of time
spent waiting on the file descriptors.
2020-04-21 07:43:51 +03:00
Aaro Altonen b9faf77089 Add support for CMake build 2020-04-17 13:47:35 +03:00
Aaro Altonen 08495db82d Create separate document for build instructions 2020-04-17 13:47:21 +03:00
Aaro Altonen ada16b4992 Create SEQ(x) and TS(x) macros
Crate macros for getting the sequence number and timestamp values
of RTP frames.
2020-04-17 08:19:21 +03:00
Aaro Altonen 07ac7aa1b5 Fix comment in examples/binding.cc 2020-04-16 13:59:46 +03:00
Aaro Altonen 8a18eb4824 Add instructions for running the example codes
Using kvzRTP is far from easy on Windows so something must be done
about it at some point. Maybe QtCreator's/Visual Studio's deploy
tools could be used to help the installation procedure
2020-04-16 13:28:31 +03:00
Aaro Altonen f83a9bee49 Implement notify hooks
Notify hooks are similar to receive hooks where kvzRTP calls the application
with some data.

Notification can be about, for example, that the timer for a frame
expired and it was dropped and the application should prepare for
possible consequences (f.ex. a gray screen)
2020-04-16 11:19:31 +03:00
Aaro Altonen e2b72d4043 Initialize recv_hook_ to nullptr
There's a race condition between creating a stream (starting the
frame receiver) and installing a receive hook. Previously the recv_hook_
pointer contained garbage which caused problems especially on Windows.
2020-04-14 08:58:44 +03:00
Aaro Altonen fc105da611 Fix the same runner-related race conditions in frame receivers 2020-04-08 11:38:37 +03:00
Aaro Altonen ac3c136332 Fix race condition at the start up of system call dispatcher
There is a possibility that the dispatcher thread is started before
its state is initialized which causes it to appear as inactive when
it tries to enter the send loop and actually exists early.

This is a clear design flaw in the runner class but for the time
being this disgusting fix will have to suffice.
2020-04-08 10:26:56 +03:00
Aaro Altonen 06dd822ce9 Fix a race condition in system call dispatcher's exit routine
The code did not wait for dispatcher to actually stop but just issued
a termination and proceeded to release all memory which sometimes
caused use-after-free memory issues
2020-04-08 10:26:50 +03:00
Aaro Altonen fbe35d8d92 Simplify the structure of example directory
Only include code relevant to usage of kvzRTP and put everything
in the same directory
2020-04-06 12:07:28 +03:00
Aaro Altonen 90e8caff73 Add local interface binding example 2020-04-03 12:23:14 +03:00
Aaro Altonen dff6094561 Add ability to bound the session to user-specificied address 2020-04-03 11:45:19 +03:00
Aaro Altonen 41132e6ffc Increase the RTP frame delay to 100ms
34ms is too strict a deadline for some use cases. By increasing the
default frame delay to 100ms does not hurt the cases where the frames
are anyway received within 34 milliseconds but it also allows users
to stream at high resolutions/low QP values without recompling the library.

Making this adjustment dynamic based on timestamps of the packets is
a planned future task but this shall act as a bandaid until then.
2020-04-03 10:19:33 +03:00
Aaro Altonen 6fc9eae97c Add FFmpeg receiver benchmark code
Add code for the receiver that was accidentally deleted and rename
the files more logically
2020-03-30 07:53:36 +03:00
Aaro Altonen 0dc3709e41 Merge parse_kvzrtp_recv and parse_kvzrtp_send
They're nearly identicaly, only one line difference, so it makes no
sense to have to functions
2020-03-27 12:19:26 +02:00
Aaro Altonen 8e95f0304a Add ability to provide output file for the benchmarking results 2020-03-27 12:06:13 +02:00
Aaro Altonen d3db5aa209 Remove debug print from queue.cc 2020-03-27 12:05:41 +02:00
Aaro Altonen 7e8c625864 Do not call exit() when dispatcher stops running
This forces the whole application close which is definitely not
the intention
2020-03-27 12:05:41 +02:00
Aaro Altonen d81a37ab4d Update gitignore to ignore benchmark binary files 2020-03-27 12:05:41 +02:00
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