Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
RTP (Real-time Transport Protocol)

Data Structures

struct  rtp_header_extension
 RTP header extension as defined in RFC 3550 section 5.3.1. More...
struct  rtp_header
 RTP fixed header as defined in RFC 3550 section 5.1. More...
struct  rtp_packet
 Decoded RTP packet with header and payload separated. More...
struct  rtp_session_context
 RTP session configuration context. More...
struct  rtp_transport
 Internal transport state embedded in rtp_session. More...

Macros

#define RTP_VERSION   2
 RTP protocol version 2 as defined in RFC 3550.
#define RTP_MIN_HEADER_LEN   12
 Minimum RTP header length in bytes, excluding any CSRC list or extension.
#define RTP_PAYLOAD_TYPE_MAX   127
 Maximum value for the payload type in an RTP packet.
#define RTP_MARKER   1
 Convenience value for the marker argument of rtp_session_send that sets the RTP marker bit.
#define RTP_HDR_V_MASK   GENMASK(7, 6)
 Mask for the version (V) field within rtp_header::vpxcc.
#define RTP_HDR_P_MASK   BIT(5)
 Mask for the padding (P) flag within rtp_header::vpxcc.
#define RTP_HDR_X_MASK   BIT(4)
 Mask for the extension (X) flag within rtp_header::vpxcc.
#define RTP_HDR_CC_MASK   GENMASK(3, 0)
 Mask for the CSRC count (CC) field within rtp_header::vpxcc.
#define RTP_HDR_M_MASK   BIT(7)
 Mask for the marker (M) bit within rtp_header::mpt.
#define RTP_HDR_PT_MASK   GENMASK(6, 0)
 Mask for the payload type (PT) field within rtp_header::mpt.
#define RTP_MAX_CSRC_COUNT   CONFIG_RTP_MAX_CSRC_COUNT
 Maximum number of csrc's that can be stored.

Typedefs

typedef void(* rtp_rx_cb_t) (struct rtp_session *session, struct rtp_packet *packet, void *user_data)
 RTP packet receive callback type.

Enumerations

enum  rtp_role { RTP_ROLE_SINK , RTP_ROLE_SOURCE , RTP_ROLE_BOTH }
 Role of an RTP session. More...
enum  rtp_transport_type { RTP_TRANSPORT_NUM }
 Transport backend used by an RTP session. More...

Variables

uint16_t rtp_header_extension::definition
 Profile-defined extension header identifier.
uint16_t rtp_header_extension::length
 Length of the extension data in 32-bit words.
uint8_trtp_header_extension::data
 Pointer to the extension data.
uint8_t rtp_header::vpxcc
 Raw encoding of the version, padding, extension, and CC fields.
uint8_t rtp_header::mpt
 Raw encoding of the marker, and payload type fields.
uint16_t rtp_header::seq
 Sequence number, incremented by one for each RTP data packet sent.
uint32_t rtp_header::ts
 Timestamp reflecting the sampling instant of the first octet in the payload.
uint32_t rtp_header::ssrc
 Synchronization source (SSRC) identifier, chosen randomly and intended to be globally unique.
uint32_t rtp_header::csrc [CONFIG_RTP_MAX_CSRC_COUNT]
 Contributing source (CSRC) identifiers, up to.
struct rtp_header_extension rtp_header::header_extension
 Optional header extension; valid only when the x bit is set.
struct rtp_header rtp_packet::header
 Parsed RTP header.
uint8_trtp_packet::payload
 Pointer to the packet payload.
size_t rtp_packet::payload_len
 Length of the payload in bytes.
struct net_ifrtp_session_context::iface
 Network interface used by the session.
struct net_sockaddr_storage rtp_session_context::sock_addr
 Session address and port (multicast group address or unicast peer).
enum rtp_role rtp_session_context::role
 Role of the session: sink, source, or both.
uint8_t rtp_session_context::payload_type
 RTP payload type field value used when transmitting.
rtp_rx_cb_t rtp_session_context::callback
 Callback invoked upon packet reception; required when role is RTP_ROLE_SINK or RTP_ROLE_BOTH.
void * rtp_session_context::user_data
 Opaque user data forwarded to callback.
enum rtp_transport_type rtp_transport::type
 Active transport backend for this session.

Detailed Description

Version
0.1.0

Macro Definition Documentation

◆ RTP_HDR_CC_MASK

#define RTP_HDR_CC_MASK   GENMASK(3, 0)

#include <rtp.h>

Mask for the CSRC count (CC) field within rtp_header::vpxcc.

◆ RTP_HDR_M_MASK

#define RTP_HDR_M_MASK   BIT(7)

#include <rtp.h>

Mask for the marker (M) bit within rtp_header::mpt.

◆ RTP_HDR_P_MASK

#define RTP_HDR_P_MASK   BIT(5)

#include <rtp.h>

Mask for the padding (P) flag within rtp_header::vpxcc.

◆ RTP_HDR_PT_MASK

#define RTP_HDR_PT_MASK   GENMASK(6, 0)

#include <rtp.h>

