Skip to content

Implementing Audio Transmitter Pipelines

Kolesnik, Gennadiy edited this page Nov 25, 2024 · 1 revision

For general information about transmitter pipelines refer to the Transmitter Pipelines section section.

Audio Transmitter Pipeline Architecture

The audio transmitter pipeline, implemented in the ssdk::audio::AudioTransmitterPipeline class, processes and encodes an audio stream which is then transmitted to subscribed clients over the network. It handles audio conversion and encoding according to fixed configuration options.

Core Components

AudioTransmitterPipeline

The ssdk::audio::AudioTransmitterPipeline class is the main interface for submitting audio data and managing transmission to clients. Key functionalities include:

  • Audio Buffer Submission: Incoming audio buffers are submitted through the SubmitInput() method, initiating processing in the audio pipeline.
  • Pipeline Processing: Audio buffers are processed through conversion and encoding, prepared for client transmission.

Pipeline Components

The audio transmitter pipeline includes the following components, which prepare audio for network transmission:

1. Audio Converter (AMF AudioConverter component)

The Audio Converter prepares audio buffers for encoding, performing transformations specified by the configuration options:

  • Sample Rate Conversion: Adjusts the sample rate to match the specified encoding requirements.
  • Channel Layout Conversion: Converts audio based on the configured layout, such as stereo or mono.
  • Format Conversion: Transforms the audio sample format (e.g., PCM) to match the encoder’s input requirements.

2. Audio Encoder

The encoder compresses audio data based on the codec selected in the configuration options:

  • Supported Codecs:
    • AAC: Provides high-quality compression, compatible with most clients.
    • Opus: Efficient at lower bitrates, useful for bandwidth-constrained scenarios.

AudioTransmitterAdapter

The ssdk::audio::AudioTransmitterAdapter object dispatches the encoded audio stream obtained from the ssdk::audio::AudioTransmitterPipeline object to transmit it to all subscribed receivers. It performs the following functions:

  • Client Subscription Management: Maintains a list of clients subscribed to the audio stream, allowing efficient multi-client transmission.
  • Network Transmission:
    • SendAudioInit: Initializes the audio stream for each client, sending configuration details for codec, sample rate, and channel layout.
    • SendAudioBuffer: Transmits encoded audio buffers to subscribed clients.

Data Flow and Processing in the Audio Transmitter Pipeline

  1. Buffer Submission: Audio buffers are submitted to AudioTransmitterPipeline via SubmitInput().
  2. Sequential Processing: Buffers pass through the Audio Converter for format matching, then proceed to the encoder for compression.
  3. Client Transmission:
    • Initialization: AudioTransmitterAdapter uses SendAudioInit to send stream configuration data to each client.
    • Buffer Delivery: Encoded audio buffers are delivered using SendAudioBuffer, ensuring synchronized delivery across clients.