OpenTera WebRTC API (C++) 1.2.5
Public Member Functions | List of all members
opentera::AudioSource Class Reference

Represents an audio source that can be added to a WebRTC call. More...

#include <AudioSource.h>

Inheritance diagram for opentera::AudioSource:

Public Member Functions

 AudioSource (AudioSourceConfiguration configuration, int bitsPerSample, int sampleRate, size_t numberOfChannels)
 Creates an AudioSource. More...
 
 DECLARE_NOT_COPYABLE (AudioSource)
 
 DECLARE_NOT_MOVABLE (AudioSource)
 
void AddSink (webrtc::AudioTrackSinkInterface *sink) override
 
void RemoveSink (webrtc::AudioTrackSinkInterface *sink) override
 
bool remote () const override
 Indicates if this source is remote. More...
 
SourceState state () const override
 Indicates if this source is live. More...
 
const cricket::AudioOptions options () const override
 
AudioSourceConfiguration configuration () const
 
size_t bytesPerSample () const
 
size_t bytesPerFrame () const
 
void setAudioDeviceModule (const rtc::scoped_refptr< OpenteraAudioDeviceModule > &audioDeviceModule)
 
void sendFrame (const void *audioData, size_t numberOfFrames)
 
void sendFrame (const void *audioData, size_t numberOfFrames, bool isTyping)
 
void AddRef () const override
 
rtc::RefCountReleaseStatus Release () const override
 

Detailed Description

Represents an audio source that can be added to a WebRTC call.

Pass a shared_ptr to an instance of this to the StreamClient and call sendFrame for each of your audio frame.

Constructor & Destructor Documentation

◆ AudioSource()

AudioSource::AudioSource ( AudioSourceConfiguration  configuration,
int  bitsPerSample,
int  sampleRate,
size_t  numberOfChannels 
)

Creates an AudioSource.

Parameters
configurationthe configuration applied to the audio stream by the audio transport layer
bitsPerSampleThe audio stream sample size (8, 16 or 32 bits)
sampleRateThe audio stream sample rate
numberOfChannelsThe audio stream channel count

Member Function Documentation

◆ AddSink()

void AudioSource::AddSink ( webrtc::AudioTrackSinkInterface *  sink)
override

Do nothing.

◆ bytesPerFrame()

size_t AudioSource::bytesPerFrame ( ) const
Returns
The frame size

◆ bytesPerSample()

size_t AudioSource::bytesPerSample ( ) const
Returns
The sample size

◆ configuration()

AudioSourceConfiguration opentera::AudioSource::configuration ( ) const
inline
Returns
The audio source configuration

◆ options()

const cricket::AudioOptions AudioSource::options ( ) const
override
Returns
The audio source options

◆ remote()

bool AudioSource::remote ( ) const
override

Indicates if this source is remote.

Returns
Always false, the source is local

◆ RemoveSink()

void AudioSource::RemoveSink ( webrtc::AudioTrackSinkInterface *  sink)
override

Do nothing.

◆ sendFrame() [1/2]

void opentera::AudioSource::sendFrame ( const void *  audioData,
size_t  numberOfFrames 
)
inline

Send an audio frame

Parameters
audioDataThe audio data
numberOfFramesThe number of frames

◆ sendFrame() [2/2]

void AudioSource::sendFrame ( const void *  audioData,
size_t  numberOfFrames,
bool  isTyping 
)

Send an audio frame

Parameters
audioDataThe audio data
numberOfFramesThe number of frames
isTypingIndicates if the frame contains typing sound. This is only useful with the typing detection option.

◆ setAudioDeviceModule()

void AudioSource::setAudioDeviceModule ( const rtc::scoped_refptr< OpenteraAudioDeviceModule > &  audioDeviceModule)

Internal use only.

Parameters
audioDeviceModule

◆ state()

webrtc::MediaSourceInterface::SourceState AudioSource::state ( ) const
override

Indicates if this source is live.

Returns
Always kLive, the source is live

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