Commit Graph

609 Commits

Author SHA1 Message Date
Aaro Altonen 157b21a05c Create ZRTP packet handler 2020-08-15 04:05:42 +03:00
Aaro Altonen 14ecd34fdd Implement RTP packet dispatcher
Packet dispatcher is responsible for doing receive-related socket operations
and dispatching the received UDP datagram to the installed packet handlers.

Packet dispatcher goes through all installed handlers until a suitable
handler for the packet is found.
2020-08-15 04:05:42 +03:00
Aaro Altonen 2790a394af Return RTP_INTERRUPTED instead of error in recvfrom(2)
If the operation timeouts, return RTP_INTERRUPTED so the caller does
not have to explicitly check for system-specific error codes when
recvfrom(2) fails
2020-08-15 04:05:42 +03:00
Aaro Altonen 66a4c2a412 Create log_platform_error() utility function 2020-08-15 04:05:42 +03:00
Aaro Altonen 693c5331c3 Add support for RTP packet authentication
By default authentication is disabled for RTP but in can be enabled
by giving RCE_SRTP_AUTHENTICATE_RTP when creating a media stream.

When security layer gets a packet, outgoing or incoming, it will add
an authentication tag to the packet or verify the tag, respectively.

This implementation is not perfect. The largest issue is
that there is no proper packet dispatcher so late ZRTP packets
can cause some real trouble.

This and a few other issues will be addresses later on when the
architecture of packet reception and the whole socket layer is improved.
2020-08-15 04:05:42 +03:00
Aaro Altonen 7346b95c2f Disable System Call Dispatcher
Disable SCD for now because there's just too much technical debt
to keep up with and the unknown lifetime of the RTP packet buffers
for SCD make SRTP almost an impossible task to implement properly.

Better scheme for RTP frame allocation and packet construction must
be implemented at some point.
2020-08-15 04:05:42 +03:00
Aaro Altonen 484c626ba4 Pass context flags directly to SRTP 2020-08-15 04:05:42 +03:00
Aaro Altonen 1a3dd9ca43 Store maximum payload size to RTP context
Store the size to context because different streams may have different
maximum payload sizes. For example, an SRTP stream with RTP authentication
enabled has a smaller payload size than a normal RTP stream.
2020-08-15 04:05:42 +03:00
Aaro Altonen 77fc7df078 Add support for SRTP NULL cipher 2020-08-15 04:05:42 +03:00
Aaro Altonen 61f7ef0416 Update SRTP code 2020-08-15 04:05:42 +03:00
Aaro Altonen 3f7bdf515b Use correct hvi length when determining roles for participants 2020-08-15 04:05:42 +03:00
Aaro Altonen 1da9ee569f Remove debug sleeps from src/zrtp.cc 2020-08-15 04:05:42 +03:00
Aaro Altonen 21e8b5ca83 Calculate timeout properly 2020-08-15 04:05:42 +03:00
Aaro Altonen cd736a7c84 Copy correct amount of bytes from remote's Commit for hvi
DH/Multistream modes use different sizes for hvi
2020-08-15 04:05:42 +03:00
Aaro Altonen d539199c1c Generate Multistream nonce to ZRTP session
Generate nonce to ZRTP session instead of to the message directly
because in case of a "tie" we must compare hvi values to determine
roles for both participants and msg->hvi is not available at that point
2020-08-15 04:05:42 +03:00
Aaro Altonen 0d033cda59 Create TIME_DIFF macro 2020-08-15 04:05:42 +03:00
Aaro Altonen 00d10cd0b7 Add Multistream mode key generation 2020-08-15 04:05:42 +03:00
Aaro Altonen ffc24e6b49 Protect access to ZRTP state by a mutex 2020-08-15 04:05:42 +03:00
Aaro Altonen 333517c113 Add example code for ZRTP multistream mode 2020-08-15 04:05:42 +03:00
Aaro Altonen e313e0f9df Implement ZRTP multistream mode 2020-08-15 04:05:42 +03:00
Aaro Altonen 20acc38f4e Generate random nonce for hvi in Multistream Mode 2020-08-15 04:05:42 +03:00
Aaro Altonen 4449a7a56f Don't complain about incoming ZRTP frames
Right after ZRTP has finished and the media reception has been started,
there may be a few ZRTP ACK/ConfACK messages coming in which are
perfectly valid.
2020-08-15 04:05:42 +03:00
Aaro Altonen c04cc116a7 Use RTP_ERROR instead of errno to indicate error conditions 2020-08-15 04:05:42 +03:00
Aaro Altonen b1a072b9f0 Fix Preshared and Multistream names 2020-08-15 04:05:42 +03:00
Aaro Altonen e8b2947072 Give key agreement type for init_session() as a parameter 2020-08-15 04:05:42 +03:00
Aaro Altonen 027bbf3c73 Create only one ZRTP object per session 2020-08-15 04:05:42 +03:00
Aaro Altonen c5c30d6c60 Update README 2020-08-11 06:49:06 +03:00
Aaro Altonen 1510f93f3f Merge branch 'rtcp-fix' 2020-06-18 09:59:04 +03:00
Aaro Altonen 675b1fe26c Fix RTCP example code 2020-06-18 09:58:48 +03:00
Aaro Altonen 0b92776be6 Update session statistics after before returning the frame 2020-06-18 09:34:13 +03:00
Aaro Altonen 5217d42814 Add RTCP support to RTP receiver
Receiver calls RTCP after every received frame to update
session statistics
2020-06-18 09:33:41 +03:00
Aaro Altonen 73f5c4a35a Add ability to create unidirectional senders/receivers
This may be useful in situations where a user wishes to join a
conference call but does not wish to send any data only receiver or
vice versa.

