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

RTCP report processor and generator. More...

#include <reporter.h>

Inheritance diagram for roc::rtcp::Reporter:
Collaboration diagram for roc::rtcp::Reporter:

Public Member Functions

 Reporter (const Config &config, IParticipant &participant, core::IArena &arena)
 Initialize. More...
 
bool is_valid () const
 Check if initialization succeeded. More...
 
bool is_sending () const
 Check if there is local sending stream. More...
 
bool is_receiving () const
 Check if there are local receiving streams. More...
 
size_t total_destinations () const
 Get number of tracked destination addresses, for testing. More...
 
size_t total_streams () const
 Get number of tracked streams, for testing. More...
 
Report processing
ROC_ATTR_NODISCARD status::StatusCode begin_processing (const address::SocketAddr &report_addr, core::nanoseconds_t report_time)
 Begin report processing. Invoked before process_xxx() functions. More...
 
void process_cname (const SdesChunk &chunk, const SdesItem &item)
 Process SDES CNAME. More...
 
void process_sr (const header::SenderReportPacket &sr)
 Process SR header. More...
 
void process_reception_block (packet::stream_source_t ssrc, const header::ReceptionReportBlock &blk)
 Process SR/RR reception block. More...
 
void process_dlrr_subblock (const header::XrPacket &xr, const header::XrDlrrSubblock &blk)
 Process XR DLRR sub-block (extended sender report). More...
 
void process_rrtr_block (const header::XrPacket &xr, const header::XrRrtrBlock &blk)
 Process XR RRTR block (extended receiver report). More...
 
void process_measurement_info_block (const header::XrPacket &xr, const header::XrMeasurementInfoBlock &blk)
 Process XR Measurement Info block (extended receiver report). More...
 
void process_delay_metrics_block (const header::XrPacket &xr, const header::XrDelayMetricsBlock &blk)
 Process XR Delay Metrics block (extended receiver report). More...
 
void process_queue_metrics_block (const header::XrPacket &xr, const header::XrQueueMetricsBlock &blk)
 Process XR Queue Metrics block (extended receiver report). More...
 
void process_goodbye (packet::stream_source_t ssrc)
 Process BYE message. More...
 
ROC_ATTR_NODISCARD status::StatusCode end_processing ()
 End report processing. Invoked after process_xxx() functions. More...
 
Report generation
ROC_ATTR_NODISCARD status::StatusCode begin_generation (core::nanoseconds_t report_time)
 Begin report generation. Invoked before genrate_xxx() functions. More...
 
size_t num_dest_addresses () const
 Get number of destination addresses to which to send reports. More...
 
size_t num_sending_streams (size_t addr_index) const
 Get number of sending streams to be reported. addr_index should be in range [0; num_dest_addresses()-1]. More...
 
size_t num_receiving_streams (size_t addr_index) const
 Get number of receiving streams to be reported. addr_index should be in range [0; num_dest_addresses()-1]. More...
 
void generate_dest_address (size_t addr_index, address::SocketAddr &addr)
 Generate destination address. addr_index should be in range [0; num_dest_addresses()-1]. More...
 
void generate_cname (SdesChunk &chunk, SdesItem &item)
 Generate SDES chunk with CNAME item. More...
 
void generate_sr (header::SenderReportPacket &sr)
 Generate SR header. More...
 
void generate_rr (header::ReceiverReportPacket &rr)
 Generate RR header. More...
 
void generate_reception_block (size_t addr_index, size_t stream_index, header::ReceptionReportBlock &blk)
 Generate SR/RR reception block. addr_index should be in range [0; num_dest_addresses()-1]. stream_index should be in range [0; num_receiving_streams()-1]. More...
 
void generate_xr (header::XrPacket &xr)
 Generate XR header. More...
 
void generate_dlrr_subblock (size_t addr_index, size_t stream_index, header::XrDlrrSubblock &blk)
 Generate XR DLRR sub-block (extended sender report). addr_index should be in range [0; num_dest_addresses()-1]. stream_index should be in range [0; num_sending_streams()-1]. More...
 
void generate_rrtr_block (header::XrRrtrBlock &blk)
 Generate XR RRTR header (extended receiver report). More...
 
void generate_measurement_info_block (size_t addr_index, size_t stream_index, header::XrMeasurementInfoBlock &blk)
 Generate XR Measurement Info block (extended receiver report). addr_index should be in range [0; num_dest_addresses()-1]. stream_index should be in range [0; num_receiving_streams()-1]. More...
 
void generate_delay_metrics_block (size_t addr_index, size_t stream_index, header::XrDelayMetricsBlock &blk)
 Generate XR Delay Metrics block (extended receiver report). addr_index should be in range [0; num_dest_addresses()-1]. stream_index should be in range [0; num_receiving_streams()-1]. More...
 
