diff options
Diffstat (limited to 'third_party/libwebrtc/webrtc/voice_engine/include')
-rw-r--r-- | third_party/libwebrtc/webrtc/voice_engine/include/voe_base.h | 169 | ||||
-rw-r--r-- | third_party/libwebrtc/webrtc/voice_engine/include/voe_errors.h | 165 |
2 files changed, 334 insertions, 0 deletions
diff --git a/third_party/libwebrtc/webrtc/voice_engine/include/voe_base.h b/third_party/libwebrtc/webrtc/voice_engine/include/voe_base.h new file mode 100644 index 0000000000..de25526db8 --- /dev/null +++ b/third_party/libwebrtc/webrtc/voice_engine/include/voe_base.h @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2012 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. + */ + +// This sub-API supports the following functionalities: +// +// - Enables full duplex VoIP sessions via RTP using G.711 (mu-Law or A-Law). +// - Initialization and termination. +// - Trace information on text files or via callbacks. +// - Multi-channel support (mixing, sending to multiple destinations etc.). +// +// To support other codecs than G.711, the VoECodec sub-API must be utilized. +// +// Usage example, omitting error checking: +// +// using namespace webrtc; +// VoiceEngine* voe = VoiceEngine::Create(); +// VoEBase* base = VoEBase::GetInterface(voe); +// base->Init(); +// int ch = base->CreateChannel(); +// base->StartPlayout(ch); +// ... +// base->DeleteChannel(ch); +// base->Terminate(); +// base->Release(); +// VoiceEngine::Delete(voe); +// +#ifndef VOICE_ENGINE_VOE_BASE_H_ +#define VOICE_ENGINE_VOE_BASE_H_ + +#include "api/audio_codecs/audio_decoder_factory.h" +#include "common_types.h" // NOLINT(build/include) +#include "modules/audio_coding/include/audio_coding_module.h" +#include "rtc_base/scoped_ref_ptr.h" + +namespace webrtc { + +class AudioDeviceModule; +class AudioProcessing; +class AudioTransport; +namespace voe { +class TransmitMixer; +} // namespace voe + +// VoiceEngine +class WEBRTC_DLLEXPORT VoiceEngine { + public: + // Creates a VoiceEngine object, which can then be used to acquire + // sub-APIs. Returns NULL on failure. + static VoiceEngine* Create(); + + // Deletes a created VoiceEngine object and releases the utilized resources. + // Note that if there are outstanding references held via other interfaces, + // the voice engine instance will not actually be deleted until those + // references have been released. + static bool Delete(VoiceEngine*& voiceEngine); + + protected: + VoiceEngine() {} + ~VoiceEngine() {} + + private: + // VS 2015 (others?) gets confused by a baseclass with no vtbl, and + // static_cast<VoiceEngineImpl*>(mVoiceEngine) produces a bad ptr. It + // might also be related to the total size of the object. + + // Add a virtual method to assuage the poor compiler. + virtual void DummyVS2015BugFix() {}; +}; + +// VoEBase +class WEBRTC_DLLEXPORT VoEBase { + public: + struct ChannelConfig { + AudioCodingModule::Config acm_config; + bool enable_voice_pacing = false; + }; + + // Factory for the VoEBase sub-API. Increases an internal reference + // counter if successful. Returns NULL if the API is not supported or if + // construction fails. + static VoEBase* GetInterface(VoiceEngine* voiceEngine); + + // Releases the VoEBase sub-API and decreases an internal reference + // counter. Returns the new reference count. This value should be zero + // for all sub-APIs before the VoiceEngine object can be safely deleted. + virtual int Release() = 0; + + // Initializes all common parts of the VoiceEngine; e.g. all + // encoders/decoders, the sound card and core receiving components. + // This method also makes it possible to install some user-defined external + // modules: + // - The Audio Device Module (ADM) which implements all the audio layer + // functionality in a separate (reference counted) module. + // - The AudioProcessing module handles capture-side processing. + // - An AudioDecoderFactory - used to create audio decoders. + virtual int Init( + AudioDeviceModule* audio_device, + AudioProcessing* audio_processing, + const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) = 0; + + // This method is WIP - DO NOT USE! + // Returns NULL before Init() is called. + virtual voe::TransmitMixer* transmit_mixer() = 0; + + // Terminates all VoiceEngine functions and releases allocated resources. + virtual void Terminate() = 0; + + // Creates a new channel and allocates the required resources for it. + // The second version accepts a |config| struct which includes an Audio Coding + // Module config and an option to enable voice pacing. Note that the + // decoder_factory member of the ACM config will be ignored (the decoder + // factory set through Init() will always be used). + // Returns channel ID or -1 in case of an error. + virtual int CreateChannel() = 0; + virtual int CreateChannel(const ChannelConfig& config) = 0; + + // Deletes an existing channel and releases the utilized resources. + // Returns -1 in case of an error, 0 otherwise. + virtual int DeleteChannel(int channel) = 0; + + // Starts forwarding the packets to the mixer/soundcard for a + // specified |channel|. + virtual int StartPlayout(int channel) = 0; + + // Stops forwarding the packets to the mixer/soundcard for a + // specified |channel|. + virtual int StopPlayout(int channel) = 0; + + // Starts sending packets to an already specified IP address and + // port number for a specified |channel|. + virtual int StartSend(int channel) = 0; + + // Stops sending packets from a specified |channel|. + virtual int StopSend(int channel) = 0; + + // Enable or disable playout to the underlying device. Takes precedence over + // StartPlayout. Though calls to StartPlayout are remembered; if + // SetPlayout(true) is called after StartPlayout, playout will be started. + // + // By default, playout is enabled. + virtual int SetPlayout(bool enabled) = 0; + + // Enable or disable recording (which drives sending of encoded audio packtes) + // from the underlying device. Takes precedence over StartSend. Though calls + // to StartSend are remembered; if SetRecording(true) is called after + // StartSend, recording will be started. + // + // By default, recording is enabled. + virtual int SetRecording(bool enabled) = 0; + + // TODO(xians): Make the interface pure virtual after libjingle + // implements the interface in its FakeWebRtcVoiceEngine. + virtual AudioTransport* audio_transport() { return NULL; } + + protected: + VoEBase() {} + virtual ~VoEBase() {} +}; + +} // namespace webrtc + +#endif // VOICE_ENGINE_VOE_BASE_H_ diff --git a/third_party/libwebrtc/webrtc/voice_engine/include/voe_errors.h b/third_party/libwebrtc/webrtc/voice_engine/include/voe_errors.h new file mode 100644 index 0000000000..7479ab3957 --- /dev/null +++ b/third_party/libwebrtc/webrtc/voice_engine/include/voe_errors.h @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2011 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 VOICE_ENGINE_VOE_ERRORS_H_ +#define VOICE_ENGINE_VOE_ERRORS_H_ + +// Warnings +#define VE_PORT_NOT_DEFINED 8001 +#define VE_CHANNEL_NOT_VALID 8002 +#define VE_FUNC_NOT_SUPPORTED 8003 +#define VE_INVALID_LISTNR 8004 +#define VE_INVALID_ARGUMENT 8005 +#define VE_INVALID_PORT_NMBR 8006 +#define VE_INVALID_PLNAME 8007 +#define VE_INVALID_PLFREQ 8008 +#define VE_INVALID_PLTYPE 8009 +#define VE_INVALID_PACSIZE 8010 +#define VE_NOT_SUPPORTED 8011 +#define VE_ALREADY_LISTENING 8012 +#define VE_CHANNEL_NOT_CREATED 8013 +#define VE_MAX_ACTIVE_CHANNELS_REACHED 8014 +#define VE_REC_CANNOT_PREPARE_HEADER 8015 +#define VE_REC_CANNOT_ADD_BUFFER 8016 +#define VE_PLAY_CANNOT_PREPARE_HEADER 8017 +#define VE_ALREADY_SENDING 8018 +#define VE_INVALID_IP_ADDRESS 8019 +#define VE_ALREADY_PLAYING 8020 +#define VE_NOT_ALL_VERSION_INFO 8021 +// 8022 is not used +#define VE_INVALID_CHANNELS 8023 +#define VE_SET_PLTYPE_FAILED 8024 +// 8025 is not used +#define VE_NOT_INITED 8026 +#define VE_NOT_SENDING 8027 +#define VE_EXT_TRANSPORT_NOT_SUPPORTED 8028 +#define VE_EXTERNAL_TRANSPORT_ENABLED 8029 +#define VE_STOP_RECORDING_FAILED 8030 +#define VE_INVALID_RATE 8031 +#define VE_INVALID_PACKET 8032 +#define VE_NO_GQOS 8033 +#define VE_INVALID_TIMESTAMP 8034 +#define VE_RECEIVE_PACKET_TIMEOUT 8035 +// 8036 is not used +#define VE_INIT_FAILED_WRONG_EXPIRY 8037 +#define VE_SENDING 8038 +#define VE_ENABLE_IPV6_FAILED 8039 +#define VE_FUNC_NO_STEREO 8040 +// Range 8041-8080 is not used +#define VE_FW_TRAVERSAL_ALREADY_INITIALIZED 8081 +#define VE_PACKET_RECEIPT_RESTARTED 8082 +#define VE_NOT_ALL_INFO 8083 +#define VE_CANNOT_SET_SEND_CODEC 8084 +#define VE_CODEC_ERROR 8085 +#define VE_NETEQ_ERROR 8086 +#define VE_RTCP_ERROR 8087 +#define VE_INVALID_OPERATION 8088 +#define VE_CPU_INFO_ERROR 8089 +#define VE_SOUNDCARD_ERROR 8090 +#define VE_SPEECH_LEVEL_ERROR 8091 +#define VE_SEND_ERROR 8092 +#define VE_CANNOT_REMOVE_CONF_CHANNEL 8093 +#define VE_PLTYPE_ERROR 8094 +#define VE_SET_RED_FAILED 8095 +#define VE_CANNOT_GET_PLAY_DATA 8096 +#define VE_APM_ERROR 8097 +#define VE_RUNTIME_PLAY_WARNING 8098 +#define VE_RUNTIME_REC_WARNING 8099 +#define VE_NOT_PLAYING 8100 +#define VE_SOCKETS_NOT_INITED 8101 +#define VE_CANNOT_GET_SOCKET_INFO 8102 +#define VE_INVALID_MULTICAST_ADDRESS 8103 +#define VE_DESTINATION_NOT_INITED 8104 +#define VE_RECEIVE_SOCKETS_CONFLICT 8105 +#define VE_SEND_SOCKETS_CONFLICT 8106 +// 8107 is not used +#define VE_NOISE_WARNING 8109 +#define VE_CANNOT_GET_SEND_CODEC 8110 +#define VE_CANNOT_GET_REC_CODEC 8111 +#define VE_ALREADY_INITED 8112 +#define VE_CANNOT_SET_SECONDARY_SEND_CODEC 8113 +#define VE_CANNOT_GET_SECONDARY_SEND_CODEC 8114 +#define VE_CANNOT_REMOVE_SECONDARY_SEND_CODEC 8115 +// 8116 is not used + +// Errors causing limited functionality +#define VE_RTCP_SOCKET_ERROR 9001 +#define VE_MIC_VOL_ERROR 9002 +#define VE_SPEAKER_VOL_ERROR 9003 +#define VE_CANNOT_ACCESS_MIC_VOL 9004 +#define VE_CANNOT_ACCESS_SPEAKER_VOL 9005 +#define VE_GET_MIC_VOL_ERROR 9006 +#define VE_GET_SPEAKER_VOL_ERROR 9007 +#define VE_THREAD_RTCP_ERROR 9008 +#define VE_CANNOT_INIT_APM 9009 +#define VE_SEND_SOCKET_TOS_ERROR 9010 +#define VE_CANNOT_RETRIEVE_DEVICE_NAME 9013 +#define VE_SRTP_ERROR 9014 +// 9015 is not used +#define VE_INTERFACE_NOT_FOUND 9016 +#define VE_TOS_GQOS_CONFLICT 9017 +#define VE_CANNOT_ADD_CONF_CHANNEL 9018 +#define VE_BUFFER_TOO_SMALL 9019 +#define VE_CANNOT_EXECUTE_SETTING 9020 +#define VE_CANNOT_RETRIEVE_SETTING 9021 +// 9022 is not used +#define VE_RTP_KEEPALIVE_FAILED 9023 +#define VE_SEND_DTMF_FAILED 9024 +#define VE_CANNOT_RETRIEVE_CNAME 9025 +// 9026 is not used +// 9027 is not used +#define VE_CANNOT_RETRIEVE_RTP_STAT 9028 +#define VE_GQOS_ERROR 9029 +#define VE_BINDING_SOCKET_TO_LOCAL_ADDRESS_FAILED 9030 +#define VE_TOS_INVALID 9031 +#define VE_TOS_ERROR 9032 +#define VE_CANNOT_RETRIEVE_VALUE 9033 + +// Critical errors that stops voice functionality +#define VE_PLAY_UNDEFINED_SC_ERR 10001 +#define VE_REC_CANNOT_OPEN_SC 10002 +#define VE_SOCKET_ERROR 10003 +#define VE_MMSYSERR_INVALHANDLE 10004 +#define VE_MMSYSERR_NODRIVER 10005 +#define VE_MMSYSERR_NOMEM 10006 +#define VE_WAVERR_UNPREPARED 10007 +#define VE_WAVERR_STILLPLAYING 10008 +#define VE_UNDEFINED_SC_ERR 10009 +#define VE_UNDEFINED_SC_REC_ERR 10010 +#define VE_THREAD_ERROR 10011 +#define VE_CANNOT_START_RECORDING 10012 +#define VE_PLAY_CANNOT_OPEN_SC 10013 +#define VE_NO_WINSOCK_2 10014 +#define VE_SEND_SOCKET_ERROR 10015 +#define VE_BAD_FILE 10016 +#define VE_EXPIRED_COPY 10017 +#define VE_NOT_AUTHORISED 10018 +#define VE_RUNTIME_PLAY_ERROR 10019 +#define VE_RUNTIME_REC_ERROR 10020 +#define VE_BAD_ARGUMENT 10021 +#define VE_LINUX_API_ONLY 10022 +#define VE_REC_DEVICE_REMOVED 10023 +#define VE_NO_MEMORY 10024 +#define VE_BAD_HANDLE 10025 +#define VE_RTP_RTCP_MODULE_ERROR 10026 +#define VE_AUDIO_CODING_MODULE_ERROR 10027 +#define VE_AUDIO_DEVICE_MODULE_ERROR 10028 +#define VE_CANNOT_START_PLAYOUT 10029 +#define VE_CANNOT_STOP_RECORDING 10030 +#define VE_CANNOT_STOP_PLAYOUT 10031 +#define VE_CANNOT_INIT_CHANNEL 10032 +#define VE_RECV_SOCKET_ERROR 10033 +#define VE_SOCKET_TRANSPORT_MODULE_ERROR 10034 +#define VE_AUDIO_CONF_MIX_MODULE_ERROR 10035 + +// Warnings for other platforms (reserved range 8061-8080) +#define VE_IGNORED_FUNCTION 8061 + +#endif // VOICE_ENGINE_VOE_ERRORS_H_ |