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

Packetizer. More...

#include <packetizer.h>

Inheritance diagram for roc::audio::Packetizer:
Collaboration diagram for roc::audio::Packetizer:

Public Member Functions

 Packetizer (packet::IWriter &writer, packet::IComposer &composer, packet::ISequencer &sequencer, IFrameEncoder &payload_encoder, packet::PacketFactory &packet_factory, core::nanoseconds_t packet_length, const SampleSpec &sample_spec)
 Initialization. More...
 
bool is_valid () const
 Check if object is successfully constructed. More...
 
size_t sample_rate () const
 Get sample rate. More...
 
const PacketizerMetricsmetrics () const
 Get metrics. More...
 
virtual void write (Frame &frame)
 Write audio frame. More...
 
void flush ()
 Flush buffered packet, if any. More...
 
- Public Member Functions inherited from roc::core::ListNode< Tag >
ListDatalist_data () const
 Get pointer to internal data. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from roc::core::ListNode< Tag >
static ListNodelist_node (ListData *data)
 Get pointer to parent node from pointer to internal data. More...
 

Detailed Description

Packetizer.

Remarks
Gets an audio stream, encodes samples to packets using an encoder, and writes packets to a packet writer.

Definition at line 49 of file packetizer.h.

Constructor & Destructor Documentation

◆ Packetizer()

roc::audio::Packetizer::Packetizer ( packet::IWriter writer,
packet::IComposer composer,
packet::ISequencer sequencer,
IFrameEncoder payload_encoder,
packet::PacketFactory packet_factory,
core::nanoseconds_t  packet_length,
const SampleSpec sample_spec 
)

Initialization.

Parameters

  • writer is used to write generated packets
  • composer is used to initialize new packets
  • sequencer is used to put packets in sequence
  • payload_encoder is used to write samples to packets
  • packet_factory is used to allocate packets
  • buffer_factory is used to allocate buffers for packets
  • packet_length defines packet length in nanoseconds
  • sample_spec describes input frames

Member Function Documentation

◆ flush()

void roc::audio::Packetizer::flush ( )

Flush buffered packet, if any.

Remarks
Packet is padded to match fixed size.

◆ is_valid()

bool roc::audio::Packetizer::is_valid ( ) const

Check if object is successfully constructed.

◆ metrics()

const PacketizerMetrics& roc::audio::Packetizer::metrics ( ) const

Get metrics.

◆ sample_rate()

size_t roc::audio::Packetizer::sample_rate ( ) const

Get sample rate.

◆ write()

virtual void roc::audio::Packetizer::write ( Frame frame)
virtual

Write audio frame.

Implements roc::audio::IFrameWriter.


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