ObjC ADM: target and dummy implementation [1/N]

Bug: webrtc:14193
Change-Id: Ic89af1a489ba6b4c011851f09297ed22cecde008
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266720
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Peter Hanspers <peterhanspers@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37921}
This commit is contained in:
Yury Yaroshevich
2022-08-24 17:46:08 +02:00
committed by WebRTC LUCI CQ
parent 5cc22253f4
commit e21a3cbf2f
3 changed files with 455 additions and 0 deletions

View File

@ -392,6 +392,20 @@ if (is_ios || is_mac) {
}
}
rtc_library("audio_device_objc") {
visibility = [ "*" ]
sources = [
"objc/native/src/objc_audio_device.h",
"objc/native/src/objc_audio_device.mm",
]
deps = [
"../modules/audio_device:audio_device_api",
"../rtc_base:logging",
]
}
rtc_library("videosource_objc") {
sources = [
"objc/api/peerconnection/RTCVideoSource+Private.h",

View File

@ -0,0 +1,132 @@
/*
* Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef SDK_OBJC_NATIVE_SRC_OBJC_AUDIO_DEVICE_H_
#define SDK_OBJC_NATIVE_SRC_OBJC_AUDIO_DEVICE_H_
#include "modules/audio_device/include/audio_device.h"
namespace webrtc {
namespace objc_adm {
class ObjCAudioDeviceModule : public AudioDeviceModule {
public:
ObjCAudioDeviceModule();
~ObjCAudioDeviceModule() override;
// Retrieve the currently utilized audio layer
int32_t ActiveAudioLayer(AudioLayer* audioLayer) const override;
// Full-duplex transportation of PCM audio
int32_t RegisterAudioCallback(AudioTransport* audioCallback) override;
// Main initialization and termination
int32_t Init() override;
int32_t Terminate() override;
bool Initialized() const override;
// Device enumeration
int16_t PlayoutDevices() override;
int16_t RecordingDevices() override;
int32_t PlayoutDeviceName(uint16_t index,
char name[kAdmMaxDeviceNameSize],
char guid[kAdmMaxGuidSize]) override;
int32_t RecordingDeviceName(uint16_t index,
char name[kAdmMaxDeviceNameSize],
char guid[kAdmMaxGuidSize]) override;
// Device selection
int32_t SetPlayoutDevice(uint16_t index) override;
int32_t SetPlayoutDevice(WindowsDeviceType device) override;
int32_t SetRecordingDevice(uint16_t index) override;
int32_t SetRecordingDevice(WindowsDeviceType device) override;
// Audio transport initialization
int32_t PlayoutIsAvailable(bool* available) override;
int32_t InitPlayout() override;
bool PlayoutIsInitialized() const override;
int32_t RecordingIsAvailable(bool* available) override;
int32_t InitRecording() override;
bool RecordingIsInitialized() const override;
// Audio transport control
int32_t StartPlayout() override;
int32_t StopPlayout() override;
bool Playing() const override;
int32_t StartRecording() override;
int32_t StopRecording() override;
bool Recording() const override;
// Audio mixer initialization
int32_t InitSpeaker() override;
bool SpeakerIsInitialized() const override;
int32_t InitMicrophone() override;
bool MicrophoneIsInitialized() const override;
// Speaker volume controls
int32_t SpeakerVolumeIsAvailable(bool* available) override;
int32_t SetSpeakerVolume(uint32_t volume) override;
int32_t SpeakerVolume(uint32_t* volume) const override;
int32_t MaxSpeakerVolume(uint32_t* maxVolume) const override;
int32_t MinSpeakerVolume(uint32_t* minVolume) const override;
// Microphone volume controls
int32_t MicrophoneVolumeIsAvailable(bool* available) override;
int32_t SetMicrophoneVolume(uint32_t volume) override;
int32_t MicrophoneVolume(uint32_t* volume) const override;
int32_t MaxMicrophoneVolume(uint32_t* maxVolume) const override;
int32_t MinMicrophoneVolume(uint32_t* minVolume) const override;
// Speaker mute control
int32_t SpeakerMuteIsAvailable(bool* available) override;
int32_t SetSpeakerMute(bool enable) override;
int32_t SpeakerMute(bool* enabled) const override;
// Microphone mute control
int32_t MicrophoneMuteIsAvailable(bool* available) override;
int32_t SetMicrophoneMute(bool enable) override;
int32_t MicrophoneMute(bool* enabled) const override;
// Stereo support
int32_t StereoPlayoutIsAvailable(bool* available) const override;
int32_t SetStereoPlayout(bool enable) override;
int32_t StereoPlayout(bool* enabled) const override;
int32_t StereoRecordingIsAvailable(bool* available) const override;
int32_t SetStereoRecording(bool enable) override;
int32_t StereoRecording(bool* enabled) const override;
// Playout delay
int32_t PlayoutDelay(uint16_t* delayMS) const override;
// Only supported on Android.
bool BuiltInAECIsAvailable() const override;
bool BuiltInAGCIsAvailable() const override;
bool BuiltInNSIsAvailable() const override;
// Enables the built-in audio effects. Only supported on Android.
int32_t EnableBuiltInAEC(bool enable) override;
int32_t EnableBuiltInAGC(bool enable) override;
int32_t EnableBuiltInNS(bool enable) override;
// Play underrun count. Only supported on Android.
int32_t GetPlayoutUnderrunCount() const override;
#if defined(WEBRTC_IOS)
int GetPlayoutAudioParameters(AudioParameters* params) const override;
int GetRecordAudioParameters(AudioParameters* params) const override;
#endif // WEBRTC_IOS
};
} // namespace objc_adm
} // namespace webrtc
#endif // SDK_OBJC_NATIVE_SRC_OBJC_AUDIO_DEVICE_H_

View File

@ -0,0 +1,309 @@
/*
* Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "objc_audio_device.h"
#include "rtc_base/logging.h"
namespace webrtc {
namespace objc_adm {
ObjCAudioDeviceModule::ObjCAudioDeviceModule() {
RTC_DLOG_F(LS_VERBOSE) << "";
}
ObjCAudioDeviceModule::~ObjCAudioDeviceModule() {
RTC_DLOG_F(LS_VERBOSE) << "";
}
int32_t ObjCAudioDeviceModule::RegisterAudioCallback(AudioTransport* audioCallback) {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return -1;
}
int32_t ObjCAudioDeviceModule::Init() {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return -1;
}
int32_t ObjCAudioDeviceModule::Terminate() {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return -1;
}
bool ObjCAudioDeviceModule::Initialized() const {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return false;
}
int32_t ObjCAudioDeviceModule::PlayoutIsAvailable(bool* available) {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return -1;
}
bool ObjCAudioDeviceModule::PlayoutIsInitialized() const {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return false;
}
int32_t ObjCAudioDeviceModule::InitPlayout() {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return -1;
}
bool ObjCAudioDeviceModule::Playing() const {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return false;
}
int32_t ObjCAudioDeviceModule::StartPlayout() {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return -1;
}
int32_t ObjCAudioDeviceModule::StopPlayout() {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return -1;
}
int32_t ObjCAudioDeviceModule::PlayoutDelay(uint16_t* delayMS) const {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return -1;
}
int32_t ObjCAudioDeviceModule::RecordingIsAvailable(bool* available) {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return -1;
}
bool ObjCAudioDeviceModule::RecordingIsInitialized() const {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return false;
}
int32_t ObjCAudioDeviceModule::InitRecording() {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return -1;
}
bool ObjCAudioDeviceModule::Recording() const {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return false;
}
int32_t ObjCAudioDeviceModule::StartRecording() {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return -1;
}
int32_t ObjCAudioDeviceModule::StopRecording() {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return -1;
}
#if defined(WEBRTC_IOS)
int ObjCAudioDeviceModule::GetPlayoutAudioParameters(AudioParameters* params) const {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return -1;
}
int ObjCAudioDeviceModule::GetRecordAudioParameters(AudioParameters* params) const {
RTC_DLOG_F(LS_VERBOSE) << "Not yet implemented";
return -1;
}
#endif // WEBRTC_IOS
#pragma mark - Not implemented/Not relevant
int32_t ObjCAudioDeviceModule::ActiveAudioLayer(AudioLayer* audioLayer) const {
return -1;
}
int16_t ObjCAudioDeviceModule::PlayoutDevices() {
return 0;
}
int16_t ObjCAudioDeviceModule::RecordingDevices() {
return 0;
}
int32_t ObjCAudioDeviceModule::PlayoutDeviceName(uint16_t index,
char name[kAdmMaxDeviceNameSize],
char guid[kAdmMaxGuidSize]) {
return -1;
}
int32_t ObjCAudioDeviceModule::RecordingDeviceName(uint16_t index,
char name[kAdmMaxDeviceNameSize],
char guid[kAdmMaxGuidSize]) {
return -1;
}
int32_t ObjCAudioDeviceModule::SetPlayoutDevice(uint16_t index) {
return 0;
}
int32_t ObjCAudioDeviceModule::SetPlayoutDevice(WindowsDeviceType device) {
return -1;
}
int32_t ObjCAudioDeviceModule::SetRecordingDevice(uint16_t index) {
return 0;
}
int32_t ObjCAudioDeviceModule::SetRecordingDevice(WindowsDeviceType device) {
return -1;
}
int32_t ObjCAudioDeviceModule::InitSpeaker() {
return 0;
}
bool ObjCAudioDeviceModule::SpeakerIsInitialized() const {
return true;
}
int32_t ObjCAudioDeviceModule::InitMicrophone() {
return 0;
}
bool ObjCAudioDeviceModule::MicrophoneIsInitialized() const {
return true;
}
int32_t ObjCAudioDeviceModule::SpeakerVolumeIsAvailable(bool* available) {
*available = false;
return 0;
}
int32_t ObjCAudioDeviceModule::SetSpeakerVolume(uint32_t volume) {
return -1;
}
int32_t ObjCAudioDeviceModule::SpeakerVolume(uint32_t* volume) const {
return -1;
}
int32_t ObjCAudioDeviceModule::MaxSpeakerVolume(uint32_t* maxVolume) const {
return -1;
}
int32_t ObjCAudioDeviceModule::MinSpeakerVolume(uint32_t* minVolume) const {
return -1;
}
int32_t ObjCAudioDeviceModule::SpeakerMuteIsAvailable(bool* available) {
*available = false;
return 0;
}
int32_t ObjCAudioDeviceModule::SetSpeakerMute(bool enable) {
return -1;
}
int32_t ObjCAudioDeviceModule::SpeakerMute(bool* enabled) const {
return -1;
}
int32_t ObjCAudioDeviceModule::MicrophoneMuteIsAvailable(bool* available) {
*available = false;
return 0;
}
int32_t ObjCAudioDeviceModule::SetMicrophoneMute(bool enable) {
return -1;
}
int32_t ObjCAudioDeviceModule::MicrophoneMute(bool* enabled) const {
return -1;
}
int32_t ObjCAudioDeviceModule::MicrophoneVolumeIsAvailable(bool* available) {
*available = false;
return 0;
}
int32_t ObjCAudioDeviceModule::SetMicrophoneVolume(uint32_t volume) {
return -1;
}
int32_t ObjCAudioDeviceModule::MicrophoneVolume(uint32_t* volume) const {
return -1;
}
int32_t ObjCAudioDeviceModule::MaxMicrophoneVolume(uint32_t* maxVolume) const {
return -1;
}
int32_t ObjCAudioDeviceModule::MinMicrophoneVolume(uint32_t* minVolume) const {
return -1;
}
int32_t ObjCAudioDeviceModule::StereoPlayoutIsAvailable(bool* available) const {
*available = false;
return 0;
}
int32_t ObjCAudioDeviceModule::SetStereoPlayout(bool enable) {
return -1;
}
int32_t ObjCAudioDeviceModule::StereoPlayout(bool* enabled) const {
*enabled = false;
return 0;
}
int32_t ObjCAudioDeviceModule::StereoRecordingIsAvailable(bool* available) const {
*available = false;
return 0;
}
int32_t ObjCAudioDeviceModule::SetStereoRecording(bool enable) {
return -1;
}
int32_t ObjCAudioDeviceModule::StereoRecording(bool* enabled) const {
*enabled = false;
return 0;
}
bool ObjCAudioDeviceModule::BuiltInAECIsAvailable() const {
return false;
}
int32_t ObjCAudioDeviceModule::EnableBuiltInAEC(bool enable) {
return 0;
}
bool ObjCAudioDeviceModule::BuiltInAGCIsAvailable() const {
return false;
}
int32_t ObjCAudioDeviceModule::EnableBuiltInAGC(bool enable) {
return 0;
}
bool ObjCAudioDeviceModule::BuiltInNSIsAvailable() const {
return false;
}
int32_t ObjCAudioDeviceModule::EnableBuiltInNS(bool enable) {
return 0;
}
int32_t ObjCAudioDeviceModule::GetPlayoutUnderrunCount() const {
return -1;
}
} // namespace objc_adm
} // namespace webrtc