1 #ifndef OPENTERA_WEBRTC_NATIVE_CLIENT_BLACK_HOLE_AUDIO_CAPTURE_MODULE_H
2 #define OPENTERA_WEBRTC_NATIVE_CLIENT_BLACK_HOLE_AUDIO_CAPTURE_MODULE_H
4 #include <OpenteraWebrtcNativeClient/Utils/ClassMacro.h>
5 #include <OpenteraWebrtcNativeClient/Sinks/AudioSink.h>
7 #include <modules/audio_device/include/audio_device.h>
21 AudioSinkCallback m_onMixedAudioFrameReceived;
23 bool m_isPlayoutInitialized;
24 bool m_isRecordingInitialized;
25 bool m_isSpeakerInitialized;
26 bool m_isMicrophoneInitialized;
31 std::atomic_bool m_playoutThreadStopped;
32 std::unique_ptr<std::thread> m_thread;
33 webrtc::AudioTransport* m_audioTransport;
34 std::mutex m_audioTransportCaptureMutex;
36 std::mutex m_setCallbackMutex;
45 void setOnMixedAudioFrameReceived(
const AudioSinkCallback& onMixedAudioFrameReceived);
47 const void* audioData,
50 size_t numberOfChannels,
51 size_t numberOfFrames,
52 uint32_t audioDelayMs,
56 int32_t ActiveAudioLayer(AudioLayer* audioLayer)
const override;
59 int32_t RegisterAudioCallback(webrtc::AudioTransport* audioTransport)
override;
62 int32_t Init()
override;
63 int32_t Terminate()
override;
64 [[nodiscard]]
bool Initialized()
const override;
67 int16_t PlayoutDevices()
override;
68 int16_t RecordingDevices()
override;
69 int32_t PlayoutDeviceName(
71 char name[webrtc::kAdmMaxDeviceNameSize],
72 char guid[webrtc::kAdmMaxGuidSize])
override;
73 int32_t RecordingDeviceName(
75 char name[webrtc::kAdmMaxDeviceNameSize],
76 char guid[webrtc::kAdmMaxGuidSize])
override;
79 int32_t SetPlayoutDevice(uint16_t index)
override;
80 int32_t SetPlayoutDevice(WindowsDeviceType device)
override;
81 int32_t SetRecordingDevice(uint16_t index)
override;
82 int32_t SetRecordingDevice(WindowsDeviceType device)
override;
85 int32_t PlayoutIsAvailable(
bool* available)
override;
86 int32_t InitPlayout()
override;
87 [[nodiscard]]
bool PlayoutIsInitialized()
const override;
88 int32_t RecordingIsAvailable(
bool* available)
override;
89 int32_t InitRecording()
override;
90 [[nodiscard]]
bool RecordingIsInitialized()
const override;
93 int32_t StartPlayout()
override;
94 int32_t StopPlayout()
override;
95 [[nodiscard]]
bool Playing()
const override;
96 int32_t StartRecording()
override;
97 int32_t StopRecording()
override;
98 [[nodiscard]]
bool Recording()
const override;
101 int32_t InitSpeaker()
override;
102 [[nodiscard]]
bool SpeakerIsInitialized()
const override;
103 int32_t InitMicrophone()
override;
104 [[nodiscard]]
bool MicrophoneIsInitialized()
const override;
107 int32_t SpeakerVolumeIsAvailable(
bool* available)
override;
108 int32_t SetSpeakerVolume(uint32_t volume)
override;
109 int32_t SpeakerVolume(uint32_t* volume)
const override;
110 int32_t MaxSpeakerVolume(uint32_t* maxVolume)
const override;
111 int32_t MinSpeakerVolume(uint32_t* minVolume)
const override;
114 int32_t MicrophoneVolumeIsAvailable(
bool* available)
override;
115 int32_t SetMicrophoneVolume(uint32_t volume)
override;
116 int32_t MicrophoneVolume(uint32_t* volume)
const override;
117 int32_t MaxMicrophoneVolume(uint32_t* maxVolume)
const override;
118 int32_t MinMicrophoneVolume(uint32_t* minVolume)
const override;
121 int32_t SpeakerMuteIsAvailable(
bool* available)
override;
122 int32_t SetSpeakerMute(
bool enable)
override;
123 int32_t SpeakerMute(
bool* enabled)
const override;
126 int32_t MicrophoneMuteIsAvailable(
bool* available)
override;
127 int32_t SetMicrophoneMute(
bool enable)
override;
128 int32_t MicrophoneMute(
bool* enabled)
const override;
131 int32_t StereoPlayoutIsAvailable(
bool* available)
const override;
132 int32_t SetStereoPlayout(
bool enable)
override;
133 int32_t StereoPlayout(
bool* enabled)
const override;
134 int32_t StereoRecordingIsAvailable(
bool* available)
const override;
135 int32_t SetStereoRecording(
bool enable)
override;
136 int32_t StereoRecording(
bool* enabled)
const override;
139 int32_t PlayoutDelay(uint16_t* delayMS)
const override;
142 [[nodiscard]]
bool BuiltInAECIsAvailable()
const override;
143 [[nodiscard]]
bool BuiltInAGCIsAvailable()
const override;
144 [[nodiscard]]
bool BuiltInNSIsAvailable()
const override;
147 int32_t EnableBuiltInAEC(
bool enable)
override;
148 int32_t EnableBuiltInAGC(
bool enable)
override;
149 int32_t EnableBuiltInNS(
bool enable)
override;
152 void stopPlayoutThreadIfStarted();
153 void startPlayoutThreadIfStoppedAndTransportValid();
This class is used to fake a AudioDeviceModule so we can use a custom AudioSource.
Definition: OpenteraAudioDeviceModule.h:20