Skip to content
Snippets Groups Projects
Commit a2f6c8d9 authored by Guillaume Roguez's avatar Guillaume Roguez
Browse files

socket_pair: precise some constants usage

- removes the need of RTP_MAX_PACKET_LENGTH (redundant)
- gives more details on RTP_BUFFER_SIZE and SRTP_BUFFER_SIZE constants

Change-Id: Ida5c94910845b72773501468b471cbd71e59721f
Tuleap: #747
parent ed58b69e
No related branches found
No related tags found
No related merge requests found
...@@ -58,7 +58,11 @@ extern "C" { ...@@ -58,7 +58,11 @@ extern "C" {
namespace ring { namespace ring {
static constexpr int NET_POLL_TIMEOUT = 100; /* poll() timeout in ms */ static constexpr int NET_POLL_TIMEOUT = 100; /* poll() timeout in ms */
static constexpr int RTP_MAX_PACKET_LENGTH = 2048;
// Maximal size allowed for a RTP packet.
// This value of 1232 bytes is an IPv6 minimum (1280 - 40 IPv6 header - 8 UDP header).
static const size_t RTP_BUFFER_SIZE = 1232; // also used for RTPC
static const size_t SRTP_BUFFER_SIZE = RTP_BUFFER_SIZE - 10; // minus biggest authentication tag (=> SRTP_AES128_CM_HMAC_SHA1_80)
enum class DataType : unsigned { RTP=1<<0, RTCP=1<<1 }; enum class DataType : unsigned { RTP=1<<0, RTCP=1<<1 };
...@@ -88,7 +92,7 @@ public: ...@@ -88,7 +92,7 @@ public:
SRTPContext srtp_out {}; SRTPContext srtp_out {};
SRTPContext srtp_in {}; SRTPContext srtp_in {};
uint8_t encryptbuf[RTP_MAX_PACKET_LENGTH]; uint8_t encryptbuf[SRTP_BUFFER_SIZE];
private: private:
void srtp_close() noexcept { void srtp_close() noexcept {
...@@ -189,10 +193,6 @@ udp_socket_create(sockaddr_storage* addr, socklen_t* addr_len, int local_port) ...@@ -189,10 +193,6 @@ udp_socket_create(sockaddr_storage* addr, socklen_t* addr_len, int local_port)
return udp_fd; return udp_fd;
} }
// Maximal size allowed for a RTP packet, this value of 1232 bytes is an IPv6 minimum (1280 - 40 IPv6 header - 8 UDP header).
static const size_t RTP_BUFFER_SIZE = 1232;
static const size_t SRTP_BUFFER_SIZE = RTP_BUFFER_SIZE - 10;
SocketPair::SocketPair(const char *uri, int localPort) SocketPair::SocketPair(const char *uri, int localPort)
: rtp_sock_() : rtp_sock_()
, rtcp_sock_() , rtcp_sock_()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment