webrtc/modules/audio_mixer/g3doc/index.md
Artem Titov a617867a45 Reland "Migrate WebRTC documentation to new renderer"
This reverts commit 0f2ce5cc1c.

Reason for revert: Downstream infrastructure should be ready now

Original change's description:
> Revert "Migrate WebRTC documentation to new renderer"
>
> This reverts commit 3eceaf4669.
>
> Reason for revert:
>
> Original change's description:
> > Migrate WebRTC documentation to new renderer
> >
> > Bug: b/258408932
> > Change-Id: Ib96f39fe0c3912f9746bcc09d079097a145d6115
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/290987
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Commit-Queue: Artem Titov <titovartem@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#39205}
>
> Bug: b/258408932
> Change-Id: I16cb4088bee3fc15c2bb88bd692c592b3a7db9fe
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291560
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Owners-Override: Artem Titov <titovartem@webrtc.org>
> Commit-Queue: Artem Titov <titovartem@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#39209}

Bug: b/258408932
Change-Id: Ia172e4a6ad1cc7953b48eed08776e9d1e44eb074
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291660
Owners-Override: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39231}
2023-01-31 09:30:04 +00:00

3.4 KiB

The WebRTC Audio Mixer Module

The WebRTC audio mixer module is responsible for mixing multiple incoming audio streams (sources) into a single audio stream (mix). It works with 10 ms frames, it supports sample rates up to 48 kHz and up to 8 audio channels. The API is defined in api/audio/audio_mixer.h and it includes the definition of AudioMixer::Source, which describes an incoming audio stream, and the definition of AudioMixer, which operates on a collection of AudioMixer::Source objects to produce a mix.

AudioMixer::Source

A source has different characteristic (e.g., sample rate, number of channels, muted state) and it is identified by an SSRC1. AudioMixer::Source::GetAudioFrameWithInfo() is used to retrieve the next 10 ms chunk of audio to be mixed.

AudioMixer

The interface allows to add and remove sources and the AudioMixer::Mix() method allows to generates a mix with the desired number of channels.

WebRTC implementation

The interface is implemented in different parts of WebRTC:

AudioMixer is thread-safe. The output sample rate of the generated mix is automatically assigned depending on the sample rate of the sources; whereas the number of output channels is defined by the caller2. Samples from the non-muted sources are summed up and then a limiter is used to apply soft-clipping when needed.


  1. A synchronization source (SSRC) is the source of a stream of RTP packets, identified by a 32-bit numeric SSRC identifier carried in the RTP header so as not to be dependent upon the network address (see RFC 3550). ↩︎

  2. audio/utility/channel_mixer.h is used to mix channels in the non-trivial cases - i.e., if the number of channels for a source or the mix is greater than 3. ↩︎