This unidirectionality will also dictate the role for the media_stream's
RTCP object
2020-06-17 08:23:50 +03:00
Aaro Altonen f0913bd28a Improve error handling in media_stream::init() 2020-06-17 08:08:16 +03:00
Aaro Altonen 06f2891b86 Create RTCP gettter 2020-06-17 07:55:47 +03:00
Aaro Altonen b243d7d47e Remove RTCP forwards from media_stream
RTCP state should be modified only through the RTCP object allocated
for each media_stream
2020-06-17 07:55:02 +03:00
Aaro Altonen a522c81324 Add RTCP support for media_stream 2020-06-16 06:41:16 +03:00
Aaro Altonen 2af23d653e Add get_clock_rate() to rtp.cc 2020-06-16 06:41:14 +03:00
Aaro Altonen c8edee5ad6 Make the RTCP socket non-blocking on Windows 2020-06-16 06:40:33 +03:00
Aaro Altonen 8255e19be3 Remove benchmarking code from uvgRTP
The code has been moved to https://github.com/ultravideo/rtp-benchmarks
2020-06-10 16:24:01 +03:00
Aaro Altonen 33917d42cf Include # of received frames to parsed latency output 2020-06-09 09:29:45 +03:00
Aaro Altonen ebf8d3c0b4 Print the number of frames received for uvgRTP's latency sender 2020-06-09 09:21:47 +03:00
Aaro Altonen f15e2fa1e0 Don't use time(1) for latency tests 2020-06-09 09:19:08 +03:00
Aaro Altonen bb91e825bd Identify inter and intra frames correctly for Live555/FFmpeg 2020-06-09 09:09:48 +03:00
Aaro Altonen 2e0b3ef85b Fix FPS calculations 2020-06-09 09:09:48 +03:00
Aaro Altonen 080da0446e Add code for parsing latency results 2020-06-08 09:04:38 +03:00
Aaro Altonen e2f270b9e3 Add latency testing code for benchmark.pl 2020-06-08 07:45:56 +03:00
Aaro Altonen 65707bb81b Ignore latency executables 2020-06-07 07:33:52 +03:00
Aaro Altonen 14c4f61343 Use correct libraries when linking FFmpeg test code 2020-06-07 07:31:37 +03:00
Aaro Altonen 5a695d4535 Decrease Live555 latency sender FPS to 30 2020-06-07 07:31:37 +03:00
Aaro Altonen e29d7d2372 Rewrite FFmpeg's latency test code
Live555 latency test code requires us to change the design for
FFmpeg and uvgRTP too. Now the test code streams at 30 FPS and
calculates an average latency value for all frames, for intra frames
and for inter frames.

The presence of start codes and frame merging (probabyl due to presence
of SPS et al) makes the usage of frame size as key a little trickier.
2020-06-07 07:31:35 +03:00