Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::rtcp::Builder Class Reference

RTCP compound packet builder. More...

#include <builder.h>

Inheritance diagram for roc::rtcp::Builder:
Collaboration diagram for roc::rtcp::Builder:

Public Member Functions

 Builder (const Config &config, core::Slice< uint8_t > &result)
 Initialize builder. It will write data to the given slice. More...
 
bool is_ok () const
 Check for errors. More...
 
Sender Report (SR)
void begin_sr (const header::SenderReportPacket &sr)
 Start SR packet inside compound RTCP packet. More...
 
void add_sr_report (const header::ReceptionReportBlock &report)
 Add reception report to current SR packet. More...
 
void end_sr ()
 Finish SR packet. More...
 
Receiver Report (RR)
void begin_rr (const header::ReceiverReportPacket &rr)
 Start RR packet inside compound RTCP packet. More...
 
void add_rr_report (const header::ReceptionReportBlock &report)
 Add reception report to current RR packet. More...
 
void end_rr ()
 Finish RR packet. More...
 
Extended Report (XR)
void begin_xr (const header::XrPacket &xr)
 Start XR packet inside compound RTCP packet. More...
 
void add_xr_rrtr (const header::XrRrtrBlock &rrtr)
 Add RRTR block to current XR packet. More...
 
void begin_xr_dlrr (const header::XrDlrrBlock &dlrr)
 Start DLRR block inside current XR packet. More...
 
void add_xr_dlrr_report (const header::XrDlrrSubblock &report)
 Add DLRR report to current DLRR block. More...
 
void add_xr_measurement_info (const header::XrMeasurementInfoBlock &measurement_info)
 Add measurement info block.to current XR packet. More...
 
void add_xr_delay_metrics (const header::XrDelayMetricsBlock &delay_metrics)
 Add delay metrics block.to current XR packet. More...
 
void add_xr_queue_metrics (const header::XrQueueMetricsBlock &queue_metrics)
 Add queue metrics block.to current XR packet. More...
 
void end_xr_dlrr ()
 Finish current DLRR block. More...
 
void end_xr ()
 Finish current XR packet. More...
 
Session Description (SDES)
void begin_sdes ()
 Start SDES packet inside compound RTCP packet. More...
 
void begin_sdes_chunk (const SdesChunk &chunk)
 Start new SDES chunk in current SDES packet. More...
 
void add_sdes_item (const SdesItem &item)
 Add SDES item to current SDES chunk. More...
 
void end_sdes_chunk ()
 Finish current SDES chunk. More...
 
void end_sdes ()
 Finish current SDES packet. More...
 
Goodbye message (BYE)
void begin_bye ()
 Start BYE packet inside compound RTCP packet. More...
 
void add_bye_ssrc (const packet::stream_source_t ssrc)
 Add SSRC to current BYE packet. More...
 
void add_bye_reason (const char *reason)
 Add REASON to current BYE packet. More...
 
void end_bye ()
 Finish current BYE packet. More...
 
Packet padding
void add_padding (size_t padding_len)
 Add given number of padding bytes to last packet. Padding should be multiple of 4 in range [1; 255]. More...
 

Detailed Description

RTCP compound packet builder.

Builder will panic if any of the following rules is violated (mandated by RFC 3550):

  • At least one packet should be present.
  • First packet should be SR or RR.
  • SDES packet with CNAME item should be present.
  • Each SDES chunk should have exactly one CNAME item.
  • Padding can be added only to last packet.

If the packet does not fit into resulting slice, builder will raise error flags, and all its method will become no-op.

Some of these rules may be disabled via config struct, which is used in tests when we need to produce not strictly correct RTCP packets.

Definition at line 41 of file builder.h.

Constructor & Destructor Documentation

◆ Builder()

roc::rtcp::Builder::Builder ( const Config config,
core::Slice< uint8_t > &  result 
)

Initialize builder. It will write data to the given slice.

Member Function Documentation

◆ add_bye_reason()

