SmolRTSP 0.2.0
A small, portable, extensible RTSP 1.0 implementation in C99
Loading...
Searching...
No Matches
av1_transport.h File Reference

An RTP/AV1 data transport. More...

#include <smolrtsp/av1.h>
#include <smolrtsp/droppable.h>
#include <smolrtsp/rtp_transport.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <slice99.h>
#include <smolrtsp/priv/compiler_attrs.h>
Include dependency graph for av1_transport.h:

Go to the source code of this file.

Data Structures

struct  SmolRTSP_Av1TransportConfig
 The configuration structure for SmolRTSP_Av1Transport. More...
 

Macros

#define SMOLRTSP_MAX_AV1_PACKET_SIZE   1200
 The default value for SmolRTSP_Av1TransportConfig.max_packet_size.
 

Typedefs

typedef struct SmolRTSP_Av1Transport SmolRTSP_Av1Transport
 An RTP/AV1 data transport.
 

Functions

SmolRTSP_Av1TransportConfig SmolRTSP_Av1TransportConfig_default (void) SMOLRTSP_PRIV_MUST_USE
 Returns the default SmolRTSP_Av1TransportConfig: SMOLRTSP_MAX_AV1_PACKET_SIZE.
 
SmolRTSP_Av1TransportSmolRTSP_Av1Transport_new (SmolRTSP_RtpTransport *t) SMOLRTSP_PRIV_MUST_USE
 Creates a new RTP/AV1 transport with the default configuration.
 
SmolRTSP_Av1TransportSmolRTSP_Av1Transport_new_with_config (SmolRTSP_RtpTransport *t, SmolRTSP_Av1TransportConfig config) SMOLRTSP_PRIV_MUST_USE
 Creates a new RTP/AV1 transport with a custom configuration.
 
int SmolRTSP_Av1Transport_send_temporal_unit (SmolRTSP_Av1Transport *self, SmolRTSP_RtpTimestamp ts, U8Slice99 obus, bool is_new_cvs) SMOLRTSP_PRIV_MUST_USE
 Sends a complete AV1 temporal unit (TU) as a sequence of RTP packets.
 
 declImplExtern99 (SmolRTSP_Droppable, SmolRTSP_Av1Transport)
 Implements SmolRTSP_Droppable_IFACE for SmolRTSP_Av1Transport.
 
bool SmolRTSP_Av1Transport_is_full (SmolRTSP_Av1Transport *self)
 

Detailed Description

An RTP/AV1 data transport.

See also
AOMedia AV1 RTP Specification: https://aomediacodec.github.io/av1-rtp-spec/
AV1 Bitstream & Decoding Process Specification: https://aomediacodec.github.io/av1-spec/av1-spec.pdf

Macro Definition Documentation

◆ SMOLRTSP_MAX_AV1_PACKET_SIZE

#define SMOLRTSP_MAX_AV1_PACKET_SIZE   1200

The default value for SmolRTSP_Av1TransportConfig.max_packet_size.

Includes the 1-byte AV1 aggregation header: the OBU-element bytes carried per RTP packet are at most max_packet_size - SMOLRTSP_AV1_AGGREGATION_HEADER_SIZE.

Function Documentation

◆ declImplExtern99()

declImplExtern99 ( SmolRTSP_Droppable  ,
SmolRTSP_Av1Transport   
)

Implements SmolRTSP_Droppable_IFACE for SmolRTSP_Av1Transport.

See Interface99 for the macro usage.

◆ SmolRTSP_Av1Transport_new()

SmolRTSP_Av1Transport * SmolRTSP_Av1Transport_new ( SmolRTSP_RtpTransport t)

Creates a new RTP/AV1 transport with the default configuration.

Parameters
[in]tThe underlying RTP transport.
Precondition
t != NULL.

◆ SmolRTSP_Av1Transport_new_with_config()

SmolRTSP_Av1Transport * SmolRTSP_Av1Transport_new_with_config ( SmolRTSP_RtpTransport t,
SmolRTSP_Av1TransportConfig  config 
)

Creates a new RTP/AV1 transport with a custom configuration.

Parameters
[in]tThe underlying RTP transport.
[in]configThe transmission configuration structure.
Precondition
t != NULL.
config.max_packet_size > SMOLRTSP_AV1_AGGREGATION_HEADER_SIZE + 1.

◆ SmolRTSP_Av1Transport_send_temporal_unit()

int SmolRTSP_Av1Transport_send_temporal_unit ( SmolRTSP_Av1Transport self,
SmolRTSP_RtpTimestamp  ts,
U8Slice99  obus,
bool  is_new_cvs 
)

Sends a complete AV1 temporal unit (TU) as a sequence of RTP packets.

obus is the concatenated raw OBU stream for one TU exactly as emitted by an AV1 encoder (each OBU prefixed by its OBU header byte, optional extension header byte, and – if obu_has_size_field == 1 – a LEB128 obu_size field, followed by obu_size bytes of payload). The library:

  1. Parses the stream into OBUs.
  2. Drops OBUs of type SMOLRTSP_AV1_OBU_TEMPORAL_DELIMITER and SMOLRTSP_AV1_OBU_TILE_LIST per AOMedia AV1 RTP §5.
  3. Clears the obu_has_size_field bit and drops the obu_size LEB128 from each remaining OBU, per AOMedia AV1 RTP §4.5.
  4. Emits one RTP packet per OBU (W=1); if an OBU exceeds the MTU budget it is split across consecutive packets with the Z and Y continuation flags set per §4.4.

The RTP marker bit is set on the very last packet of the TU. The N (new coded video sequence) bit is set on the first packet only when is_new_cvs is true; that packet must not be a continuation (Z=0) per the §4.4 constraint.

Each packet shares ts as its RTP timestamp.

Parameters
[in]selfThe transport.
[in]tsThe RTP timestamp shared by every packet of the TU.
[in]obusThe concatenated raw OBU bytes of this temporal unit.
[in]is_new_cvstrue iff this TU begins a new coded video sequence (typically when it contains a sequence header OBU and the receiver should treat it as a sync point).
Precondition
self != NULL.
Returns
0 on success; -1 on I/O error (with errno set) or on an OBU stream that fails to parse.