Mask for the payload type (PT) field within rtp_header::mpt.

◆ RTP_HDR_V_MASK

#define RTP_HDR_V_MASK   GENMASK(7, 6)

#include <rtp.h>

Mask for the version (V) field within rtp_header::vpxcc.

◆ RTP_HDR_X_MASK

#define RTP_HDR_X_MASK   BIT(4)

#include <rtp.h>

Mask for the extension (X) flag within rtp_header::vpxcc.

◆ RTP_MARKER

#define RTP_MARKER   1

#include <rtp.h>

Convenience value for the marker argument of rtp_session_send that sets the RTP marker bit.

Pass 0 to clear the bit.

◆ RTP_MAX_CSRC_COUNT

#define RTP_MAX_CSRC_COUNT   CONFIG_RTP_MAX_CSRC_COUNT

#include <rtp.h>

Maximum number of csrc's that can be stored.

◆ RTP_MIN_HEADER_LEN

#define RTP_MIN_HEADER_LEN   12

#include <rtp.h>

Minimum RTP header length in bytes, excluding any CSRC list or extension.

◆ RTP_PAYLOAD_TYPE_MAX

#define RTP_PAYLOAD_TYPE_MAX   127

#include <rtp.h>

Maximum value for the payload type in an RTP packet.

◆ RTP_VERSION

#define RTP_VERSION   2

#include <rtp.h>

RTP protocol version 2 as defined in RFC 3550.

Typedef Documentation

◆ rtp_rx_cb_t

typedef void(* rtp_rx_cb_t) (struct rtp_session *session, struct rtp_packet *packet, void *user_data)

#include <rtp.h>

RTP packet receive callback type.

Called from the network receive context when an RTP packet arrives. Keep the callback short and non-blocking. The packet payload pointer is only valid for the duration of the callback.

The callback may still be invoked concurrently with, or immediately after, a stop of the session's receive path from another thread; a session being stopped is not a guarantee that no further callback is in flight or about to be dispatched. Implementations must tolerate a call landing after they consider the session stopped.

Parameters
sessionPointer to the RTP session that received the packet.
packetPointer to the received RTP packet.
user_dataOpaque user data supplied during session initialization.

Enumeration Type Documentation

◆ rtp_role

enum rtp_role

#include <rtp.h>

Role of an RTP session.

Enumerator
RTP_ROLE_SINK 

Session receives packets only.

RTP_ROLE_SOURCE 

Session transmits packets only.

RTP_ROLE_BOTH 

Session both transmits and receives packets.

◆ rtp_transport_type

#include <rtp.h>

Transport backend used by an RTP session.

Passed to rtp_session_init.

Enumerator
RTP_TRANSPORT_NUM 

Shall not be used as a transport type.

Indicator of maximum transport types possible.

Variable Documentation

◆ callback

rtp_rx_cb_t rtp_session_context::callback

Callback invoked upon packet reception; required when role is RTP_ROLE_SINK or RTP_ROLE_BOTH.

◆ csrc

uint32_t rtp_header::csrc[CONFIG_RTP_MAX_CSRC_COUNT]

Contributing source (CSRC) identifiers, up to.

CONFIG_RTP_MAX_CSRC_COUNT 

entries.

◆ data

uint8_t* rtp_header_extension::data

Pointer to the extension data.

◆ definition

uint16_t rtp_header_extension::definition

Profile-defined extension header identifier.

◆ header

struct rtp_header rtp_packet::header

Parsed RTP header.

◆ header_extension

struct rtp_header_extension rtp_header::header_extension

Optional header extension; valid only when the x bit is set.

◆ iface

struct net_if* rtp_session_context::iface

Network interface used by the session.

◆ length

uint16_t rtp_header_extension::length

Length of the extension data in 32-bit words.

◆ mpt

uint8_t rtp_header::mpt

Raw encoding of the marker, and payload type fields.

◆ payload

uint8_t* rtp_packet::payload

Pointer to the packet payload.

Valid only for the duration of the receive callback.

◆ payload_len

size_t rtp_packet::payload_len

Length of the payload in bytes.

◆ payload_type

uint8_t rtp_session_context::payload_type

RTP payload type field value used when transmitting.

◆ role

enum rtp_role rtp_session_context::role

Role of the session: sink, source, or both.

◆ seq

uint16_t rtp_header::seq

Sequence number, incremented by one for each RTP data packet sent.

◆ sock_addr

struct net_sockaddr_storage rtp_session_context::sock_addr

Session address and port (multicast group address or unicast peer).

◆ ssrc

uint32_t rtp_header::ssrc

Synchronization source (SSRC) identifier, chosen randomly and intended to be globally unique.

◆ ts

uint32_t rtp_header::ts

Timestamp reflecting the sampling instant of the first octet in the payload.

◆ type

enum rtp_transport_type rtp_transport::type

Active transport backend for this session.

◆ user_data

void* rtp_session_context::user_data

Opaque user data forwarded to callback.

◆ vpxcc

uint8_t rtp_header::vpxcc

Raw encoding of the version, padding, extension, and CC fields.