void roc::rtcp::Builder::add_bye_reason ( const char *  reason)

Add REASON to current BYE packet.

◆ add_bye_ssrc()

void roc::rtcp::Builder::add_bye_ssrc ( const packet::stream_source_t  ssrc)

Add SSRC to current BYE packet.

◆ add_padding()

void roc::rtcp::Builder::add_padding ( size_t  padding_len)

Add given number of padding bytes to last packet. Padding should be multiple of 4 in range [1; 255].

◆ add_rr_report()

void roc::rtcp::Builder::add_rr_report ( const header::ReceptionReportBlock report)

Add reception report to current RR packet.

◆ add_sdes_item()

void roc::rtcp::Builder::add_sdes_item ( const SdesItem item)

Add SDES item to current SDES chunk.

◆ add_sr_report()

void roc::rtcp::Builder::add_sr_report ( const header::ReceptionReportBlock report)

Add reception report to current SR packet.

◆ add_xr_delay_metrics()

void roc::rtcp::Builder::add_xr_delay_metrics ( const header::XrDelayMetricsBlock delay_metrics)

Add delay metrics block.to current XR packet.

◆ add_xr_dlrr_report()

void roc::rtcp::Builder::add_xr_dlrr_report ( const header::XrDlrrSubblock report)

Add DLRR report to current DLRR block.

◆ add_xr_measurement_info()

void roc::rtcp::Builder::add_xr_measurement_info ( const header::XrMeasurementInfoBlock measurement_info)

Add measurement info block.to current XR packet.

◆ add_xr_queue_metrics()

void roc::rtcp::Builder::add_xr_queue_metrics ( const header::XrQueueMetricsBlock queue_metrics)

Add queue metrics block.to current XR packet.

◆ add_xr_rrtr()

void roc::rtcp::Builder::add_xr_rrtr ( const header::XrRrtrBlock rrtr)

Add RRTR block to current XR packet.

◆ begin_bye()

void roc::rtcp::Builder::begin_bye ( )

Start BYE packet inside compound RTCP packet.

◆ begin_rr()

void roc::rtcp::Builder::begin_rr ( const header::ReceiverReportPacket rr)

Start RR packet inside compound RTCP packet.

◆ begin_sdes()

void roc::rtcp::Builder::begin_sdes ( )

Start SDES packet inside compound RTCP packet.

◆ begin_sdes_chunk()

void roc::rtcp::Builder::begin_sdes_chunk ( const SdesChunk chunk)

Start new SDES chunk in current SDES packet.

◆ begin_sr()

void roc::rtcp::Builder::begin_sr ( const header::SenderReportPacket sr)

Start SR packet inside compound RTCP packet.

◆ begin_xr()

void roc::rtcp::Builder::begin_xr ( const header::XrPacket xr)

Start XR packet inside compound RTCP packet.

◆ begin_xr_dlrr()

void roc::rtcp::Builder::begin_xr_dlrr ( const header::XrDlrrBlock dlrr)

Start DLRR block inside current XR packet.

◆ end_bye()

void roc::rtcp::Builder::end_bye ( )

Finish current BYE packet.

◆ end_rr()

void roc::rtcp::Builder::end_rr ( )

Finish RR packet.

◆ end_sdes()

void roc::rtcp::Builder::end_sdes ( )

Finish current SDES packet.

◆ end_sdes_chunk()

void roc::rtcp::Builder::end_sdes_chunk ( )

Finish current SDES chunk.

◆ end_sr()

void roc::rtcp::Builder::end_sr ( )

Finish SR packet.

◆ end_xr()

void roc::rtcp::Builder::end_xr ( )

Finish current XR packet.

◆ end_xr_dlrr()

void roc::rtcp::Builder::end_xr_dlrr ( )

Finish current DLRR block.

◆ is_ok()

bool roc::rtcp::Builder::is_ok ( ) const

Check for errors.

Returns
false if the packet did not fit into the slice.

The documentation for this class was generated from the following file: