Commit Graph

514 Commits

Author SHA1 Message Date
Aaro Altonen 18ef00c99e Use one function to update all session statistics 2019-06-24 08:51:58 +03:00
Aaro Altonen 3f5bd6a020 Add RTCP example code 2019-06-24 07:44:29 +03:00
Aaro Altonen 3546ea11db Fix memory leak in Sender/Receiver Report generators 2019-06-20 13:13:01 +03:00
Aaro Altonen 2058cec187 Check has the RTCP instance received any messages from remote
If we haven't received any message, it's impossible to include the
correct SSRC to RTCP packets. Thus we should return early if the
session doesn't have any participants
2019-06-20 13:12:25 +03:00
Aaro Altonen 5d313d47f2 Give SSRC to RTCP 2019-06-20 13:09:36 +03:00
Aaro Altonen 15c765c39e Implement RTCP BYE functionality
Participant is removed from the map and all memory is released
2019-06-20 11:40:58 +03:00
Aaro Altonen bbd5d0f46b Update RTCP bandwidth statistics after each packet 2019-06-20 11:36:39 +03:00
Aaro Altonen bb2e256b77 Remove some warnings 2019-06-20 10:16:38 +03:00
Aaro Altonen 3b169d5d74 Check if the sender of Receiver Report is already a participant 2019-06-20 10:03:01 +03:00
Aaro Altonen cc182467ca Rename is_valid_sender() to is_participant()
The previous name was misleading because not all participant are
senders
2019-06-20 09:49:05 +03:00
Aaro Altonen c3d9f5f504 Increase the number of participants when the first message is received 2019-06-20 09:42:07 +03:00
Aaro Altonen 57aef595a1 Add missing files to Qt project file 2019-06-20 09:27:28 +03:00
Aaro Altonen c5b12ef4f4 Add support for multiple RTCP participants
This is preliminary support for multicast groups
2019-06-20 09:25:01 +03:00
Aaro Altonen 40c619d12b Add poll functionality
This is used by RTCP to listen to multiple sockets at a time.
Winsock implementation is missing
2019-06-20 09:22:53 +03:00
Aaro Altonen 7a325e8600 Add multicast files 2019-06-20 09:22:10 +03:00
Aaro Altonen 44e6655c68 Remove some of the RTP session statistics functions
They gathered unused information (ie. not required by the spec)
so they can be removed
2019-06-20 08:36:44 +03:00
Aaro Altonen 9088f9c6d2 Overload recvfrom() to accept sender and bytes_read parameters
If the caller doesn't need them, he can just call one of the overloaded
functions
2019-06-19 09:26:04 +03:00
Aaro Altonen 6075c7bdbc Add overloaded sendto() which doesn't take the bytes_sent parameter 2019-06-19 09:16:57 +03:00
Aaro Altonen ea1db5338f Add RTCP packet handling functions for all packet types
Most of the functions don't do much just yet because we don't have
an API for the user for querying RTCP reports etc.
2019-06-19 08:09:28 +03:00
Aaro Altonen 94117e95d8 Add APP/BYE/SDES sending routines
These functions convert the fields of the input frame to network byte order
and sent it to remote
2019-06-19 08:09:28 +03:00
Aaro Altonen f0c265f820 Create sendto() function that accepts remote address as parameter 2019-06-19 08:09:22 +03:00
Aaro Altonen f55b53ff51 Add documentation for the socket API 2019-06-18 11:19:49 +03:00
Aaro Altonen c062384394 Make sure the socket family is AF_INET
Only IPv4 addresses are supported for now
2019-06-18 10:59:54 +03:00
Aaro Altonen 72157a7e6b Don't deallocate the frame parameter
We don't know if it's allocated on the heap or the stack
so deallocating it is dangerous
2019-06-18 10:32:34 +03:00
Aaro Altonen a0a60d1972 Rename report_cnt to count in RTCP header
Different packets have different counts (not all packets contain reports),
so the name was misleading
2019-06-18 10:29:31 +03:00
Aaro Altonen 6eb08dece8 Add missing (de)allocation routines for BYE/APP/SDES packets 2019-06-18 09:55:45 +03:00
Aaro Altonen 6485db2cfd Create separate routines for sending RTCP packets
These routines convert the fields from host to network byte order
and send the packet to all participants
2019-06-18 09:18:57 +03:00
Aaro Altonen 54ba727c0c Give shorter names for Report Block fields 2019-06-18 09:15:59 +03:00
Aaro Altonen 62b314dd29 Add missing SSRC field to Sender/Receiver Report packets 2019-06-18 09:14:39 +03:00
Aaro Altonen 5b16b70645 Make the RTCP socket getter const 2019-06-17 13:24:19 +03:00
Aaro Altonen 2b5263e6ae Rename sender/receiver report handling functions
This is to make them more consistent with other RTCP packet types
2019-06-17 13:23:13 +03:00
Aaro Altonen b619a86132 Rename get_hevc_rtp_header() to get_hevc_nal_header()
I have no idea why it was called RTP header..
2019-06-17 13:00:43 +03:00
Aaro Altonen 2c447fcf2f Use new instead of malloc when allocating RTCP frames 2019-06-17 12:36:57 +03:00
Aaro Altonen 788a9f84cd Add initial implementation of RTCP
Currently the timing of RTCP packets is not accurate and
Sender/Receiver Reports contain non-canonical information.

