MixedReality-WebRTC MixedReality-WebRTC
Search Results for

    Show / Hide Table of Contents

    Class AudioTrackReadBuffer

    High level interface for consuming WebRTC audio tracks. Enqueues audio frames for a RemoteAudioTrack in an internal buffer as they arrive. Users should call Read(Int32, Int32, Single[], out Int32, out Boolean, AudioTrackReadBuffer.PadBehavior) to read samples from the buffer when needed.

    Inheritance
    Object
    AudioTrackReadBuffer
    Namespace: Microsoft.MixedReality.WebRTC
    Assembly: Microsoft.MixedReality.WebRTC.dll
    Syntax
    public class AudioTrackReadBuffer : IDisposable

    Methods

    | Improve this Doc View Source

    Dispose()

    Release the buffer.

    Declaration
    public void Dispose()
    | Improve this Doc View Source

    Read(Int32, Int32, Single[], AudioTrackReadBuffer.PadBehavior)

    Fill samplesOut with samples from the internal buffer. See Read(Int32, Int32, Single[], out Int32, out Boolean, AudioTrackReadBuffer.PadBehavior).

    Declaration
    public void Read(int sampleRate, int channels, float[] samplesOut, AudioTrackReadBuffer.PadBehavior padBehavior = default(AudioTrackReadBuffer.PadBehavior))
    Parameters
    Type Name Description
    Int32 sampleRate
    Int32 channels
    Single[] samplesOut
    AudioTrackReadBuffer.PadBehavior padBehavior
    | Improve this Doc View Source

    Read(Int32, Int32, Single[], out Int32, out Boolean, AudioTrackReadBuffer.PadBehavior)

    Fill samplesOut with samples from the internal buffer.

    Declaration
    public void Read(int sampleRate, int numChannels, float[] samplesOut, out int numSamplesRead, out bool hasOverrun, AudioTrackReadBuffer.PadBehavior padBehavior = default(AudioTrackReadBuffer.PadBehavior))
    Parameters
    Type Name Description
    Int32 sampleRate

    Desired sample rate. Data in the buffer is resampled if this is different from the native track rate.

    Int32 numChannels

    Desired number of channels. Should be 1 or 2. Data in the buffer is split/averaged if this is different from the native track channels number.

    Single[] samplesOut

    Will be filled with the samples read from the internal buffer. The function will try to fill the entire length of the array.

    Int32 numSamplesRead

    Set to the effective number of samples read. This will be generally equal to the length of samplesOut, but can be less in case of underrun.

    Boolean hasOverrun

    Set to true if frames have been dropped from the internal buffer between the previous call to Read and this.

    AudioTrackReadBuffer.PadBehavior padBehavior

    Controls how samplesOut is padded in case of underrun.

    Remarks

    This method reads the internal buffer starting from the oldest data. If the internal buffer is exhausted (underrun), samplesOut is padded according to the value of padBehavior.

    This method should be called regularly to consume the audio data as it is received. Note that the internal buffer can overrun (and some frames can be dropped) if this is not called frequently enough.

    See Also

    CreateReadBuffer()
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX