1 #ifndef OPENTERA_WEBRTC_NATIVE_CLIENT_SOURCES_AUDIO_SOURCE_H
2 #define OPENTERA_WEBRTC_NATIVE_CLIENT_SOURCES_AUDIO_SOURCE_H
4 #include <OpenteraWebrtcNativeClient/Configurations/AudioSourceConfiguration.h>
5 #include <OpenteraWebrtcNativeClient/OpenteraAudioDeviceModule.h>
6 #include <OpenteraWebrtcNativeClient/Utils/ClassMacro.h>
8 #include <api/media_stream_interface.h>
9 #include <api/notifier.h>
24 class AudioSource :
public webrtc::Notifier<webrtc::AudioSourceInterface>
29 size_t m_numberOfChannels;
30 size_t m_bytesPerFrame;
33 std::vector<uint8_t> m_data;
34 size_t m_dataNumberOfFrames;
36 std::mutex m_audioDeviceModuleMutex;
37 rtc::scoped_refptr<OpenteraAudioDeviceModule> m_audioDeviceModule;
45 void AddSink(webrtc::AudioTrackSinkInterface* sink)
override;
46 void RemoveSink(webrtc::AudioTrackSinkInterface* sink)
override;
48 bool remote()
const override;
49 SourceState
state()
const override;
50 const cricket::AudioOptions
options()
const override;
56 void setAudioDeviceModule(
const rtc::scoped_refptr<OpenteraAudioDeviceModule>& audioDeviceModule);
57 void sendFrame(
const void* audioData,
size_t numberOfFrames);
58 void sendFrame(
const void* audioData,
size_t numberOfFrames,
bool isTyping);
62 void AddRef()
const override;
63 rtc::RefCountReleaseStatus Release()
const override;
78 sendFrame(audioData, numberOfFrames,
false);
Represents a configuration of an audio source that can be added to a WebRTC call.
Definition: AudioSourceConfiguration.h:13
Represents an audio source that can be added to a WebRTC call.
Definition: AudioSource.h:25
void sendFrame(const void *audioData, size_t numberOfFrames)
Definition: AudioSource.h:76
AudioSourceConfiguration configuration() const
Definition: AudioSource.h:69
AudioSource(AudioSourceConfiguration configuration, int bitsPerSample, int sampleRate, size_t numberOfChannels)
Creates an AudioSource.
Definition: AudioSource.cpp:39
const cricket::AudioOptions options() const override
Definition: AudioSource.cpp:86
size_t bytesPerFrame() const
Definition: AudioSource.cpp:102
size_t bytesPerSample() const
Definition: AudioSource.cpp:94
SourceState state() const override
Indicates if this source is live.
Definition: AudioSource.cpp:78
void AddSink(webrtc::AudioTrackSinkInterface *sink) override
Definition: AudioSource.cpp:58
bool remote() const override
Indicates if this source is remote.
Definition: AudioSource.cpp:69
void setAudioDeviceModule(const rtc::scoped_refptr< OpenteraAudioDeviceModule > &audioDeviceModule)
Definition: AudioSource.cpp:111
void RemoveSink(webrtc::AudioTrackSinkInterface *sink) override
Definition: AudioSource.cpp:63