uvgRTP
Typedefs | Enumerations
util.hh File Reference

Go to the source code of this file.

Typedefs

typedef enum RTP_ERROR rtp_error_t
 
typedef enum RTP_FORMAT rtp_format_t
 
typedef enum RTP_FLAGS rtp_flags_t
 

Enumerations

enum  RTP_ERROR {
  RTP_MULTIPLE_PKTS_READY = 6 ,
  RTP_PKT_READY = 5 ,
  RTP_PKT_MODIFIED = 4 ,
  RTP_PKT_NOT_HANDLED = 3 ,
  RTP_INTERRUPTED = 2 ,
  RTP_NOT_READY = 1 ,
  RTP_OK = 0 ,
  RTP_GENERIC_ERROR = -1 ,
  RTP_SOCKET_ERROR = -2 ,
  RTP_BIND_ERROR = -3 ,
  RTP_INVALID_VALUE = -4 ,
  RTP_SEND_ERROR = -5 ,
  RTP_MEMORY_ERROR = -6 ,
  RTP_SSRC_COLLISION = -7 ,
  RTP_INITIALIZED = -8 ,
  RTP_NOT_INITIALIZED = -9 ,
  RTP_NOT_SUPPORTED = -10 ,
  RTP_RECV_ERROR = -11 ,
  RTP_TIMEOUT = -12 ,
  RTP_NOT_FOUND = -13 ,
  RTP_AUTH_TAG_MISMATCH = -14
}
 RTP error codes. More...
 
enum  RTP_FORMAT {
  RTP_FORMAT_GENERIC = 0 ,
  RTP_FORMAT_H264 = 95 ,
  RTP_FORMAT_H265 = 96 ,
  RTP_FORMAT_H266 = 97 ,
  RTP_FORMAT_OPUS = 98
}
 These flags are given to uvgrtp::session::create_stream() More...
 
enum  RTP_FLAGS {
  RTP_NO_FLAGS = 0 << 0 ,
  RTP_SLICE = 1 << 0 ,
  RTP_COPY = 1 << 1
}
 These flags are given to uvgrtp::media_stream::push_frame() and they can be OR'ed together. More...
 
enum  RTP_CTX_ENABLE_FLAGS {
  RCE_NO_FLAGS = 0 << 0 ,
  RCE_SYSTEM_CALL_DISPATCHER = 1 << 2 ,
  RCE_SRTP = 1 << 3 ,
  RCE_SRTP_KMNGMNT_ZRTP = 1 << 4 ,
  RCE_SRTP_KMNGMNT_USER = 1 << 5 ,
  RCE_NO_H26X_INTRA_DELAY = 1 << 5 ,
  RCE_FRAGMENT_GENERIC = 1 << 6 ,
  RCE_SRTP_INPLACE_ENCRYPTION = 1 << 7 ,
  RCE_NO_SYSTEM_CALL_CLUSTERING = 1 << 8 ,
  RCE_SRTP_NULL_CIPHER = 1 << 9 ,
  RCE_SRTP_AUTHENTICATE_RTP = 1 << 10 ,
  RCE_SRTP_REPLAY_PROTECTION = 1 << 11 ,
  RCE_RTCP = 1 << 12 ,
  RCE_H26X_PREPEND_SC = 1 << 13 ,
  RCE_HOLEPUNCH_KEEPALIVE = 1 << 14 ,
  RCE_SRTP_KEYSIZE_192 = 1 << 15 ,
  RCE_SRTP_KEYSIZE_256 = 1 << 16 ,
  RCE_LAST = 1 << 17
}
 RTP context enable flags. More...
 
enum  RTP_CTX_CONFIGURATION_FLAGS {
  RCC_NO_FLAGS = 0 ,
  RCC_UDP_RCV_BUF_SIZE = 1 ,
  RCC_UDP_SND_BUF_SIZE = 2 ,
  RCC_PKT_MAX_DELAY = 3 ,
  RCC_DYN_PAYLOAD_TYPE = 4 ,
  RCC_MTU_SIZE = 5 ,
  RCC_LAST
}
 RTP context configuration flags. More...
 

Enumeration Type Documentation

◆ RTP_CTX_CONFIGURATION_FLAGS

RTP context configuration flags.

These flags are given to uvgrtp::media_stream::configure_ctx

Enumerator
RCC_UDP_RCV_BUF_SIZE 

How large is the receiver UDP buffer size

Default value is 4 MB

For video with high bitrate, it is advisable to set this to a high number to prevent OS from dropping packets

RCC_UDP_SND_BUF_SIZE 

How large is the sender UDP buffer size

Default value is 4 MB

For video with high bitrate, it is advisable to set this to a high number to prevent OS from dropping packets

RCC_PKT_MAX_DELAY 

How many milliseconds is each frame waited until it's dropped

Default is 100 milliseconds

This is valid only for fragmented frames, i.e. RTP_FORMAT_H26X and RTP_FORMAT_GENERIC with RCE_FRAGMENT_GENERIC (TODO)

RCC_DYN_PAYLOAD_TYPE 

Overwrite uvgRTP's own payload type in RTP packets and specify your own dynamic payload type for all packets of an RTP stream

RCC_MTU_SIZE 

Set a maximum value for the Ethernet frame size assumed by uvgRTP.

Default is 1500, from this Ethernet, IPv4 and UDP, and RTP headers are removed from this, giving a payload size of 1446 bytes

If application wishes to use small UDP datagrams for some reason, it can set MTU size to, for example, 500 bytes or if it wishes to use jumbo frames, it can set the MTU size to 9000 bytes

◆ RTP_CTX_ENABLE_FLAGS

RTP context enable flags.

These flags are passed to uvgrtp::session::create_stream and can be OR'ed together

Enumerator
RCE_SRTP 

