[Modify]优质陪伴页面修改
This commit is contained in:
@@ -73,9 +73,6 @@ dependencies {
|
||||
|
||||
api fileTree(dir: 'share-sdk-libs', include: ['*.jar'])
|
||||
|
||||
// 声网
|
||||
api 'io.agora.rtc:full-sdk:3.6.2'
|
||||
|
||||
// core
|
||||
implementation 'com.liulishuo.okdownload:okdownload:1.0.4'
|
||||
// provide sqlite to store breakpoints
|
||||
|
BIN
core/libs/agora-rtc-sdk.jar
Normal file
BIN
core/libs/agora-rtc-sdk.jar
Normal file
Binary file not shown.
BIN
core/libs/arm64-v8a/libagora-core.so
Normal file
BIN
core/libs/arm64-v8a/libagora-core.so
Normal file
Binary file not shown.
BIN
core/libs/arm64-v8a/libagora-rtc-sdk.so
Normal file
BIN
core/libs/arm64-v8a/libagora-rtc-sdk.so
Normal file
Binary file not shown.
BIN
core/libs/arm64-v8a/libagora-soundtouch.so
Normal file
BIN
core/libs/arm64-v8a/libagora-soundtouch.so
Normal file
Binary file not shown.
BIN
core/libs/arm64-v8a/libagora_ai_denoise_extension.so
Normal file
BIN
core/libs/arm64-v8a/libagora_ai_denoise_extension.so
Normal file
Binary file not shown.
BIN
core/libs/arm64-v8a/libagora_fdkaac.so
Normal file
BIN
core/libs/arm64-v8a/libagora_fdkaac.so
Normal file
Binary file not shown.
BIN
core/libs/arm64-v8a/libagora_full_audio_format_extension.so
Normal file
BIN
core/libs/arm64-v8a/libagora_full_audio_format_extension.so
Normal file
Binary file not shown.
BIN
core/libs/arm64-v8a/libagora_mpg123.so
Normal file
BIN
core/libs/arm64-v8a/libagora_mpg123.so
Normal file
Binary file not shown.
BIN
core/libs/arm64-v8a/libagora_spatial_audio_extension.so
Normal file
BIN
core/libs/arm64-v8a/libagora_spatial_audio_extension.so
Normal file
Binary file not shown.
BIN
core/libs/armeabi-v7a/libagora-core.so
Normal file
BIN
core/libs/armeabi-v7a/libagora-core.so
Normal file
Binary file not shown.
BIN
core/libs/armeabi-v7a/libagora-rtc-sdk.so
Normal file
BIN
core/libs/armeabi-v7a/libagora-rtc-sdk.so
Normal file
Binary file not shown.
BIN
core/libs/armeabi-v7a/libagora-soundtouch.so
Normal file
BIN
core/libs/armeabi-v7a/libagora-soundtouch.so
Normal file
Binary file not shown.
BIN
core/libs/armeabi-v7a/libagora_ai_denoise_extension.so
Normal file
BIN
core/libs/armeabi-v7a/libagora_ai_denoise_extension.so
Normal file
Binary file not shown.
BIN
core/libs/armeabi-v7a/libagora_fdkaac.so
Normal file
BIN
core/libs/armeabi-v7a/libagora_fdkaac.so
Normal file
Binary file not shown.
BIN
core/libs/armeabi-v7a/libagora_full_audio_format_extension.so
Normal file
BIN
core/libs/armeabi-v7a/libagora_full_audio_format_extension.so
Normal file
Binary file not shown.
BIN
core/libs/armeabi-v7a/libagora_mpg123.so
Normal file
BIN
core/libs/armeabi-v7a/libagora_mpg123.so
Normal file
Binary file not shown.
BIN
core/libs/armeabi-v7a/libagora_spatial_audio_extension.so
Normal file
BIN
core/libs/armeabi-v7a/libagora_spatial_audio_extension.so
Normal file
Binary file not shown.
796
core/libs/include/AgoraBase.h
Normal file
796
core/libs/include/AgoraBase.h
Normal file
@@ -0,0 +1,796 @@
|
||||
// Agora Engine SDK
|
||||
//
|
||||
// Copyright (c) 2019 Agora.io. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef AGORA_BASE_H
|
||||
#define AGORA_BASE_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#define AGORA_CALL __cdecl
|
||||
#if defined(AGORARTC_EXPORT)
|
||||
#define AGORA_API extern "C" __declspec(dllexport)
|
||||
#define AGORA_CPP_API __declspec(dllexport)
|
||||
#else
|
||||
#define AGORA_API extern "C" __declspec(dllimport)
|
||||
#define AGORA_CPP_API __declspec(dllimport)
|
||||
#endif
|
||||
#elif defined(__APPLE__)
|
||||
#include <TargetConditionals.h>
|
||||
#define AGORA_API __attribute__((visibility("default"))) extern "C"
|
||||
#define AGORA_CPP_API __attribute__((visibility("default")))
|
||||
#define AGORA_CALL
|
||||
#elif defined(__ANDROID__) || defined(__linux__)
|
||||
#define AGORA_API extern "C" __attribute__((visibility("default")))
|
||||
#define AGORA_CPP_API __attribute__((visibility("default")))
|
||||
#define AGORA_CALL
|
||||
#else
|
||||
#define AGORA_API extern "C"
|
||||
#define AGORA_CPP_API
|
||||
#define AGORA_CALL
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define AGORA_GCC_VERSION_AT_LEAST(x, y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
|
||||
#else
|
||||
#define AGORA_GCC_VERSION_AT_LEAST(x, y) 0
|
||||
#endif
|
||||
|
||||
#if AGORA_GCC_VERSION_AT_LEAST(3, 1)
|
||||
#define AGORA_DEPRECATED_ATTRIBUTE __attribute__((deprecated))
|
||||
#elif defined(_MSC_VER)
|
||||
#define AGORA_DEPRECATED_ATTRIBUTE
|
||||
#else
|
||||
#define AGORA_DEPRECATED_ATTRIBUTE
|
||||
#endif
|
||||
|
||||
namespace agora {
|
||||
namespace util {
|
||||
|
||||
template <class T>
|
||||
class AutoPtr {
|
||||
typedef T value_type;
|
||||
typedef T* pointer_type;
|
||||
|
||||
public:
|
||||
AutoPtr(pointer_type p = 0) : ptr_(p) {}
|
||||
~AutoPtr() {
|
||||
if (ptr_) ptr_->release();
|
||||
}
|
||||
operator bool() const { return ptr_ != (pointer_type)0; }
|
||||
value_type& operator*() const { return *get(); }
|
||||
|
||||
pointer_type operator->() const { return get(); }
|
||||
|
||||
pointer_type get() const { return ptr_; }
|
||||
|
||||
pointer_type release() {
|
||||
pointer_type tmp = ptr_;
|
||||
ptr_ = 0;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void reset(pointer_type ptr = 0) {
|
||||
if (ptr != ptr_ && ptr_) ptr_->release();
|
||||
ptr_ = ptr;
|
||||
}
|
||||
template <class C1, class C2>
|
||||
bool queryInterface(C1* c, C2 iid) {
|
||||
pointer_type p = NULL;
|
||||
if (c && !c->queryInterface(iid, (void**)&p)) {
|
||||
reset(p);
|
||||
}
|
||||
return p != NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
AutoPtr(const AutoPtr&);
|
||||
AutoPtr& operator=(const AutoPtr&);
|
||||
|
||||
private:
|
||||
pointer_type ptr_;
|
||||
};
|
||||
class IString {
|
||||
protected:
|
||||
virtual ~IString() {}
|
||||
|
||||
public:
|
||||
virtual bool empty() const = 0;
|
||||
virtual const char* c_str() = 0;
|
||||
virtual const char* data() = 0;
|
||||
virtual size_t length() = 0;
|
||||
virtual void release() = 0;
|
||||
};
|
||||
typedef AutoPtr<IString> AString;
|
||||
|
||||
} // namespace util
|
||||
|
||||
enum INTERFACE_ID_TYPE {
|
||||
AGORA_IID_AUDIO_DEVICE_MANAGER = 1,
|
||||
AGORA_IID_VIDEO_DEVICE_MANAGER = 2,
|
||||
AGORA_IID_RTC_ENGINE_PARAMETER = 3,
|
||||
AGORA_IID_MEDIA_ENGINE = 4,
|
||||
AGORA_IID_SIGNALING_ENGINE = 8,
|
||||
};
|
||||
|
||||
/** Warning code.
|
||||
*/
|
||||
enum WARN_CODE_TYPE {
|
||||
/** 8: The specified view is invalid. Specify a view when using the video call function.
|
||||
*/
|
||||
WARN_INVALID_VIEW = 8,
|
||||
/** 16: Failed to initialize the video function, possibly caused by a lack of resources. The users cannot see the video while the voice communication is not affected.
|
||||
*/
|
||||
WARN_INIT_VIDEO = 16,
|
||||
/** 20: The request is pending, usually due to some module not being ready, and the SDK postponed processing the request.
|
||||
*/
|
||||
WARN_PENDING = 20,
|
||||
/** 103: No channel resources are available. Maybe because the server cannot allocate any channel resource.
|
||||
*/
|
||||
WARN_NO_AVAILABLE_CHANNEL = 103,
|
||||
/** 104: A timeout occurs when looking up the channel. When joining a channel, the SDK looks up the specified channel. This warning usually occurs when the network condition is too poor for the SDK to connect to the server.
|
||||
*/
|
||||
WARN_LOOKUP_CHANNEL_TIMEOUT = 104,
|
||||
/** **DEPRECATED** 105: The server rejects the request to look up the channel. The server cannot process this request or the request is illegal.
|
||||
|
||||
Deprecated as of v2.4.1. Use CONNECTION_CHANGED_REJECTED_BY_SERVER(10) in the \ref agora::rtc::IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" callback instead.
|
||||
*/
|
||||
WARN_LOOKUP_CHANNEL_REJECTED = 105,
|
||||
/** 106: A timeout occurs when opening the channel. Once the specific channel is found, the SDK opens the channel. This warning usually occurs when the network condition is too poor for the SDK to connect to the server.
|
||||
*/
|
||||
WARN_OPEN_CHANNEL_TIMEOUT = 106,
|
||||
/** 107: The server rejects the request to open the channel. The server cannot process this request or the request is illegal.
|
||||
*/
|
||||
WARN_OPEN_CHANNEL_REJECTED = 107,
|
||||
|
||||
// sdk: 100~1000
|
||||
/** 111: A timeout occurs when switching to the live video.
|
||||
*/
|
||||
WARN_SWITCH_LIVE_VIDEO_TIMEOUT = 111,
|
||||
/** 118: A timeout occurs when setting the client role in the interactive live streaming profile.
|
||||
*/
|
||||
WARN_SET_CLIENT_ROLE_TIMEOUT = 118,
|
||||
/** 121: The ticket to open the channel is invalid.
|
||||
*/
|
||||
WARN_OPEN_CHANNEL_INVALID_TICKET = 121,
|
||||
/** 122: Try connecting to another server.
|
||||
*/
|
||||
WARN_OPEN_CHANNEL_TRY_NEXT_VOS = 122,
|
||||
/** 131: The channel connection cannot be recovered.
|
||||
*/
|
||||
WARN_CHANNEL_CONNECTION_UNRECOVERABLE = 131,
|
||||
/** 132: The IP address has changed.
|
||||
*/
|
||||
WARN_CHANNEL_CONNECTION_IP_CHANGED = 132,
|
||||
/** 133: The port has changed.
|
||||
*/
|
||||
WARN_CHANNEL_CONNECTION_PORT_CHANGED = 133,
|
||||
/** 134: The socket error occurs, try to rejoin channel.
|
||||
*/
|
||||
WARN_CHANNEL_SOCKET_ERROR = 134,
|
||||
/** 701: An error occurs in opening the audio mixing file.
|
||||
*/
|
||||
WARN_AUDIO_MIXING_OPEN_ERROR = 701,
|
||||
/** 1014: Audio Device Module: A warning occurs in the playback device.
|
||||
*/
|
||||
WARN_ADM_RUNTIME_PLAYOUT_WARNING = 1014,
|
||||
/** 1016: Audio Device Module: A warning occurs in the audio capturing device.
|
||||
*/
|
||||
WARN_ADM_RUNTIME_RECORDING_WARNING = 1016,
|
||||
/** 1019: Audio Device Module: No valid audio data is captured.
|
||||
*/
|
||||
WARN_ADM_RECORD_AUDIO_SILENCE = 1019,
|
||||
/** 1020: Audio device module: The audio playback frequency is abnormal, which may cause audio freezes. This abnormality is caused by high CPU usage. Agora recommends stopping other apps.
|
||||
*/
|
||||
WARN_ADM_PLAYOUT_MALFUNCTION = 1020,
|
||||
/** 1021: Audio device module: the audio capturing frequency is abnormal, which may cause audio freezes. This abnormality is caused by high CPU usage. Agora recommends stopping other apps.
|
||||
*/
|
||||
WARN_ADM_RECORD_MALFUNCTION = 1021,
|
||||
/** 1025: The audio capture or playback is interrupted by a system call. If the audio capture or playback is required, remind your user to hang up the phone.
|
||||
*/
|
||||
WARN_ADM_CALL_INTERRUPTION = 1025,
|
||||
/** 1029: During a call, the audio session category should be set to
|
||||
* AVAudioSessionCategoryPlayAndRecord, and RtcEngine monitors this value.
|
||||
* If the audio session category is set to other values, this warning code
|
||||
* is triggered and RtcEngine will forcefully set it back to
|
||||
* AVAudioSessionCategoryPlayAndRecord.
|
||||
*/
|
||||
WARN_ADM_IOS_CATEGORY_NOT_PLAYANDRECORD = 1029,
|
||||
/** 1031: Audio Device Module: The captured audio voice is too low.
|
||||
*/
|
||||
WARN_ADM_RECORD_AUDIO_LOWLEVEL = 1031,
|
||||
/** 1032: Audio Device Module: The playback audio voice is too low.
|
||||
*/
|
||||
WARN_ADM_PLAYOUT_AUDIO_LOWLEVEL = 1032,
|
||||
/** 1033: The local audio capture device is occupied by another application. Remind your user to leave the channel, stop the audio capture in another application, and rejoin the channel in sequence.
|
||||
*/
|
||||
WARN_ADM_RECORD_AUDIO_IS_ACTIVE = 1033,
|
||||
/** 1040: Audio device module: An exception occurs with the audio drive.
|
||||
* Solutions:
|
||||
* - Disable or re-enable the audio device.
|
||||
* - Re-enable your device.
|
||||
* - Update the sound card drive.
|
||||
*/
|
||||
WARN_ADM_WINDOWS_NO_DATA_READY_EVENT = 1040,
|
||||
/** 1042: Audio device module: The audio capturing device is different from the audio playback device,
|
||||
* which may cause echoes problem. Agora recommends using the same audio device to capture and playback
|
||||
* audio.
|
||||
*/
|
||||
WARN_ADM_INCONSISTENT_AUDIO_DEVICE = 1042,
|
||||
/** 1051: (Communication profile only) Audio processing module: A howling sound is detected when capturing the audio data.
|
||||
*/
|
||||
WARN_APM_HOWLING = 1051,
|
||||
/** 1052: Audio Device Module: The device is in the glitch state.
|
||||
*/
|
||||
WARN_ADM_GLITCH_STATE = 1052,
|
||||
/** 1053: Audio Processing Module: A residual echo is detected, which may be caused by the belated scheduling of system threads or the signal overflow.
|
||||
*/
|
||||
WARN_APM_RESIDUAL_ECHO = 1053,
|
||||
/** 1054: Audio Processing Module: AI NS is closed, this can be triggered by manual settings or by performance detection modules.
|
||||
*/
|
||||
WARN_APM_AINS_CLOSED = 1054,
|
||||
/// @cond nodoc
|
||||
WARN_ADM_WIN_CORE_NO_RECORDING_DEVICE = 1322,
|
||||
/// @endcond
|
||||
/** 1323: Audio device module: No available playback device.
|
||||
* Solution: Plug in the audio device.
|
||||
*/
|
||||
WARN_ADM_WIN_CORE_NO_PLAYOUT_DEVICE = 1323,
|
||||
/** Audio device module: The capture device is released improperly.
|
||||
* Solutions:
|
||||
* - Disable or re-enable the audio device.
|
||||
* - Re-enable your device.
|
||||
* - Update the sound card drive.
|
||||
*/
|
||||
WARN_ADM_WIN_CORE_IMPROPER_CAPTURE_RELEASE = 1324,
|
||||
/** 1610: The original resolution of the remote user's video is beyond the range where super resolution can be applied.
|
||||
*/
|
||||
WARN_SUPER_RESOLUTION_STREAM_OVER_LIMITATION = 1610,
|
||||
/** 1611: Super resolution is already being used to boost another remote user's video.
|
||||
*/
|
||||
WARN_SUPER_RESOLUTION_USER_COUNT_OVER_LIMITATION = 1611,
|
||||
/** 1612: The device does not support using super resolution.
|
||||
*/
|
||||
WARN_SUPER_RESOLUTION_DEVICE_NOT_SUPPORTED = 1612,
|
||||
/// @cond nodoc
|
||||
WARN_RTM_LOGIN_TIMEOUT = 2005,
|
||||
WARN_RTM_KEEP_ALIVE_TIMEOUT = 2009
|
||||
/// @endcond
|
||||
};
|
||||
|
||||
/** Error code.
|
||||
*/
|
||||
enum ERROR_CODE_TYPE {
|
||||
/** 0: No error occurs.
|
||||
*/
|
||||
ERR_OK = 0,
|
||||
// 1~1000
|
||||
/** 1: A general error occurs (no specified reason).
|
||||
*/
|
||||
ERR_FAILED = 1,
|
||||
/** 2: An invalid parameter is used. For example, the specific channel name includes illegal characters.
|
||||
*/
|
||||
ERR_INVALID_ARGUMENT = 2,
|
||||
/** 3: The SDK module is not ready. Possible solutions:
|
||||
|
||||
- Check the audio device.
|
||||
- Check the completeness of the application.
|
||||
- Re-initialize the RTC engine.
|
||||
*/
|
||||
ERR_NOT_READY = 3,
|
||||
/** 4: The SDK does not support this function.
|
||||
*/
|
||||
ERR_NOT_SUPPORTED = 4,
|
||||
/** 5: The request is rejected.
|
||||
*/
|
||||
ERR_REFUSED = 5,
|
||||
/** 6: The buffer size is not big enough to store the returned data.
|
||||
*/
|
||||
ERR_BUFFER_TOO_SMALL = 6,
|
||||
/** 7: The SDK is not initialized before calling this method.
|
||||
*/
|
||||
ERR_NOT_INITIALIZED = 7,
|
||||
/** 9: No permission exists. Check if the user has granted access to the audio or video device.
|
||||
*/
|
||||
ERR_NO_PERMISSION = 9,
|
||||
/** 10: An API method timeout occurs. Some API methods require the SDK to return the execution result, and this error occurs if the request takes too long (more than 10 seconds) for the SDK to process.
|
||||
*/
|
||||
ERR_TIMEDOUT = 10,
|
||||
/** 11: The request is canceled. This is for internal SDK use only, and it does not return to the application through any method or callback.
|
||||
*/
|
||||
ERR_CANCELED = 11,
|
||||
/** 12: The method is called too often.
|
||||
*/
|
||||
ERR_TOO_OFTEN = 12,
|
||||
/** 13: The SDK fails to bind to the network socket. This is for internal SDK use only, and it does not return to the application through any method or callback.
|
||||
*/
|
||||
ERR_BIND_SOCKET = 13,
|
||||
/** 14: The network is unavailable. This is for internal SDK use only, and it does not return to the application through any method or callback.
|
||||
*/
|
||||
ERR_NET_DOWN = 14,
|
||||
/** 15: No network buffers are available. This is for internal SDK internal use only, and it does not return to the application through any method or callback.
|
||||
*/
|
||||
ERR_NET_NOBUFS = 15,
|
||||
/** 17: The request to join the channel is rejected.
|
||||
*
|
||||
* - This error usually occurs when the user is already in the channel, and still calls the method to join the
|
||||
* channel, for example, \ref agora::rtc::IRtcEngine::joinChannel "joinChannel".
|
||||
* - This error usually occurs when the user tries to join a channel
|
||||
* during \ref agora::rtc::IRtcEngine::startEchoTest "startEchoTest". Once you
|
||||
* call \ref agora::rtc::IRtcEngine::startEchoTest "startEchoTest", you need to
|
||||
* call \ref agora::rtc::IRtcEngine::stopEchoTest "stopEchoTest" before joining a channel.
|
||||
* - The user tries to join the channel with a token that is expired.
|
||||
*/
|
||||
ERR_JOIN_CHANNEL_REJECTED = 17,
|
||||
/** 18: The request to leave the channel is rejected.
|
||||
|
||||
This error usually occurs:
|
||||
|
||||
- When the user has left the channel and still calls \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" to leave the channel. In this case, stop calling \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel".
|
||||
- When the user has not joined the channel and still calls \ref agora::rtc::IRtcEngine::leaveChannel "leaveChannel" to leave the channel. In this case, no extra operation is needed.
|
||||
*/
|
||||
ERR_LEAVE_CHANNEL_REJECTED = 18,
|
||||
/** 19: Resources are occupied and cannot be reused.
|
||||
*/
|
||||
ERR_ALREADY_IN_USE = 19,
|
||||
/** 20: The SDK gives up the request due to too many requests.
|
||||
*/
|
||||
ERR_ABORTED = 20,
|
||||
/** 21: In Windows, specific firewall settings can cause the SDK to fail to initialize and crash.
|
||||
*/
|
||||
ERR_INIT_NET_ENGINE = 21,
|
||||
/** 22: The application uses too much of the system resources and the SDK fails to allocate the resources.
|
||||
*/
|
||||
ERR_RESOURCE_LIMITED = 22,
|
||||
/** 101: The specified App ID is invalid. Please try to rejoin the channel with a valid App ID.
|
||||
*/
|
||||
ERR_INVALID_APP_ID = 101,
|
||||
/** 102: The specified channel name is invalid. Please try to rejoin the channel with a valid channel name.
|
||||
*/
|
||||
ERR_INVALID_CHANNEL_NAME = 102,
|
||||
/** 103: Fails to get server resources in the specified region. Please try to specify another region when calling \ref agora::rtc::IRtcEngine::initialize "initialize".
|
||||
*/
|
||||
ERR_NO_SERVER_RESOURCES = 103,
|
||||
/** **DEPRECATED** 109: Deprecated as of v2.4.1. Use CONNECTION_CHANGED_TOKEN_EXPIRED(9) in the \ref agora::rtc::IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" callback instead.
|
||||
|
||||
The token expired due to one of the following reasons:
|
||||
|
||||
- Authorized Timestamp expired: The timestamp is represented by the number of seconds elapsed since 1/1/1970. The user can use the Token to access the Agora service within 24 hours after the Token is generated. If the user does not access the Agora service after 24 hours, this Token is no longer valid.
|
||||
- Call Expiration Timestamp expired: The timestamp is the exact time when a user can no longer use the Agora service (for example, when a user is forced to leave an ongoing call). When a value is set for the Call Expiration Timestamp, it does not mean that the token will expire, but that the user will be banned from the channel.
|
||||
*/
|
||||
ERR_TOKEN_EXPIRED = 109,
|
||||
/** **DEPRECATED** 110: Deprecated as of v2.4.1. Use CONNECTION_CHANGED_INVALID_TOKEN(8) in the \ref agora::rtc::IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" callback instead.
|
||||
|
||||
The token is invalid due to one of the following reasons:
|
||||
|
||||
- The App Certificate for the project is enabled in Console, but the user is still using the App ID. Once the App Certificate is enabled, the user must use a token.
|
||||
- The uid is mandatory, and users must set the same uid as the one set in the \ref agora::rtc::IRtcEngine::joinChannel "joinChannel" method.
|
||||
*/
|
||||
ERR_INVALID_TOKEN = 110,
|
||||
/** 111: The internet connection is interrupted. This applies to the Agora Web SDK only.
|
||||
*/
|
||||
ERR_CONNECTION_INTERRUPTED = 111, // only used in web sdk
|
||||
/** 112: The internet connection is lost. This applies to the Agora Web SDK only.
|
||||
*/
|
||||
ERR_CONNECTION_LOST = 112, // only used in web sdk
|
||||
/** 113: The user is not in the channel when calling the method.
|
||||
*/
|
||||
ERR_NOT_IN_CHANNEL = 113,
|
||||
/** 114: The size of the sent data is over 1024 bytes when the user calls the \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" method.
|
||||
*/
|
||||
ERR_SIZE_TOO_LARGE = 114,
|
||||
/** 115: The bitrate of the sent data exceeds the limit of 6 Kbps when the user calls the \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" method.
|
||||
*/
|
||||
ERR_BITRATE_LIMIT = 115,
|
||||
/** 116: Too many data streams (over 5 streams) are created when the user calls the \ref agora::rtc::IRtcEngine::createDataStream "createDataStream" method.
|
||||
*/
|
||||
ERR_TOO_MANY_DATA_STREAMS = 116,
|
||||
/** 117: The data stream transmission timed out.
|
||||
*/
|
||||
ERR_STREAM_MESSAGE_TIMEOUT = 117,
|
||||
/** 119: Deprecated as of v3.7.0. Use #CLIENT_ROLE_CHANGE_FAILED_REASON reported in `onClientRoleChangeFailed` instead.
|
||||
*/
|
||||
ERR_SET_CLIENT_ROLE_NOT_AUTHORIZED = 119,
|
||||
/** 120: Decryption fails. The user may have used a different encryption password to join the channel. Check your settings or try rejoining the channel.
|
||||
*/
|
||||
ERR_DECRYPTION_FAILED = 120,
|
||||
/** 123: The user is banned by the server. This error occurs when the user is kicked out the channel from the server.
|
||||
*/
|
||||
ERR_CLIENT_IS_BANNED_BY_SERVER = 123,
|
||||
/** 124: Incorrect watermark file parameter.
|
||||
*/
|
||||
ERR_WATERMARK_PARAM = 124,
|
||||
/** 125: Incorrect watermark file path.
|
||||
*/
|
||||
ERR_WATERMARK_PATH = 125,
|
||||
/** 126: Incorrect watermark file format.
|
||||
*/
|
||||
ERR_WATERMARK_PNG = 126,
|
||||
/** 127: Incorrect watermark file information.
|
||||
*/
|
||||
ERR_WATERMARKR_INFO = 127,
|
||||
/** 128: Incorrect watermark file data format.
|
||||
*/
|
||||
ERR_WATERMARK_ARGB = 128,
|
||||
/** 129: An error occurs in reading the watermark file.
|
||||
*/
|
||||
ERR_WATERMARK_READ = 129,
|
||||
/** 130: Encryption is enabled when the user calls the \ref agora::rtc::IRtcEngine::addPublishStreamUrl "addPublishStreamUrl" method (CDN live streaming does not support encrypted streams).
|
||||
*/
|
||||
ERR_ENCRYPTED_STREAM_NOT_ALLOWED_PUBLISH = 130,
|
||||
/** 134: The user account is invalid. */
|
||||
ERR_INVALID_USER_ACCOUNT = 134,
|
||||
/** 151: CDN related errors. Remove the original URL address and add a new one by calling the \ref agora::rtc::IRtcEngine::removePublishStreamUrl "removePublishStreamUrl" and \ref agora::rtc::IRtcEngine::addPublishStreamUrl "addPublishStreamUrl" methods.
|
||||
*/
|
||||
ERR_PUBLISH_STREAM_CDN_ERROR = 151,
|
||||
/** 152: The host publishes more than 10 URLs. Delete the unnecessary URLs before adding new ones.
|
||||
*/
|
||||
ERR_PUBLISH_STREAM_NUM_REACH_LIMIT = 152,
|
||||
/** 153: The host manipulates other hosts' URLs. Check your app logic.
|
||||
*/
|
||||
ERR_PUBLISH_STREAM_NOT_AUTHORIZED = 153,
|
||||
/** 154: An error occurs in Agora's streaming server. Call the addPublishStreamUrl method to publish the streaming again.
|
||||
*/
|
||||
ERR_PUBLISH_STREAM_INTERNAL_SERVER_ERROR = 154,
|
||||
/** 155: The server fails to find the stream.
|
||||
*/
|
||||
ERR_PUBLISH_STREAM_NOT_FOUND = 155,
|
||||
/** 156: The format of the RTMP or RTMPS stream URL is not supported. Check whether the URL format is correct.
|
||||
*/
|
||||
ERR_PUBLISH_STREAM_FORMAT_NOT_SUPPORTED = 156,
|
||||
/** 157: The necessary dynamical library is not integrated. For example, if you call
|
||||
* the \ref agora::rtc::IRtcEngine::enableDeepLearningDenoise "enableDeepLearningDenoise" but do not integrate the dynamical
|
||||
* library for the deep-learning noise reduction into your project, the SDK reports this error code.
|
||||
*
|
||||
*/
|
||||
ERR_MODULE_NOT_FOUND = 157,
|
||||
|
||||
/** 160: The client is already recording audio. To start a new recording,
|
||||
* call \ref agora::rtc::IRtcEngine::stopAudioRecording "stopAudioRecording" to stop
|
||||
* the current recording first, and then
|
||||
* call \ref agora::rtc::IRtcEngine::startAudioRecording(const AudioRecordingConfiguration&) "startAudioRecording".
|
||||
*
|
||||
* @since v3.4.0
|
||||
*/
|
||||
ERR_ALREADY_IN_RECORDING = 160,
|
||||
|
||||
// signaling: 400~600
|
||||
ERR_LOGOUT_OTHER = 400, //
|
||||
ERR_LOGOUT_USER = 401, // logout by user
|
||||
ERR_LOGOUT_NET = 402, // network failure
|
||||
ERR_LOGOUT_KICKED = 403, // login in other device
|
||||
ERR_LOGOUT_PACKET = 404, //
|
||||
ERR_LOGOUT_TOKEN_EXPIRED = 405, // token expired
|
||||
ERR_LOGOUT_OLDVERSION = 406, //
|
||||
ERR_LOGOUT_TOKEN_WRONG = 407,
|
||||
ERR_LOGOUT_ALREADY_LOGOUT = 408,
|
||||
ERR_LOGIN_OTHER = 420,
|
||||
ERR_LOGIN_NET = 421,
|
||||
ERR_LOGIN_FAILED = 422,
|
||||
ERR_LOGIN_CANCELED = 423,
|
||||
ERR_LOGIN_TOKEN_EXPIRED = 424,
|
||||
ERR_LOGIN_OLD_VERSION = 425,
|
||||
ERR_LOGIN_TOKEN_WRONG = 426,
|
||||
ERR_LOGIN_TOKEN_KICKED = 427,
|
||||
ERR_LOGIN_ALREADY_LOGIN = 428,
|
||||
ERR_JOIN_CHANNEL_OTHER = 440,
|
||||
ERR_SEND_MESSAGE_OTHER = 440,
|
||||
ERR_SEND_MESSAGE_TIMEOUT = 441,
|
||||
ERR_QUERY_USERNUM_OTHER = 450,
|
||||
ERR_QUERY_USERNUM_TIMEOUT = 451,
|
||||
ERR_QUERY_USERNUM_BYUSER = 452,
|
||||
ERR_LEAVE_CHANNEL_OTHER = 460,
|
||||
ERR_LEAVE_CHANNEL_KICKED = 461,
|
||||
ERR_LEAVE_CHANNEL_BYUSER = 462,
|
||||
ERR_LEAVE_CHANNEL_LOGOUT = 463,
|
||||
ERR_LEAVE_CHANNEL_DISCONNECTED = 464,
|
||||
ERR_INVITE_OTHER = 470,
|
||||
ERR_INVITE_REINVITE = 471,
|
||||
ERR_INVITE_NET = 472,
|
||||
ERR_INVITE_PEER_OFFLINE = 473,
|
||||
ERR_INVITE_TIMEOUT = 474,
|
||||
ERR_INVITE_CANT_RECV = 475,
|
||||
|
||||
// 1001~2000
|
||||
/** 1001: Fails to load the media engine.
|
||||
*/
|
||||
ERR_LOAD_MEDIA_ENGINE = 1001,
|
||||
/** 1002: Fails to start the call after enabling the media engine.
|
||||
*/
|
||||
ERR_START_CALL = 1002,
|
||||
/** **DEPRECATED** 1003: Fails to start the camera.
|
||||
|
||||
Deprecated as of v2.4.1. Use LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE(4) in the \ref agora::rtc::IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" callback instead.
|
||||
*/
|
||||
ERR_START_CAMERA = 1003,
|
||||
/** 1004: Fails to start the video rendering module.
|
||||
*/
|
||||
ERR_START_VIDEO_RENDER = 1004,
|
||||
/** 1005: A general error occurs in the Audio Device Module (no specified reason). Check if the audio device is used by another application, or try rejoining the channel.
|
||||
*/
|
||||
ERR_ADM_GENERAL_ERROR = 1005,
|
||||
/** 1006: Audio Device Module: An error occurs in using the Java resources.
|
||||
*/
|
||||
ERR_ADM_JAVA_RESOURCE = 1006,
|
||||
/** 1007: Audio Device Module: An error occurs in setting the sampling frequency.
|
||||
*/
|
||||
ERR_ADM_SAMPLE_RATE = 1007,
|
||||
/** 1008: Audio Device Module: An error occurs in initializing the playback device.
|
||||
*/
|
||||
ERR_ADM_INIT_PLAYOUT = 1008,
|
||||
/** 1009: Audio Device Module: An error occurs in starting the playback device.
|
||||
*/
|
||||
ERR_ADM_START_PLAYOUT = 1009,
|
||||
/** 1010: Audio Device Module: An error occurs in stopping the playback device.
|
||||
*/
|
||||
ERR_ADM_STOP_PLAYOUT = 1010,
|
||||
/** 1011: Audio Device Module: An error occurs in initializing the capturing device.
|
||||
*/
|
||||
ERR_ADM_INIT_RECORDING = 1011,
|
||||
/** 1012: Audio Device Module: An error occurs in starting the capturing device.
|
||||
*/
|
||||
ERR_ADM_START_RECORDING = 1012,
|
||||
/** 1013: Audio Device Module: An error occurs in stopping the capturing device.
|
||||
*/
|
||||
ERR_ADM_STOP_RECORDING = 1013,
|
||||
/** 1015: Audio Device Module: A playback error occurs. Check your playback device and try rejoining the channel.
|
||||
*/
|
||||
ERR_ADM_RUNTIME_PLAYOUT_ERROR = 1015,
|
||||
/** 1017: Audio Device Module: A capturing error occurs.
|
||||
*/
|
||||
ERR_ADM_RUNTIME_RECORDING_ERROR = 1017,
|
||||
/** 1018: Audio Device Module: Fails to record.
|
||||
*/
|
||||
ERR_ADM_RECORD_AUDIO_FAILED = 1018,
|
||||
/** 1022: Audio Device Module: An error occurs in initializing the
|
||||
* loopback device.
|
||||
*/
|
||||
ERR_ADM_INIT_LOOPBACK = 1022,
|
||||
/** 1023: Audio Device Module: An error occurs in starting the loopback
|
||||
* device.
|
||||
*/
|
||||
ERR_ADM_START_LOOPBACK = 1023,
|
||||
/** 1027: The application does not have permission to use the microphone. Remind your user to grant permission and rejoin the channel.
|
||||
*/
|
||||
ERR_ADM_NO_PERMISSION = 1027,
|
||||
/** 1033: The local audio capture device is occupied by another application. Remind your user to leave the channel, stop the audio capture in another application, and rejoin the channel in sequence.
|
||||
*/
|
||||
ERR_ADM_RECORD_AUDIO_IS_ACTIVE = 1033,
|
||||
/** 1101: Audio device module: A fatal exception occurs.
|
||||
*/
|
||||
ERR_ADM_ANDROID_JNI_JAVA_RESOURCE = 1101,
|
||||
/** 1108: An exception occurred in the audio capture thread. Remind your user to rejoin the channel.
|
||||
*/
|
||||
ERR_ADM_ANDROID_JNI_NO_RECORD_FREQUENCY = 1108,
|
||||
/** 1109: An exception occurred in the audio playback thread. Remind your user to rejoin the channel.
|
||||
*/
|
||||
ERR_ADM_ANDROID_JNI_NO_PLAYBACK_FREQUENCY = 1109,
|
||||
/** 1111: Failed to start the local audio capture. Remind your user to rejoin the channel.
|
||||
*/
|
||||
ERR_ADM_ANDROID_JNI_JAVA_START_RECORD = 1111,
|
||||
/** 1112: Failed to start the local audio playback. Remind your user to rejoin the channel.
|
||||
*/
|
||||
ERR_ADM_ANDROID_JNI_JAVA_START_PLAYBACK = 1112,
|
||||
/** 1115: Audio device module: AudioRecord returns error. The SDK will
|
||||
* automatically restart AudioRecord. */
|
||||
ERR_ADM_ANDROID_JNI_JAVA_RECORD_ERROR = 1115,
|
||||
/** **DEPRECATED** */
|
||||
ERR_ADM_ANDROID_OPENSL_CREATE_ENGINE = 1151,
|
||||
/** 1153: Failed to create Audio Recorder. Remind your user to rejoin the channel. */
|
||||
ERR_ADM_ANDROID_OPENSL_CREATE_AUDIO_RECORDER = 1153,
|
||||
/** 1156: Failed to start the local audio capture. Remind your user to rejoin the channel. */
|
||||
ERR_ADM_ANDROID_OPENSL_START_RECORDER_THREAD = 1156,
|
||||
/** 1157: Failed to create Audio Player. Remind your user to rejoin the channel. */
|
||||
ERR_ADM_ANDROID_OPENSL_CREATE_AUDIO_PLAYER = 1157,
|
||||
/** 1160: Failed to start the local audio playback. Remind your user to rejoin the channel. */
|
||||
ERR_ADM_ANDROID_OPENSL_START_PLAYER_THREAD = 1160,
|
||||
/** 1201: Audio device module: The current device does not support audio
|
||||
* input, possibly because you have mistakenly configured the audio session
|
||||
* category, or because some other app is occupying the input device. We
|
||||
* recommend terminating all background apps and re-joining the channel. */
|
||||
ERR_ADM_IOS_INPUT_NOT_AVAILABLE = 1201,
|
||||
/** 1206: Audio device module: Cannot activate the Audio Session.*/
|
||||
ERR_ADM_IOS_ACTIVATE_SESSION_FAIL = 1206,
|
||||
/** 1210: Audio device module: Fails to initialize the audio device,
|
||||
* normally because the audio device parameters are wrongly set.*/
|
||||
ERR_ADM_IOS_VPIO_INIT_FAIL = 1210,
|
||||
/** 1213: Audio device module: Fails to re-initialize the audio device,
|
||||
* normally because the audio device parameters are wrongly set.*/
|
||||
ERR_ADM_IOS_VPIO_REINIT_FAIL = 1213,
|
||||
/** 1214: Fails to re-start up the Audio Unit, possibly because the audio
|
||||
* session category is not compatible with the settings of the Audio Unit.
|
||||
*/
|
||||
ERR_ADM_IOS_VPIO_RESTART_FAIL = 1214,
|
||||
|
||||
ERR_ADM_IOS_SET_RENDER_CALLBACK_FAIL = 1219,
|
||||
|
||||
/** **DEPRECATED** */
|
||||
ERR_ADM_IOS_SESSION_SAMPLERATR_ZERO = 1221,
|
||||
/** 1301: Audio device module: An audio driver abnormality or a
|
||||
* compatibility issue occurs. Solutions: Disable and restart the audio
|
||||
* device, or reboot the system.*/
|
||||
ERR_ADM_WIN_CORE_INIT = 1301,
|
||||
/** 1303: Audio device module: A recording driver abnormality or a
|
||||
* compatibility issue occurs. Solutions: Disable and restart the audio
|
||||
* device, or reboot the system. */
|
||||
ERR_ADM_WIN_CORE_INIT_RECORDING = 1303,
|
||||
/** 1306: Audio device module: A playout driver abnormality or a
|
||||
* compatibility issue occurs. Solutions: Disable and restart the audio
|
||||
* device, or reboot the system. */
|
||||
ERR_ADM_WIN_CORE_INIT_PLAYOUT = 1306,
|
||||
/** 1307: Audio device module: No audio device is available. Solutions:
|
||||
* Plug in a proper audio device. */
|
||||
ERR_ADM_WIN_CORE_INIT_PLAYOUT_NULL = 1307,
|
||||
/** 1309: Audio device module: An audio driver abnormality or a
|
||||
* compatibility issue occurs. Solutions: Disable and restart the audio
|
||||
* device, or reboot the system. */
|
||||
ERR_ADM_WIN_CORE_START_RECORDING = 1309,
|
||||
/** 1311: Audio device module: Insufficient system memory or poor device
|
||||
* performance. Solutions: Reboot the system or replace the device.
|
||||
*/
|
||||
ERR_ADM_WIN_CORE_CREATE_REC_THREAD = 1311,
|
||||
/** 1314: Audio device module: An audio driver abnormality occurs.
|
||||
* Solutions:
|
||||
* - Disable and then re-enable the audio device.
|
||||
* - Reboot the system.
|
||||
* - Upgrade your audio card driver.*/
|
||||
ERR_ADM_WIN_CORE_CAPTURE_NOT_STARTUP = 1314,
|
||||
/** 1319: Audio device module: Insufficient system memory or poor device
|
||||
* performance. Solutions: Reboot the system or replace the device. */
|
||||
ERR_ADM_WIN_CORE_CREATE_RENDER_THREAD = 1319,
|
||||
/** 1320: Audio device module: An audio driver abnormality occurs.
|
||||
* Solutions:
|
||||
* - Disable and then re-enable the audio device.
|
||||
* - Reboot the system.
|
||||
* - Replace the device. */
|
||||
ERR_ADM_WIN_CORE_RENDER_NOT_STARTUP = 1320,
|
||||
/** 1322: Audio device module: No audio sampling device is available.
|
||||
* Solutions: Plug in a proper capturing device. */
|
||||
ERR_ADM_WIN_CORE_NO_RECORDING_DEVICE = 1322,
|
||||
/** 1323: Audio device module: No audio playout device is available.
|
||||
* Solutions: Plug in a proper playback device.*/
|
||||
ERR_ADM_WIN_CORE_NO_PLAYOUT_DEVICE = 1323,
|
||||
/** 1351: Audio device module: An audio driver abnormality or a
|
||||
* compatibility issue occurs. Solutions:
|
||||
* - Disable and then re-enable the audio device.
|
||||
* - Reboot the system.
|
||||
* - Upgrade your audio card driver. */
|
||||
ERR_ADM_WIN_WAVE_INIT = 1351,
|
||||
/** 1353: Audio device module: An audio driver abnormality occurs.
|
||||
* Solutions:
|
||||
* - Disable and then re-enable the audio device.
|
||||
* - Reboot the system.
|
||||
* - Upgrade your audio card driver. */
|
||||
ERR_ADM_WIN_WAVE_INIT_RECORDING = 1353,
|
||||
/** 1354: Audio device module: An audio driver abnormality occurs.
|
||||
* Solutions:
|
||||
* - Disable and then re-enable the audio device.
|
||||
* - Reboot the system.
|
||||
* - Upgrade your audio card driver. */
|
||||
ERR_ADM_WIN_WAVE_INIT_MICROPHONE = 1354,
|
||||
/** 1355: Audio device module: An audio driver abnormality occurs.
|
||||
* Solutions:
|
||||
* - Disable and then re-enable the audio device.
|
||||
* - Reboot the system.
|
||||
* - Upgrade your audio card driver. */
|
||||
ERR_ADM_WIN_WAVE_INIT_PLAYOUT = 1355,
|
||||
/** 1356: Audio device module: An audio driver abnormality occurs.
|
||||
* Solutions:
|
||||
* - Disable and then re-enable the audio device.
|
||||
* - Reboot the system.
|
||||
* - Upgrade your audio card driver. */
|
||||
ERR_ADM_WIN_WAVE_INIT_SPEAKER = 1356,
|
||||
/** 1357: Audio device module: An audio driver abnormality occurs.
|
||||
* Solutions:
|
||||
* - Disable and then re-enable the audio device.
|
||||
* - Reboot the system.
|
||||
* - Upgrade your audio card driver. */
|
||||
ERR_ADM_WIN_WAVE_START_RECORDING = 1357,
|
||||
/** 1358: Audio device module: An audio driver abnormality occurs.
|
||||
* Solutions:
|
||||
* - Disable and then re-enable the audio device.
|
||||
* - Reboot the system.
|
||||
* - Upgrade your audio card driver.*/
|
||||
ERR_ADM_WIN_WAVE_START_PLAYOUT = 1358,
|
||||
/** 1359: Audio Device Module: No capturing device exists.
|
||||
*/
|
||||
ERR_ADM_NO_RECORDING_DEVICE = 1359,
|
||||
/** 1360: Audio Device Module: No playback device exists.
|
||||
*/
|
||||
ERR_ADM_NO_PLAYOUT_DEVICE = 1360,
|
||||
|
||||
// VDM error code starts from 1500
|
||||
/// @cond nodoc
|
||||
/** 1500: Video Device Module: There is no camera device.
|
||||
*/
|
||||
ERR_VDM_CAMERA_NO_DEVICE = 1500,
|
||||
/// @endcond
|
||||
|
||||
/** 1501: Video Device Module: The camera is unauthorized.
|
||||
*/
|
||||
ERR_VDM_CAMERA_NOT_AUTHORIZED = 1501,
|
||||
|
||||
/** **DEPRECATED** 1502: Video Device Module: The camera in use.
|
||||
Deprecated as of v2.4.1. Use LOCAL_VIDEO_STREAM_ERROR_DEVICE_BUSY(3) in the \ref agora::rtc::IRtcEngineEventHandler::onLocalVideoStateChanged "onLocalVideoStateChanged" callback instead.
|
||||
*/
|
||||
ERR_VDM_WIN_DEVICE_IN_USE = 1502,
|
||||
|
||||
// VCM error code starts from 1600
|
||||
/** 1600: Video Device Module: An unknown error occurs.
|
||||
*/
|
||||
ERR_VCM_UNKNOWN_ERROR = 1600,
|
||||
/** 1601: Video Device Module: An error occurs in initializing the video encoder.
|
||||
*/
|
||||
ERR_VCM_ENCODER_INIT_ERROR = 1601,
|
||||
/** 1602: Video Device Module: An error occurs in encoding.
|
||||
*/
|
||||
ERR_VCM_ENCODER_ENCODE_ERROR = 1602,
|
||||
/** 1603: Video Device Module: An error occurs in setting the video encoder.
|
||||
*/
|
||||
ERR_VCM_ENCODER_SET_ERROR = 1603,
|
||||
/** 1735: (Windows only) The Windows Audio service is disabled. You need to
|
||||
* either enable the Windows Audio service or restart the device.
|
||||
*
|
||||
* @since v3.5.0
|
||||
*/
|
||||
ERR_ADM_WIN_CORE_SERVRE_SHUT_DOWN = 1735,
|
||||
/** 1736: (Windows only) The SDK does not support you to set `excludeWindowList` to block windows on a device with multiple graphics cards.
|
||||
*
|
||||
* @since v3.7.0
|
||||
*/
|
||||
ERR_NOT_SUPPORTED_MUTI_GPU_EXCLUDE_WINDOW = 1736,
|
||||
};
|
||||
|
||||
/** Output log filter level. */
|
||||
enum LOG_FILTER_TYPE {
|
||||
/** 0: Do not output any log information. */
|
||||
LOG_FILTER_OFF = 0,
|
||||
/** 0x080f: Output all log information.
|
||||
Set your log filter as debug if you want to get the most complete log file. */
|
||||
LOG_FILTER_DEBUG = 0x080f,
|
||||
/** 0x000f: Output CRITICAL, ERROR, WARNING, and INFO level log information.
|
||||
We recommend setting your log filter as this level.
|
||||
*/
|
||||
LOG_FILTER_INFO = 0x000f,
|
||||
/** 0x000e: Outputs CRITICAL, ERROR, and WARNING level log information.
|
||||
*/
|
||||
LOG_FILTER_WARN = 0x000e,
|
||||
/** 0x000c: Outputs CRITICAL and ERROR level log information. */
|
||||
LOG_FILTER_ERROR = 0x000c,
|
||||
/** 0x0008: Outputs CRITICAL level log information. */
|
||||
LOG_FILTER_CRITICAL = 0x0008,
|
||||
/// @cond nodoc
|
||||
LOG_FILTER_MASK = 0x80f,
|
||||
/// @endcond
|
||||
};
|
||||
/** The output log level of the SDK.
|
||||
*
|
||||
* @since v3.3.0
|
||||
*/
|
||||
enum class LOG_LEVEL {
|
||||
/** 0x0000: Do not output any log. */
|
||||
LOG_LEVEL_NONE = 0x0000,
|
||||
/** 0x0001: (Default) Output logs of the FATAL, ERROR, WARN and INFO level. We recommend setting your log filter as this level.
|
||||
*/
|
||||
LOG_LEVEL_INFO = 0x0001,
|
||||
/** 0x0002: Output logs of the FATAL, ERROR and WARN level.
|
||||
*/
|
||||
LOG_LEVEL_WARN = 0x0002,
|
||||
/** 0x0004: Output logs of the FATAL and ERROR level. */
|
||||
LOG_LEVEL_ERROR = 0x0004,
|
||||
/** 0x0008: Output logs of the FATAL level. */
|
||||
LOG_LEVEL_FATAL = 0x0008,
|
||||
};
|
||||
} // namespace agora
|
||||
|
||||
#endif
|
794
core/libs/include/AgoraOptional.h
Normal file
794
core/libs/include/AgoraOptional.h
Normal file
@@ -0,0 +1,794 @@
|
||||
// Copyright (c) 2019 Agora.io. All rights reserved
|
||||
|
||||
// This program is confidential and proprietary to Agora.io.
|
||||
// And may not be copied, reproduced, modified, disclosed to others, published
|
||||
// or used, in whole or in part, without the express prior written permission
|
||||
// of Agora.io.
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
#include <type_traits>
|
||||
#endif
|
||||
#include <utility>
|
||||
|
||||
#ifndef CONSTEXPR
|
||||
#if __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)
|
||||
#define CONSTEXPR constexpr
|
||||
#else
|
||||
#define CONSTEXPR
|
||||
#endif
|
||||
#endif // !CONSTEXPR
|
||||
|
||||
#ifndef NOEXCEPT
|
||||
#if __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)
|
||||
#define NOEXCEPT(Expr) noexcept(Expr)
|
||||
#else
|
||||
#define NOEXCEPT(Expr)
|
||||
#endif
|
||||
#endif // !NOEXCEPT
|
||||
|
||||
namespace agora {
|
||||
|
||||
// Specification:
|
||||
// http://en.cppreference.com/w/cpp/utility/optional/in_place_t
|
||||
struct in_place_t {};
|
||||
|
||||
// Specification:
|
||||
// http://en.cppreference.com/w/cpp/utility/optional/nullopt_t
|
||||
struct nullopt_t {
|
||||
CONSTEXPR explicit nullopt_t(int) {}
|
||||
};
|
||||
|
||||
// Specification:
|
||||
// http://en.cppreference.com/w/cpp/utility/optional/in_place
|
||||
/*CONSTEXPR*/ const in_place_t in_place = {};
|
||||
|
||||
// Specification:
|
||||
// http://en.cppreference.com/w/cpp/utility/optional/nullopt
|
||||
/*CONSTEXPR*/ const nullopt_t nullopt(0);
|
||||
|
||||
// Forward declaration, which is refered by following helpers.
|
||||
template <typename T>
|
||||
class Optional;
|
||||
|
||||
namespace internal {
|
||||
|
||||
template <typename T>
|
||||
struct OptionalStorageBase {
|
||||
// Initializing |empty_| here instead of using default member initializing
|
||||
// to avoid errors in g++ 4.8.
|
||||
CONSTEXPR OptionalStorageBase() : is_populated_(false), empty_('\0') {}
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
template <class... Args>
|
||||
CONSTEXPR explicit OptionalStorageBase(in_place_t, Args&&... args) : is_populated_(true), value_(std::forward<Args>(args)...) {}
|
||||
#else
|
||||
CONSTEXPR explicit OptionalStorageBase(in_place_t, const T& _value) : is_populated_(true), value_(_value) {}
|
||||
#endif
|
||||
// When T is not trivially destructible we must call its
|
||||
// destructor before deallocating its memory.
|
||||
// Note that this hides the (implicitly declared) move constructor, which
|
||||
// would be used for constexpr move constructor in OptionalStorage<T>.
|
||||
// It is needed iff T is trivially move constructible. However, the current
|
||||
// is_trivially_{copy,move}_constructible implementation requires
|
||||
// is_trivially_destructible (which looks a bug, cf:
|
||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51452 and
|
||||
// http://cplusplus.github.io/LWG/lwg-active.html#2116), so it is not
|
||||
// necessary for this case at the moment. Please see also the destructor
|
||||
// comment in "is_trivially_destructible = true" specialization below.
|
||||
~OptionalStorageBase() {
|
||||
if (is_populated_) value_.~T();
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
template <class... Args>
|
||||
void Init(Args&&... args) {
|
||||
::new (&value_) T(std::forward<Args>(args)...);
|
||||
is_populated_ = true;
|
||||
}
|
||||
#else
|
||||
void Init(const T& _value) {
|
||||
::new (&value_) T(_value);
|
||||
is_populated_ = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool is_populated_;
|
||||
|
||||
union {
|
||||
// |empty_| exists so that the union will always be initialized, even when
|
||||
// it doesn't contain a value. Union members must be initialized for the
|
||||
// constructor to be 'constexpr'.
|
||||
char empty_;
|
||||
T value_;
|
||||
};
|
||||
};
|
||||
|
||||
// Implement conditional constexpr copy and move constructors. These are
|
||||
// constexpr if is_trivially_{copy,move}_constructible<T>::value is true
|
||||
// respectively. If each is true, the corresponding constructor is defined as
|
||||
// "= default;", which generates a constexpr constructor (In this case,
|
||||
// the condition of constexpr-ness is satisfied because the base class also has
|
||||
// compiler generated constexpr {copy,move} constructors). Note that
|
||||
// placement-new is prohibited in constexpr.
|
||||
template <typename T>
|
||||
struct OptionalStorage : OptionalStorageBase<T> {
|
||||
// This is no trivially {copy,move} constructible case. Other cases are
|
||||
// defined below as specializations.
|
||||
|
||||
// Accessing the members of template base class requires explicit
|
||||
// declaration.
|
||||
using OptionalStorageBase<T>::is_populated_;
|
||||
using OptionalStorageBase<T>::value_;
|
||||
using OptionalStorageBase<T>::Init;
|
||||
|
||||
// Inherit constructors (specifically, the in_place constructor).
|
||||
// using OptionalStorageBase<T>::OptionalStorageBase;
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
template <class... Args>
|
||||
CONSTEXPR explicit OptionalStorage(in_place_t in_place, Args&&... args) : OptionalStorageBase<T>(in_place, std::forward<Args>(args)...) {}
|
||||
#else
|
||||
CONSTEXPR explicit OptionalStorage(in_place_t in_place, const T& _value) : OptionalStorageBase<T>(in_place, _value) {}
|
||||
#endif
|
||||
|
||||
// User defined constructor deletes the default constructor.
|
||||
// Define it explicitly.
|
||||
OptionalStorage() {}
|
||||
|
||||
OptionalStorage(const OptionalStorage& other) {
|
||||
if (other.is_populated_) Init(other.value_);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
OptionalStorage(OptionalStorage&& other) NOEXCEPT(std::is_nothrow_move_constructible<T>::value) {
|
||||
if (other.is_populated_) Init(std::move(other.value_));
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
// Base class to support conditionally usable copy-/move- constructors
|
||||
// and assign operators.
|
||||
template <typename T>
|
||||
class OptionalBase {
|
||||
// This class provides implementation rather than public API, so everything
|
||||
// should be hidden. Often we use composition, but we cannot in this case
|
||||
// because of C++ language restriction.
|
||||
protected:
|
||||
CONSTEXPR OptionalBase() {}
|
||||
CONSTEXPR OptionalBase(const OptionalBase& other) : storage_(other.storage_) {}
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
CONSTEXPR OptionalBase(OptionalBase&& other) : storage_(std::move(other.storage_)) {}
|
||||
|
||||
template <class... Args>
|
||||
CONSTEXPR explicit OptionalBase(in_place_t, Args&&... args) : storage_(in_place, std::forward<Args>(args)...) {}
|
||||
#else
|
||||
CONSTEXPR explicit OptionalBase(in_place_t, const T& _value) : storage_(in_place, _value) {}
|
||||
#endif
|
||||
|
||||
// Implementation of converting constructors.
|
||||
template <typename U>
|
||||
explicit OptionalBase(const OptionalBase<U>& other) {
|
||||
if (other.storage_.is_populated_) storage_.Init(other.storage_.value_);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
template <typename U>
|
||||
explicit OptionalBase(OptionalBase<U>&& other) {
|
||||
if (other.storage_.is_populated_) storage_.Init(std::move(other.storage_.value_));
|
||||
}
|
||||
#endif
|
||||
|
||||
~OptionalBase() {}
|
||||
|
||||
OptionalBase& operator=(const OptionalBase& other) {
|
||||
CopyAssign(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
OptionalBase& operator=(OptionalBase&& other) NOEXCEPT(std::is_nothrow_move_assignable<T>::value&& std::is_nothrow_move_constructible<T>::value) {
|
||||
MoveAssign(std::move(other));
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename U>
|
||||
void CopyAssign(const OptionalBase<U>& other) {
|
||||
if (other.storage_.is_populated_)
|
||||
InitOrAssign(other.storage_.value_);
|
||||
else
|
||||
FreeIfNeeded();
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
template <typename U>
|
||||
void MoveAssign(OptionalBase<U>&& other) {
|
||||
if (other.storage_.is_populated_)
|
||||
InitOrAssign(std::move(other.storage_.value_));
|
||||
else
|
||||
FreeIfNeeded();
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename U>
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
void InitOrAssign(U&& value) {
|
||||
if (storage_.is_populated_)
|
||||
storage_.value_ = std::forward<U>(value);
|
||||
else
|
||||
storage_.Init(std::forward<U>(value));
|
||||
}
|
||||
#else
|
||||
void InitOrAssign(const U& value) {
|
||||
if (storage_.is_populated_)
|
||||
storage_.value_ = value;
|
||||
else
|
||||
storage_.Init(value);
|
||||
}
|
||||
#endif
|
||||
|
||||
void FreeIfNeeded() {
|
||||
if (!storage_.is_populated_) return;
|
||||
storage_.value_.~T();
|
||||
storage_.is_populated_ = false;
|
||||
}
|
||||
|
||||
// For implementing conversion, allow access to other typed OptionalBase
|
||||
// class.
|
||||
template <typename U>
|
||||
friend class OptionalBase;
|
||||
|
||||
OptionalStorage<T> storage_;
|
||||
};
|
||||
|
||||
// The following {Copy,Move}{Constructible,Assignable} structs are helpers to
|
||||
// implement constructor/assign-operator overloading. Specifically, if T is
|
||||
// is not movable but copyable, Optional<T>'s move constructor should not
|
||||
// participate in overload resolution. This inheritance trick implements that.
|
||||
template <bool is_copy_constructible>
|
||||
struct CopyConstructible {};
|
||||
|
||||
template <>
|
||||
struct CopyConstructible<false> {
|
||||
CONSTEXPR CopyConstructible() {}
|
||||
CopyConstructible& operator=(const CopyConstructible&) { return *this; }
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
CONSTEXPR CopyConstructible(CopyConstructible&&) {}
|
||||
CopyConstructible& operator=(CopyConstructible&&) { return *this; }
|
||||
#endif
|
||||
private:
|
||||
CONSTEXPR CopyConstructible(const CopyConstructible&);
|
||||
};
|
||||
|
||||
template <bool is_move_constructible>
|
||||
struct MoveConstructible {};
|
||||
|
||||
template <>
|
||||
struct MoveConstructible<false> {
|
||||
CONSTEXPR MoveConstructible() {}
|
||||
CONSTEXPR MoveConstructible(const MoveConstructible&) {}
|
||||
MoveConstructible& operator=(const MoveConstructible&) { return *this; }
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
MoveConstructible& operator=(MoveConstructible&&) { return *this; }
|
||||
|
||||
private:
|
||||
CONSTEXPR MoveConstructible(MoveConstructible&&);
|
||||
#endif
|
||||
};
|
||||
|
||||
template <bool is_copy_assignable>
|
||||
struct CopyAssignable {};
|
||||
|
||||
template <>
|
||||
struct CopyAssignable<false> {
|
||||
CONSTEXPR CopyAssignable() {}
|
||||
CONSTEXPR CopyAssignable(const CopyAssignable&) {}
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
CONSTEXPR CopyAssignable(CopyAssignable&&) {}
|
||||
CopyAssignable& operator=(CopyAssignable&&) { return *this; }
|
||||
#endif
|
||||
private:
|
||||
CopyAssignable& operator=(const CopyAssignable&);
|
||||
};
|
||||
|
||||
template <bool is_move_assignable>
|
||||
struct MoveAssignable {};
|
||||
|
||||
template <>
|
||||
struct MoveAssignable<false> {
|
||||
CONSTEXPR MoveAssignable() {}
|
||||
CONSTEXPR MoveAssignable(const MoveAssignable&) {}
|
||||
MoveAssignable& operator=(const MoveAssignable&) { return *this; }
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
CONSTEXPR MoveAssignable(MoveAssignable&&) {}
|
||||
|
||||
private:
|
||||
MoveAssignable& operator=(MoveAssignable&&);
|
||||
#endif
|
||||
};
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
// Helper to conditionally enable converting constructors and assign operators.
|
||||
template <typename T, typename U>
|
||||
struct IsConvertibleFromOptional : std::integral_constant<bool, std::is_constructible<T, Optional<U>&>::value || std::is_constructible<T, const Optional<U>&>::value || std::is_constructible<T, Optional<U>&&>::value || std::is_constructible<T, const Optional<U>&&>::value || std::is_convertible<Optional<U>&, T>::value || std::is_convertible<const Optional<U>&, T>::value || std::is_convertible<Optional<U>&&, T>::value || std::is_convertible<const Optional<U>&&, T>::value> {};
|
||||
|
||||
template <typename T, typename U>
|
||||
struct IsAssignableFromOptional : std::integral_constant<bool, IsConvertibleFromOptional<T, U>::value || std::is_assignable<T&, Optional<U>&>::value || std::is_assignable<T&, const Optional<U>&>::value || std::is_assignable<T&, Optional<U>&&>::value || std::is_assignable<T&, const Optional<U>&&>::value> {};
|
||||
|
||||
// Forward compatibility for C++17.
|
||||
// Introduce one more deeper nested namespace to avoid leaking using std::swap.
|
||||
namespace swappable_impl {
|
||||
using std::swap;
|
||||
|
||||
struct IsSwappableImpl {
|
||||
// Tests if swap can be called. Check<T&>(0) returns true_type iff swap
|
||||
// is available for T. Otherwise, Check's overload resolution falls back
|
||||
// to Check(...) declared below thanks to SFINAE, so returns false_type.
|
||||
template <typename T>
|
||||
static auto Check(int) -> decltype(swap(std::declval<T>(), std::declval<T>()), std::true_type());
|
||||
|
||||
template <typename T>
|
||||
static std::false_type Check(...);
|
||||
};
|
||||
} // namespace swappable_impl
|
||||
template <typename T>
|
||||
struct IsSwappable : decltype(swappable_impl::IsSwappableImpl::Check<T&>(0)) {};
|
||||
#endif
|
||||
} // namespace internal
|
||||
|
||||
// On Windows, by default, empty-base class optimization does not work,
|
||||
// which means even if the base class is empty struct, it still consumes one
|
||||
// byte for its body. __declspec(empty_bases) enables the optimization.
|
||||
// cf)
|
||||
// https://blogs.msdn.microsoft.com/vcblog/2016/03/30/optimizing-the-layout-of-empty-base-classes-in-vs2015-update-2-3/
|
||||
#if defined(_WIN32)
|
||||
#define OPTIONAL_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
|
||||
#else
|
||||
#define OPTIONAL_DECLSPEC_EMPTY_BASES
|
||||
#endif
|
||||
|
||||
// Optional is a Chromium version of the C++17 optional class:
|
||||
// std::optional documentation:
|
||||
// http://en.cppreference.com/w/cpp/utility/optional
|
||||
// Chromium documentation:
|
||||
// https://chromium.googlesource.com/chromium/src/+/master/docs/optional.md
|
||||
//
|
||||
// These are the differences between the specification and the implementation:
|
||||
// - Constructors do not use 'constexpr' as it is a C++14 extension.
|
||||
// - 'constexpr' might be missing in some places for reasons specified locally.
|
||||
// - No exceptions are thrown, because they are banned from Chromium.
|
||||
// Marked noexcept for only move constructor and move assign operators.
|
||||
// - All the non-members are in the 'base' namespace instead of 'std'.
|
||||
//
|
||||
// Note that T cannot have a constructor T(Optional<T>) etc. Optional<T> checks
|
||||
// T's constructor (specifically via IsConvertibleFromOptional), and in the
|
||||
// check whether T can be constructible from Optional<T>, which is recursive
|
||||
// so it does not work. As of Feb 2018, std::optional C++17 implementation in
|
||||
// both clang and gcc has same limitation. MSVC SFINAE looks to have different
|
||||
// behavior, but anyway it reports an error, too.
|
||||
template <typename T>
|
||||
class OPTIONAL_DECLSPEC_EMPTY_BASES Optional : public internal::OptionalBase<T>
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
,
|
||||
public internal::CopyConstructible<std::is_copy_constructible<T>::value>,
|
||||
public internal::MoveConstructible<std::is_move_constructible<T>::value>,
|
||||
public internal::CopyAssignable<std::is_copy_constructible<T>::value && std::is_copy_assignable<T>::value>,
|
||||
public internal::MoveAssignable<std::is_move_constructible<T>::value && std::is_move_assignable<T>::value>
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
#undef OPTIONAL_DECLSPEC_EMPTY_BASES
|
||||
|
||||
typedef T value_type;
|
||||
|
||||
// Defer default/copy/move constructor implementation to OptionalBase.
|
||||
CONSTEXPR Optional() {}
|
||||
CONSTEXPR Optional(const Optional& other) : internal::OptionalBase<T>(other) {}
|
||||
|
||||
CONSTEXPR Optional(nullopt_t) {} // NOLINT(runtime/explicit)
|
||||
|
||||
// Converting copy constructor. "explicit" only if
|
||||
// std::is_convertible<const U&, T>::value is false. It is implemented by
|
||||
// declaring two almost same constructors, but that condition in enable_if_t
|
||||
// is different, so that either one is chosen, thanks to SFINAE.
|
||||
template <typename U>
|
||||
Optional(const Optional<U>& other) : internal::OptionalBase<T>(other) {}
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
// Converting move constructor. Similar to converting copy constructor,
|
||||
// declaring two (explicit and non-explicit) constructors.
|
||||
template <typename U>
|
||||
Optional(Optional<U>&& other) : internal::OptionalBase<T>(std::move(other)) {}
|
||||
|
||||
template <class... Args>
|
||||
CONSTEXPR explicit Optional(in_place_t, Args&&... args) : internal::OptionalBase<T>(in_place, std::forward<Args>(args)...) {}
|
||||
|
||||
template <class U, class... Args>
|
||||
CONSTEXPR explicit Optional(in_place_t, std::initializer_list<U> il, Args&&... args) : internal::OptionalBase<T>(in_place, il, std::forward<Args>(args)...) {}
|
||||
#else
|
||||
CONSTEXPR explicit Optional(in_place_t, const T& _value) : internal::OptionalBase<T>(in_place, _value) {}
|
||||
template <class U>
|
||||
CONSTEXPR explicit Optional(in_place_t, const U il[], const T& _value) : internal::OptionalBase<T>(in_place, il, _value) {}
|
||||
#endif
|
||||
|
||||
// Forward value constructor. Similar to converting constructors,
|
||||
// conditionally explicit.
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
template <typename U = value_type>
|
||||
CONSTEXPR Optional(U&& value) : internal::OptionalBase<T>(in_place, std::forward<U>(value)) {}
|
||||
#else
|
||||
template <typename U>
|
||||
CONSTEXPR Optional(const U& value) : internal::OptionalBase<T>(in_place, value) {}
|
||||
#endif
|
||||
|
||||
~Optional() {}
|
||||
|
||||
// Defer copy-/move- assign operator implementation to OptionalBase.
|
||||
Optional& operator=(const Optional& other) {
|
||||
if (&other == this) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
internal::OptionalBase<T>::operator=(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Optional& operator=(nullopt_t) {
|
||||
FreeIfNeeded();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Perfect-forwarded assignment.
|
||||
template <typename U>
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
Optional& operator=(U&& value) {
|
||||
InitOrAssign(std::forward<U>(value));
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
Optional& operator=(const U& value) {
|
||||
InitOrAssign(value);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Copy assign the state of other.
|
||||
template <typename U>
|
||||
Optional& operator=(const Optional<U>& other) {
|
||||
CopyAssign(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
// Move assign the state of other.
|
||||
template <typename U>
|
||||
Optional& operator=(Optional<U>&& other) {
|
||||
MoveAssign(std::move(other));
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
const T* operator->() const { return &storage_.value_; }
|
||||
|
||||
T* operator->() { return &storage_.value_; }
|
||||
|
||||
const T& operator*() const { return storage_.value_; }
|
||||
|
||||
T& operator*() { return storage_.value_; }
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
CONSTEXPR explicit operator bool() const { return storage_.is_populated_; }
|
||||
#else
|
||||
CONSTEXPR operator bool() const { return storage_.is_populated_; }
|
||||
#endif
|
||||
|
||||
CONSTEXPR bool has_value() const { return storage_.is_populated_; }
|
||||
|
||||
#if 1
|
||||
const T& value() const { return storage_.value_; }
|
||||
|
||||
template <class U>
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
CONSTEXPR T value_or(U&& default_value) const {
|
||||
// TODO(mlamouri): add the following assert when possible:
|
||||
// static_assert(std::is_copy_constructible<T>::value,
|
||||
// "T must be copy constructible");
|
||||
static_assert(std::is_convertible<U, T>::value, "U must be convertible to T");
|
||||
return storage_.is_populated_ ? value() : static_cast<T>(std::forward<U>(default_value));
|
||||
}
|
||||
#else
|
||||
CONSTEXPR T value_or(const U& default_value) const {
|
||||
return storage_.is_populated_ ? value() : static_cast<T>(default_value);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
const T& value() const& { return storage_.value_; }
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
const T&& value() const&& { return std::move(storage_.value_); }
|
||||
#endif
|
||||
|
||||
template <class U>
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
CONSTEXPR T value_or(U&& default_value) const& {
|
||||
// TODO(mlamouri): add the following assert when possible:
|
||||
// static_assert(std::is_copy_constructible<T>::value,
|
||||
// "T must be copy constructible");
|
||||
static_assert(std::is_convertible<U, T>::value, "U must be convertible to T");
|
||||
return storage_.is_populated_ ? value() : static_cast<T>(std::forward<U>(default_value));
|
||||
}
|
||||
#else
|
||||
CONSTEXPR T value_or(const U& default_value) const& {
|
||||
// TODO(mlamouri): add the following assert when possible:
|
||||
// static_assert(std::is_copy_constructible<T>::value,
|
||||
// "T must be copy constructible");
|
||||
static_assert(std::is_convertible<U, T>::value, "U must be convertible to T");
|
||||
return storage_.is_populated_ ? value() : static_cast<T>(default_value);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class U>
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
CONSTEXPR T value_or(U&& default_value) const&& {
|
||||
// TODO(mlamouri): add the following assert when possible:
|
||||
// static_assert(std::is_move_constructible<T>::value,
|
||||
// "T must be move constructible");
|
||||
static_assert(std::is_convertible<U, T>::value, "U must be convertible to T");
|
||||
return storage_.is_populated_ ? std::move(value()) : static_cast<T>(std::forward<U>(default_value));
|
||||
}
|
||||
#endif
|
||||
#endif // 1
|
||||
|
||||
void swap(Optional& other) {
|
||||
if (!storage_.is_populated_ && !other.storage_.is_populated_) return;
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
if (storage_.is_populated_ != other.storage_.is_populated_) {
|
||||
if (storage_.is_populated_) {
|
||||
other.storage_.Init(std::move(storage_.value_));
|
||||
FreeIfNeeded();
|
||||
} else {
|
||||
storage_.Init(std::move(other.storage_.value_));
|
||||
other.FreeIfNeeded();
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
using std::swap;
|
||||
swap(**this, *other);
|
||||
}
|
||||
|
||||
void reset() { FreeIfNeeded(); }
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
template <class... Args>
|
||||
T& emplace(Args&&... args) {
|
||||
FreeIfNeeded();
|
||||
storage_.Init(std::forward<Args>(args)...);
|
||||
return storage_.value_;
|
||||
}
|
||||
|
||||
template <class U, class... Args>
|
||||
T& emplace(std::initializer_list<U> il, Args&&... args) {
|
||||
FreeIfNeeded();
|
||||
storage_.Init(il, std::forward<Args>(args)...);
|
||||
return storage_.value_;
|
||||
}
|
||||
#else
|
||||
T& emplace(const T& _value) {
|
||||
FreeIfNeeded();
|
||||
storage_.Init(_value);
|
||||
return storage_.value_;
|
||||
}
|
||||
template <class U>
|
||||
T& emplace(const U il[], const T& _value) {
|
||||
FreeIfNeeded();
|
||||
storage_.Init(il, _value);
|
||||
return storage_.value_;
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
// Accessing template base class's protected member needs explicit
|
||||
// declaration to do so.
|
||||
using internal::OptionalBase<T>::CopyAssign;
|
||||
using internal::OptionalBase<T>::FreeIfNeeded;
|
||||
using internal::OptionalBase<T>::InitOrAssign;
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
using internal::OptionalBase<T>::MoveAssign;
|
||||
#endif
|
||||
using internal::OptionalBase<T>::storage_;
|
||||
};
|
||||
|
||||
// Here after defines comparation operators. The definition follows
|
||||
// http://en.cppreference.com/w/cpp/utility/optional/operator_cmp
|
||||
// while bool() casting is replaced by has_value() to meet the chromium
|
||||
// style guide.
|
||||
template <class T, class U>
|
||||
bool operator==(const Optional<T>& lhs, const Optional<U>& rhs) {
|
||||
if (lhs.has_value() != rhs.has_value()) return false;
|
||||
if (!lhs.has_value()) return true;
|
||||
return *lhs == *rhs;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
bool operator!=(const Optional<T>& lhs, const Optional<U>& rhs) {
|
||||
if (lhs.has_value() != rhs.has_value()) return true;
|
||||
if (!lhs.has_value()) return false;
|
||||
return *lhs != *rhs;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
bool operator<(const Optional<T>& lhs, const Optional<U>& rhs) {
|
||||
if (!rhs.has_value()) return false;
|
||||
if (!lhs.has_value()) return true;
|
||||
return *lhs < *rhs;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
bool operator<=(const Optional<T>& lhs, const Optional<U>& rhs) {
|
||||
if (!lhs.has_value()) return true;
|
||||
if (!rhs.has_value()) return false;
|
||||
return *lhs <= *rhs;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
bool operator>(const Optional<T>& lhs, const Optional<U>& rhs) {
|
||||
if (!lhs.has_value()) return false;
|
||||
if (!rhs.has_value()) return true;
|
||||
return *lhs > *rhs;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
bool operator>=(const Optional<T>& lhs, const Optional<U>& rhs) {
|
||||
if (!rhs.has_value()) return true;
|
||||
if (!lhs.has_value()) return false;
|
||||
return *lhs >= *rhs;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
CONSTEXPR bool operator==(const Optional<T>& opt, nullopt_t) {
|
||||
return !opt;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
CONSTEXPR bool operator==(nullopt_t, const Optional<T>& opt) {
|
||||
return !opt;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
CONSTEXPR bool operator!=(const Optional<T>& opt, nullopt_t) {
|
||||
return opt.has_value();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
CONSTEXPR bool operator!=(nullopt_t, const Optional<T>& opt) {
|
||||
return opt.has_value();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
CONSTEXPR bool operator<(const Optional<T>& opt, nullopt_t) {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
CONSTEXPR bool operator<(nullopt_t, const Optional<T>& opt) {
|
||||
return opt.has_value();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
CONSTEXPR bool operator<=(const Optional<T>& opt, nullopt_t) {
|
||||
return !opt;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
CONSTEXPR bool operator<=(nullopt_t, const Optional<T>& opt) {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
CONSTEXPR bool operator>(const Optional<T>& opt, nullopt_t) {
|
||||
return opt.has_value();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
CONSTEXPR bool operator>(nullopt_t, const Optional<T>& opt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
CONSTEXPR bool operator>=(const Optional<T>& opt, nullopt_t) {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
CONSTEXPR bool operator>=(nullopt_t, const Optional<T>& opt) {
|
||||
return !opt;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
CONSTEXPR bool operator==(const Optional<T>& opt, const U& value) {
|
||||
return opt.has_value() ? *opt == value : false;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
CONSTEXPR bool operator==(const U& value, const Optional<T>& opt) {
|
||||
return opt.has_value() ? value == *opt : false;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
CONSTEXPR bool operator!=(const Optional<T>& opt, const U& value) {
|
||||
return opt.has_value() ? *opt != value : true;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
CONSTEXPR bool operator!=(const U& value, const Optional<T>& opt) {
|
||||
return opt.has_value() ? value != *opt : true;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
CONSTEXPR bool operator<(const Optional<T>& opt, const U& value) {
|
||||
return opt.has_value() ? *opt < value : true;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
CONSTEXPR bool operator<(const U& value, const Optional<T>& opt) {
|
||||
return opt.has_value() ? value < *opt : false;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
CONSTEXPR bool operator<=(const Optional<T>& opt, const U& value) {
|
||||
return opt.has_value() ? *opt <= value : true;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
CONSTEXPR bool operator<=(const U& value, const Optional<T>& opt) {
|
||||
return opt.has_value() ? value <= *opt : false;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
CONSTEXPR bool operator>(const Optional<T>& opt, const U& value) {
|
||||
return opt.has_value() ? *opt > value : false;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
CONSTEXPR bool operator>(const U& value, const Optional<T>& opt) {
|
||||
return opt.has_value() ? value > *opt : true;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
CONSTEXPR bool operator>=(const Optional<T>& opt, const U& value) {
|
||||
return opt.has_value() ? *opt >= value : false;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
CONSTEXPR bool operator>=(const U& value, const Optional<T>& opt) {
|
||||
return opt.has_value() ? value >= *opt : true;
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||
template <class T, class... Args>
|
||||
CONSTEXPR Optional<T> make_optional(Args&&... args) {
|
||||
return Optional<T>(in_place, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <class T, class U, class... Args>
|
||||
CONSTEXPR Optional<T> make_optional(std::initializer_list<U> il, Args&&... args) {
|
||||
return Optional<T>(in_place, il, std::forward<Args>(args)...);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Partial specialization for a function template is not allowed. Also, it is
|
||||
// not allowed to add overload function to std namespace, while it is allowed
|
||||
// to specialize the template in std. Thus, swap() (kind of) overloading is
|
||||
// defined in base namespace, instead.
|
||||
template <class T>
|
||||
void swap(Optional<T>& lhs, Optional<T>& rhs) {
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
} // namespace agora
|
||||
|
||||
#undef CONSTEXPR
|
||||
#undef NOEXCEPT
|
34
core/libs/include/IAgoraLog.h
Normal file
34
core/libs/include/IAgoraLog.h
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// Agora Media SDK
|
||||
//
|
||||
// Copyright (c) 2015 Agora IO. All rights reserved.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace agora {
|
||||
namespace commons {
|
||||
/*
|
||||
The SDK uses ILogWriter class Write interface to write logs as application
|
||||
The application inherits the methods Write() to implentation their own log writ
|
||||
|
||||
Write has default implementation, it writes logs to files.
|
||||
Application can use setLogFile() to change file location, see description of set
|
||||
*/
|
||||
class ILogWriter {
|
||||
public:
|
||||
/** user defined log Write function
|
||||
@param message message content
|
||||
@param length message length
|
||||
@return
|
||||
- 0: success
|
||||
- <0: failure
|
||||
*/
|
||||
virtual int32_t writeLog(const char* message, uint16_t length) = 0;
|
||||
virtual ~ILogWriter() {}
|
||||
};
|
||||
|
||||
} // namespace commons
|
||||
} // namespace agora
|
1098
core/libs/include/IAgoraMediaEngine.h
Normal file
1098
core/libs/include/IAgoraMediaEngine.h
Normal file
File diff suppressed because it is too large
Load Diff
1863
core/libs/include/IAgoraRtcChannel.h
Normal file
1863
core/libs/include/IAgoraRtcChannel.h
Normal file
File diff suppressed because it is too large
Load Diff
11913
core/libs/include/IAgoraRtcEngine.h
Normal file
11913
core/libs/include/IAgoraRtcEngine.h
Normal file
File diff suppressed because it is too large
Load Diff
73
core/libs/include/IAgoraService.h
Normal file
73
core/libs/include/IAgoraService.h
Normal file
@@ -0,0 +1,73 @@
|
||||
// Agora SDK
|
||||
//
|
||||
// Copyright (c) 2019 Agora.io. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef AGORA_SERVICE_H
|
||||
#define AGORA_SERVICE_H
|
||||
#include "AgoraBase.h"
|
||||
|
||||
namespace agora {
|
||||
namespace rtc {
|
||||
class IRtcEngine;
|
||||
}
|
||||
namespace rtm {
|
||||
class IRtmService;
|
||||
}
|
||||
namespace base {
|
||||
|
||||
struct AgoraServiceContext {};
|
||||
|
||||
class IAgoraService {
|
||||
protected:
|
||||
virtual ~IAgoraService() {}
|
||||
|
||||
public:
|
||||
AGORA_CPP_API static void release();
|
||||
|
||||
/** Initializes the engine.
|
||||
|
||||
@param context RtcEngine context.
|
||||
@return
|
||||
- 0: Success.
|
||||
- < 0: Failure.
|
||||
*/
|
||||
virtual int initialize(const AgoraServiceContext& context) = 0;
|
||||
|
||||
/** Gets the SDK version number.
|
||||
* @param build Build number.
|
||||
* @return The current SDK version in the string format. For example, 2.4.0
|
||||
*/
|
||||
virtual const char* getVersion(int* build) = 0;
|
||||
|
||||
virtual rtm::IRtmService* createRtmService() = 0;
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
} // namespace agora
|
||||
|
||||
/** Gets the SDK version number.
|
||||
|
||||
@param build Build number of the Agora SDK.
|
||||
@return
|
||||
- 0: Success.
|
||||
- < 0: Failure.
|
||||
*/
|
||||
AGORA_API const char* AGORA_CALL getAgoraSdkVersion(int* build);
|
||||
|
||||
/**
|
||||
* Creates the RtcEngine object and returns the pointer.
|
||||
* @param err Error code
|
||||
* @return returns Description of the error code
|
||||
*/
|
||||
AGORA_API const char* AGORA_CALL getAgoraSdkErrorDescription(int err);
|
||||
|
||||
/**
|
||||
* Creates the Agora Service object and returns the pointer.
|
||||
* @return returns Pointer of the Agora Service object
|
||||
*/
|
||||
AGORA_API agora::base::IAgoraService* AGORA_CALL createAgoraService();
|
||||
|
||||
AGORA_API int AGORA_CALL setAgoraSdkExternalSymbolLoader(void* (*func)(const char* symname));
|
||||
|
||||
#endif
|
BIN
core/libs/x86/libagora-core.so
Normal file
BIN
core/libs/x86/libagora-core.so
Normal file
Binary file not shown.
BIN
core/libs/x86/libagora-rtc-sdk.so
Normal file
BIN
core/libs/x86/libagora-rtc-sdk.so
Normal file
Binary file not shown.
BIN
core/libs/x86/libagora-soundtouch.so
Normal file
BIN
core/libs/x86/libagora-soundtouch.so
Normal file
Binary file not shown.
BIN
core/libs/x86/libagora_ai_denoise_extension.so
Normal file
BIN
core/libs/x86/libagora_ai_denoise_extension.so
Normal file
Binary file not shown.
BIN
core/libs/x86/libagora_fdkaac.so
Normal file
BIN
core/libs/x86/libagora_fdkaac.so
Normal file
Binary file not shown.
BIN
core/libs/x86/libagora_full_audio_format_extension.so
Normal file
BIN
core/libs/x86/libagora_full_audio_format_extension.so
Normal file
Binary file not shown.
BIN
core/libs/x86/libagora_mpg123.so
Normal file
BIN
core/libs/x86/libagora_mpg123.so
Normal file
Binary file not shown.
BIN
core/libs/x86/libagora_spatial_audio_extension.so
Normal file
BIN
core/libs/x86/libagora_spatial_audio_extension.so
Normal file
Binary file not shown.
BIN
core/libs/x86_64/libagora-core.so
Normal file
BIN
core/libs/x86_64/libagora-core.so
Normal file
Binary file not shown.
BIN
core/libs/x86_64/libagora-rtc-sdk.so
Normal file
BIN
core/libs/x86_64/libagora-rtc-sdk.so
Normal file
Binary file not shown.
BIN
core/libs/x86_64/libagora-soundtouch.so
Normal file
BIN
core/libs/x86_64/libagora-soundtouch.so
Normal file
Binary file not shown.
BIN
core/libs/x86_64/libagora_ai_denoise_extension.so
Normal file
BIN
core/libs/x86_64/libagora_ai_denoise_extension.so
Normal file
Binary file not shown.
BIN
core/libs/x86_64/libagora_fdkaac.so
Normal file
BIN
core/libs/x86_64/libagora_fdkaac.so
Normal file
Binary file not shown.
BIN
core/libs/x86_64/libagora_full_audio_format_extension.so
Normal file
BIN
core/libs/x86_64/libagora_full_audio_format_extension.so
Normal file
Binary file not shown.
BIN
core/libs/x86_64/libagora_mpg123.so
Normal file
BIN
core/libs/x86_64/libagora_mpg123.so
Normal file
Binary file not shown.
BIN
core/libs/x86_64/libagora_spatial_audio_extension.so
Normal file
BIN
core/libs/x86_64/libagora_spatial_audio_extension.so
Normal file
Binary file not shown.
Reference in New Issue
Block a user