void generate_queue_metrics_block (size_t addr_index, size_t stream_index, header::XrQueueMetricsBlock &blk)
 Generate XR Queue Metrics block (extended receiver report). addr_index should be in range [0; num_dest_addresses()-1]. stream_index should be in range [0; num_receiving_streams()-1]. More...
 
bool need_goodbye () const
 Check if BYE message should be included. More...
 
void generate_goodbye (packet::stream_source_t &ssrc)
 Generate BYE message. More...
 
ROC_ATTR_NODISCARD status::StatusCode end_generation ()
 End report generation. Invoked after generate_xxx() functions. More...
 

Detailed Description

RTCP report processor and generator.

Used by rtcp::Communicator to incrementally process and generate individual blocks of compound RTCP packets. Collects data from RTCP traffic and local pipeline (IParticipant).

Features:

  • Maintains hash table of all known sending and receiving streams. The table is populated from two sources: reports gathered via RTCP from remote peers and local reports gathered from IParticipant.
  • Maintains hash table of all destination addresses where to send reports, and an index to quickly find which streams are associated with each address.
  • Provides methods to process report blocks from incoming RTCP packets. Incrementally fills internal tables from provided report blocks. When RTCP packet is fully processed, notifies IParticipant with the updated remote reports accumulated in internal tables.
  • Provides methods to generate report blocks for outgoing RTCP packets. Queries up-to-date local reports from IParticipant into internal tables. Incrementally fills report blocks from the internal tables.
  • Notifies IParticipant when a stream is removed after receiving BYE message or due to inactivity timeout.
  • Detects SSRC collisions and asks IParticipant to switch SSRC. Sends BYE message for old SSRC.

Workflow of incoming packets processing:

reporter.begin_processing()
reporter.process_sr(...)
reporter.process_reception_block(...)
...
reporter.end_processing()

Workflow of outgoing packet generation:

reporter.begin_generation();
reporter.generate_sr(...)
reporter.generate_reception_block(...)
...
reporter.end_generation()

Definition at line 90 of file reporter.h.

Constructor & Destructor Documentation

◆ Reporter()

roc::rtcp::Reporter::Reporter ( const Config config,
IParticipant participant,
core::IArena arena 
)

Initialize.

Member Function Documentation

◆ begin_generation()

ROC_ATTR_NODISCARD status::StatusCode roc::rtcp::Reporter::begin_generation ( core::nanoseconds_t  report_time)

Begin report generation. Invoked before genrate_xxx() functions.

◆ begin_processing()

ROC_ATTR_NODISCARD status::StatusCode roc::rtcp::Reporter::begin_processing ( const address::SocketAddr report_addr,
core::nanoseconds_t  report_time 
)

Begin report processing. Invoked before process_xxx() functions.

◆ end_generation()

ROC_ATTR_NODISCARD status::StatusCode roc::rtcp::Reporter::end_generation ( )

End report generation. Invoked after generate_xxx() functions.

◆ end_processing()

ROC_ATTR_NODISCARD status::StatusCode roc::rtcp::Reporter::end_processing ( )

End report processing. Invoked after process_xxx() functions.

◆ generate_cname()

void roc::rtcp::Reporter::generate_cname ( SdesChunk chunk,
SdesItem item 
)

Generate SDES chunk with CNAME item.

◆ generate_delay_metrics_block()

void roc::rtcp::Reporter::generate_delay_metrics_block ( size_t  addr_index,
size_t  stream_index,
header::XrDelayMetricsBlock blk 
)

Generate XR Delay Metrics block (extended receiver report). addr_index should be in range [0; num_dest_addresses()-1]. stream_index should be in range [0; num_receiving_streams()-1].

◆ generate_dest_address()

void roc::rtcp::Reporter::generate_dest_address ( size_t  addr_index,
address::SocketAddr addr 
)

Generate destination address. addr_index should be in range [0; num_dest_addresses()-1].

◆ generate_dlrr_subblock()

void roc::rtcp::Reporter::generate_dlrr_subblock ( size_t  addr_index,
size_t  stream_index,
header::XrDlrrSubblock blk 
)

Generate XR DLRR sub-block (extended sender report). addr_index should be in range [0; num_dest_addresses()-1]. stream_index should be in range [0; num_sending_streams()-1].

◆ generate_goodbye()

void roc::rtcp::Reporter::generate_goodbye ( packet::stream_source_t ssrc)

Generate BYE message.

◆ generate_measurement_info_block()

void roc::rtcp::Reporter::generate_measurement_info_block ( size_t  addr_index,
size_t  stream_index,
header::XrMeasurementInfoBlock blk 
)