Use SRTP for this connection

RCE_SRTP_KMNGMNT_ZRTP 

Use ZRTP for key management

If this flag is provided, before the session starts, ZRTP will negotiate keys with the remote participants and these keys are used as salting/keying material for the session.

This flag must be coupled with RCE_SRTP and is mutually exclusive with RCE_SRTP_KMNGMNT_USER.

RCE_SRTP_KMNGMNT_USER 

Use user-defined way to manage keys

If this flag is provided, before the media transportation starts, user must provide a master key and salt form which SRTP session keys are derived

This flag must be coupled with RCE_SRTP and is mutually exclusive with RCE_SRTP_KMNGMNT_ZRTP

RCE_NO_H26X_INTRA_DELAY 

When uvgRTP is receiving H26X stream, as an attempt to improve QoS, it will set frame delay for intra frames to be the same as intra period.

What this means is that if the regular timer expires for frame (100 ms) and the frame type is intra, uvgRTP will not drop the frame but will continue receiving packets in hopes that all the packets of the intra frame will be received and the frame can be returned to user. During this period, when the intra frame is deemed to be late and incomplete, uvgRTP will drop all inter frames until a) all the packets of late intra frame are received or b) a new intra frame is received

This behaviour should reduce the number of gray screens during video decoding but might cause the video stream to freeze for a while which is subjectively lesser of two evils

This behavior can be disabled with RCE_NO_H26X_INTRA_DELAY If this flag is given, uvgRTP treats all frame types equally and drops all frames that are late

RCE_FRAGMENT_GENERIC 

Fragment generic frames into RTP packets of 1500 bytes.

If RCE_FRAGMENT_GENERIC is given to create_stream(), uvgRTP will split frames of type RTP_FORMAT_GENERIC into packets of 1500 bytes automatically and reconstruct the full frame from the fragments in the receiver

This behavior is not from any specification and only supported by uvgRTP so it will break interoperability between libraries if enabled.

RCE_FRAGMENT_GENERIC can be used, for example, when you're using uvgRTP for both sender and receiver and the media stream you wish to stream is not supported by uvgRTP but requires packetization because MEDIA_FRAME_SIZE > MTU

RCE_SRTP_INPLACE_ENCRYPTION 

If SRTP is enabled and RCE_INPLACE_ENCRYPTION flag is not given, uvgRTP will make a copy of the frame given to push_frame().

If the frame is writable and the application no longer needs the frame, RCE_INPLACE_ENCRYPTION should be given to create_stream() to prevent unnecessary copy operations.

If RCE_INPLACE_ENCRYPTION is given to push_frame(), the input pointer must be writable!

RCE_NO_SYSTEM_CALL_CLUSTERING 

Disable System Call Clustering (SCC)

RCE_SRTP_NULL_CIPHER 

Disable RTP payload encryption

RCE_SRTP_AUTHENTICATE_RTP 

Enable RTP packet authentication

This flag forces the security layer to add authentication tag to each outgoing RTP packet for all streams that have SRTP enabled.

NOTE: this flag must be coupled with at least RCE_SRTP

RCE_SRTP_REPLAY_PROTECTION 

Enable packet replay protection

RCE_RTCP 

Enable RTCP for the media stream. If SRTP is enabled, SRTCP is used instead

RCE_H26X_PREPEND_SC 

Prepend a 4-byte start code (0x00000001) to HEVC each frame

RCE_HOLEPUNCH_KEEPALIVE 

If the Mediastream object is used as a unidirectional stream but holepunching has been enabled, this flag can be used to make uvgRTP periodically send a short UDP datagram to keep the hole in the firewall open

RCE_SRTP_KEYSIZE_192 

Use 192-bit keys with SRTP

RCE_SRTP_KEYSIZE_256 

Use 256-bit keys with SRTP

◆ RTP_ERROR

enum RTP_ERROR

RTP error codes.

These error valus are returned from various uvgRTP functions. Functions that return a pointer set rtp_errno global value that should be checked if a function call failed

Enumerator
RTP_OK 

Success.

RTP_GENERIC_ERROR 

Generic error condition.

RTP_SOCKET_ERROR 

Failed to create socket.

RTP_BIND_ERROR 

Failed to bind to interface.

RTP_INVALID_VALUE 

Invalid value.

RTP_SEND_ERROR 

System call send(2) or one of its derivatives failed.

RTP_MEMORY_ERROR 

Memory allocation failed.

RTP_SSRC_COLLISION 

SSRC collision detected.

RTP_INITIALIZED 

Object already initialized.

RTP_NOT_INITIALIZED 

Object has not been initialized.

RTP_NOT_SUPPORTED 

Method/version/extension not supported.

RTP_RECV_ERROR 

System call recv(2) or one of its derivatives failed.

RTP_TIMEOUT 

Operation timed out.

RTP_NOT_FOUND 

Object not found.

RTP_AUTH_TAG_MISMATCH 

Authentication tag does not match the RTP packet contents.

◆ RTP_FLAGS

enum RTP_FLAGS

These flags are given to uvgrtp::media_stream::push_frame() and they can be OR'ed together.

Enumerator
RTP_NO_FLAGS 

No flags

RTP_SLICE 

Treat the incoming frame as an H26X slice unit and do not perform start code lookup on it

RTP_COPY 

Make a copy of the data given to push_frame() and operate on that

◆ RTP_FORMAT

enum RTP_FORMAT

These flags are given to uvgrtp::session::create_stream()

Enumerator
RTP_FORMAT_GENERIC 

Generic format.

RTP_FORMAT_H264 

H.264/AVC.

RTP_FORMAT_H265 

H.265/HEVC.

RTP_FORMAT_H266 

H.266/VVC.

RTP_FORMAT_OPUS 

Opus.