common: Move internal definition out from public header
This commit is contained in:
parent
72224ce909
commit
80433cfcc4
|
@ -80,6 +80,7 @@ source_group(include include/.*)
|
||||||
target_sources(${PROJECT_NAME} PRIVATE
|
target_sources(${PROJECT_NAME} PRIVATE
|
||||||
src/crypto.hh
|
src/crypto.hh
|
||||||
src/debug.hh
|
src/debug.hh
|
||||||
|
src/global.hh
|
||||||
src/random.hh
|
src/random.hh
|
||||||
src/holepuncher.hh
|
src/holepuncher.hh
|
||||||
src/hostname.hh
|
src/hostname.hh
|
||||||
|
|
|
@ -18,26 +18,6 @@ typedef SSIZE_T ssize_t;
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
namespace uvgrtp {
|
|
||||||
constexpr uint8_t IPV4_HDR_SIZE = 20;
|
|
||||||
constexpr uint8_t IPV6_HDR_SIZE = 40; // TODO: Ipv6 support
|
|
||||||
constexpr uint8_t UDP_HDR_SIZE = 8;
|
|
||||||
constexpr uint8_t RTP_HDR_SIZE = 12;
|
|
||||||
|
|
||||||
/* the default MTU size for ethernet, can be adjusted with rcc flags.
|
|
||||||
* The default is assumed to be 1500 minus 8 bytes reserved for additional protocol headers- */
|
|
||||||
constexpr uint16_t DEFAULT_MTU_SIZE = 1492;
|
|
||||||
|
|
||||||
constexpr uint16_t MAX_IPV4_PAYLOAD = DEFAULT_MTU_SIZE - IPV4_HDR_SIZE - UDP_HDR_SIZE;
|
|
||||||
constexpr uint16_t MAX_IPV6_PAYLOAD = DEFAULT_MTU_SIZE - IPV6_HDR_SIZE - UDP_HDR_SIZE;
|
|
||||||
|
|
||||||
// here we ignore ethernet frame header size since it is not included in MTU
|
|
||||||
constexpr uint16_t MAX_IPV4_MEDIA_PAYLOAD = MAX_IPV4_PAYLOAD - RTP_HDR_SIZE;
|
|
||||||
constexpr uint16_t MAX_IPV6_MEDIA_PAYLOAD = MAX_IPV6_PAYLOAD - RTP_HDR_SIZE;
|
|
||||||
|
|
||||||
constexpr int PKT_MAX_DELAY_MS = 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// \endcond
|
/// \endcond
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -242,11 +242,11 @@ ssize_t uvgrtp::formats::h26x::find_h26x_start_code(
|
||||||
// current has 2 bytes of possible start code
|
// current has 2 bytes of possible start code
|
||||||
//bool c2s = (((cur_ms >> 8) & 0xff) == 0x01);
|
//bool c2s = (((cur_ms >> 8) & 0xff) == 0x01);
|
||||||
|
|
||||||
// previous has 4 bytes of possible start code
|
// current has 4 bytes of possible start code
|
||||||
bool c4s = (cur_ms == 0x0100); // current starts with 0001
|
bool c4s = (cur_ms == 0x0100); // current starts with 0001
|
||||||
|
|
||||||
// previous has 6 bytes of start code
|
// current has 6 bytes of start code
|
||||||
bool c6s = (cur_ms == 0x0000 && (cur_ls & 0xff) == 0x01); // current is 000001XX
|
bool c6s = (cur_ms == 0x0000 && (cur_ls & 0xff) == 0x01); // current is 0000 01XX
|
||||||
|
|
||||||
#else
|
#else
|
||||||
uint16_t cur_ls = (cur_value32 >> 0) & 0xffff;
|
uint16_t cur_ls = (cur_value32 >> 0) & 0xffff;
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace uvgrtp {
|
||||||
|
constexpr uint8_t IPV4_HDR_SIZE = 20;
|
||||||
|
constexpr uint8_t IPV6_HDR_SIZE = 40; // TODO: Ipv6 support
|
||||||
|
constexpr uint8_t UDP_HDR_SIZE = 8;
|
||||||
|
constexpr uint8_t RTP_HDR_SIZE = 12;
|
||||||
|
|
||||||
|
/* the default MTU size for ethernet, can be adjusted with rcc flags.
|
||||||
|
* The default is assumed to be 1500 minus 8 bytes reserved for additional protocol headers- */
|
||||||
|
constexpr uint16_t DEFAULT_MTU_SIZE = 1492;
|
||||||
|
|
||||||
|
// here we ignore ethernet frame header size since it is not included in MTU
|
||||||
|
constexpr uint16_t MAX_IPV4_PAYLOAD = DEFAULT_MTU_SIZE - IPV4_HDR_SIZE - UDP_HDR_SIZE;
|
||||||
|
constexpr uint16_t MAX_IPV6_PAYLOAD = DEFAULT_MTU_SIZE - IPV6_HDR_SIZE - UDP_HDR_SIZE;
|
||||||
|
|
||||||
|
constexpr uint16_t MAX_IPV4_MEDIA_PAYLOAD = MAX_IPV4_PAYLOAD - RTP_HDR_SIZE;
|
||||||
|
constexpr uint16_t MAX_IPV6_MEDIA_PAYLOAD = MAX_IPV6_PAYLOAD - RTP_HDR_SIZE;
|
||||||
|
|
||||||
|
constexpr int PKT_MAX_DELAY_MS = 500;
|
||||||
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "srtp/srtcp.hh"
|
#include "srtp/srtcp.hh"
|
||||||
#include "srtp/srtp.hh"
|
#include "srtp/srtp.hh"
|
||||||
#include "formats/media.hh"
|
#include "formats/media.hh"
|
||||||
|
#include "global.hh"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include "debug.hh"
|
#include "debug.hh"
|
||||||
#include "random.hh"
|
#include "random.hh"
|
||||||
|
|
||||||
|
#include "global.hh"
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#include "srtp/srtcp.hh"
|
#include "srtp/srtcp.hh"
|
||||||
#include "rtcp_packets.hh"
|
#include "rtcp_packets.hh"
|
||||||
|
|
||||||
|
#include "global.hh"
|
||||||
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "random.hh"
|
#include "random.hh"
|
||||||
#include "memory.hh"
|
#include "memory.hh"
|
||||||
|
|
||||||
|
#include "global.hh"
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -13,8 +15,6 @@
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define INVALID_TS UINT64_MAX
|
#define INVALID_TS UINT64_MAX
|
||||||
|
|
||||||
uvgrtp::rtp::rtp(rtp_format_t fmt):
|
uvgrtp::rtp::rtp(rtp_format_t fmt):
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "../debug.hh"
|
#include "../debug.hh"
|
||||||
#include "../crypto.hh"
|
#include "../crypto.hh"
|
||||||
#include "base.hh"
|
#include "base.hh"
|
||||||
|
#include "global.hh"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
Loading…
Reference in New Issue