Generate XR Measurement Info block (extended receiver report). addr_index should be in range [0; num_dest_addresses()-1]. stream_index should be in range [0; num_receiving_streams()-1].

◆ generate_queue_metrics_block()

void roc::rtcp::Reporter::generate_queue_metrics_block ( size_t  addr_index,
size_t  stream_index,
header::XrQueueMetricsBlock blk 
)

Generate XR Queue Metrics block (extended receiver report). addr_index should be in range [0; num_dest_addresses()-1]. stream_index should be in range [0; num_receiving_streams()-1].

◆ generate_reception_block()

void roc::rtcp::Reporter::generate_reception_block ( size_t  addr_index,
size_t  stream_index,
header::ReceptionReportBlock blk 
)

Generate SR/RR reception block. addr_index should be in range [0; num_dest_addresses()-1]. stream_index should be in range [0; num_receiving_streams()-1].

◆ generate_rr()

void roc::rtcp::Reporter::generate_rr ( header::ReceiverReportPacket rr)

Generate RR header.

◆ generate_rrtr_block()

void roc::rtcp::Reporter::generate_rrtr_block ( header::XrRrtrBlock blk)

Generate XR RRTR header (extended receiver report).

◆ generate_sr()

void roc::rtcp::Reporter::generate_sr ( header::SenderReportPacket sr)

Generate SR header.

◆ generate_xr()

void roc::rtcp::Reporter::generate_xr ( header::XrPacket xr)

Generate XR header.

◆ is_receiving()

bool roc::rtcp::Reporter::is_receiving ( ) const

Check if there are local receiving streams.

◆ is_sending()

bool roc::rtcp::Reporter::is_sending ( ) const

Check if there is local sending stream.

◆ is_valid()

bool roc::rtcp::Reporter::is_valid ( ) const

Check if initialization succeeded.

◆ need_goodbye()

bool roc::rtcp::Reporter::need_goodbye ( ) const

Check if BYE message should be included.

◆ num_dest_addresses()

size_t roc::rtcp::Reporter::num_dest_addresses ( ) const

Get number of destination addresses to which to send reports.

◆ num_receiving_streams()

size_t roc::rtcp::Reporter::num_receiving_streams ( size_t  addr_index) const

Get number of receiving streams to be reported. addr_index should be in range [0; num_dest_addresses()-1].

◆ num_sending_streams()

size_t roc::rtcp::Reporter::num_sending_streams ( size_t  addr_index) const

Get number of sending streams to be reported. addr_index should be in range [0; num_dest_addresses()-1].

◆ process_cname()

void roc::rtcp::Reporter::process_cname ( const SdesChunk chunk,
const SdesItem item 
)

Process SDES CNAME.

◆ process_delay_metrics_block()

void roc::rtcp::Reporter::process_delay_metrics_block ( const header::XrPacket xr,
const header::XrDelayMetricsBlock blk 
)

Process XR Delay Metrics block (extended receiver report).

◆ process_dlrr_subblock()

void roc::rtcp::Reporter::process_dlrr_subblock ( const header::XrPacket xr,
const header::XrDlrrSubblock blk 
)

Process XR DLRR sub-block (extended sender report).

◆ process_goodbye()

void roc::rtcp::Reporter::process_goodbye ( packet::stream_source_t  ssrc)

Process BYE message.

◆ process_measurement_info_block()

void roc::rtcp::Reporter::process_measurement_info_block ( const header::XrPacket xr,
const header::XrMeasurementInfoBlock blk 
)

Process XR Measurement Info block (extended receiver report).

◆ process_queue_metrics_block()

void roc::rtcp::Reporter::process_queue_metrics_block ( const header::XrPacket xr,
const header::XrQueueMetricsBlock blk 
)

Process XR Queue Metrics block (extended receiver report).

◆ process_reception_block()

void roc::rtcp::Reporter::process_reception_block ( packet::stream_source_t  ssrc,
const header::ReceptionReportBlock blk 
)

Process SR/RR reception block.

◆ process_rrtr_block()

void roc::rtcp::Reporter::process_rrtr_block ( const header::XrPacket xr,
const header::XrRrtrBlock blk 
)

Process XR RRTR block (extended receiver report).

◆ process_sr()

void roc::rtcp::Reporter::process_sr ( const header::SenderReportPacket sr)

Process SR header.

◆ total_destinations()

size_t roc::rtcp::Reporter::total_destinations ( ) const

Get number of tracked destination addresses, for testing.

◆ total_streams()

size_t roc::rtcp::Reporter::total_streams ( ) const

Get number of tracked streams, for testing.


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