Support for SDES/APP/BYE packets is missing

Support for actually using the RTCP information (ie. an API for the user) is missing
2019-06-17 12:23:30 +03:00
Aaro Altonen 9970af92c9 Add RTP_INTERRUPTED error code
This error code is used to indiciate that an ongoing process (f.ex
polling a file descriptor) was interrupted but that "a real error"
did not occur and it is safe to continue
2019-06-17 12:03:35 +03:00
Aaro Altonen 6b83b07e99 Add PACKED_STRUCT macro
We must use packed structures because the structs we're sending must
not be padded at all
2019-06-17 12:01:23 +03:00
Aaro Altonen 95e8793149 Add RTCP Sender/Receiver Report frame (de)allocation routines 2019-06-17 11:56:21 +03:00
Aaro Altonen 89f5e3d708 Create rtp_errno global variable
Functions that can fail but cannot return error code (f.ex frame
allocation functions) should use this to specify the error condition
2019-06-17 10:03:50 +03:00
Aaro Altonen 5eccaf6675 Rename alloc_frame() to alloc_rtp_frame()
Unfortunately, overloading by return type is not possible so we
give new names for frame allocation functions
2019-06-14 12:51:10 +03:00
Aaro Altonen ed4b01a61d Add missing include to util.hh 2019-06-14 12:51:10 +03:00
Aaro Altonen f855db02c3 Update README 2019-06-14 12:51:10 +03:00
Aaro Altonen 33cf96b2e6 Rewrite session statistic routines according to new code style
Remove the __RTP_STATS__ test as gathering statistics is no longer
optional
2019-06-14 12:51:02 +03:00
Aaro Altonen 3fc85e2875 Create new cross-platform socket API for the library
This makes the code much cleaner as now all ugly cross-platform
related checks are hidden behind the API
2019-06-13 13:02:06 +03:00
Aaro Altonen 1bf4c8196c Use the new send functions on Linux for HEVC frames 2019-06-12 11:21:40 +03:00
Aaro Altonen 057bd41ceb Use NDEBUG to disable LOG_DEBUG prints 2019-06-12 11:19:43 +03:00
Aaro Altonen 18f88017c2 Rewrite generic RTP frame sending 2019-06-12 11:19:18 +03:00
Aaro Altonen f8d6ec6361 Implement faster RTP frag frame sending for Linux
This implementatation uses thread-local storage + sendmmsg()
to split large frames and send them using only one system call.

This may results in large performance improvements especially when
frame sizes increase as these implementatation doesn't do any extra
copying and sends the frame to remote using one system call (compared
to previous implementatation where each RTP frame was send individually)

Only works on Linux
2019-06-12 11:14:24 +03:00
Aaro Altonen 03542419d1 Create directory for the library to /usr/local/include and copy headers there 2019-06-10 10:14:08 +03:00
Aaro Altonen 4c9f8a049b Implement Windows-specific parts 2019-06-05 09:45:28 +03:00
Aaro Altonen c1e27ab008 Use header sizes defined in frame.hh 2019-06-04 13:57:09 +03:00