|
IoT SDK for Linux v1.9.7
|
#include <stdint.h>#include <stddef.h>#include <stdbool.h>Go to the source code of this file.
Data Structures | |
| struct | video_frame_info_t |
| struct | audio_frame_info_t |
| struct | log_config_t |
| struct | rtc_service_option_t |
| struct | audio_codec_option_t |
| struct | crypto_option_t |
| struct | rtc_channel_options_t |
| struct | rdt_status_info |
| struct | connection_info_t |
| struct | user_info_s |
| struct | agora_rtc_event_handler_t |
| struct | agora_rtm_handler_t |
Macros | |
| #define | __agora_api__ |
| #define | AGORA_RTC_CHANNEL_NAME_MAX_LEN (64) |
| #define | AGORA_RTC_PRODUCT_ID_MAX_LEN (63) |
| #define | AGORA_RTC_USER_ACCOUNT_MAX_LEN (256) |
| #define | AGORA_RTC_DATA_STREAM_MAX_LEN (1024) |
| #define | AGORA_RTM_UID_MAX_LEN (64) |
| #define | AGORA_RTM_DATA_MAX_LEN (31 * 1024) |
| #define | AGORA_CREDENTIAL_MAX_LEN (256) |
| #define | AGORA_CERTIFICATE_MAX_LEN (1024) |
| #define | AGORA_LICENSE_VALUE_LEN (32) |
| #define | CONNECTION_ID_ALL ((connection_id_t)0) |
| #define | CONNECTION_ID_INVALID ((connection_id_t)-1) |
Typedefs | |
| typedef uint16_t | video_frame_rate_e |
| typedef enum rdt_stream_type | rdt_stream_type_e |
| typedef enum rdt_state | rdt_state_e |
| typedef struct rdt_status_info | rdt_status_info_t |
| typedef uint32_t | connection_id_t |
| typedef struct user_info_s | user_info_t |
| #define __agora_api__ |
| #define AGORA_CERTIFICATE_MAX_LEN (1024) |
| #define AGORA_CREDENTIAL_MAX_LEN (256) |
| #define AGORA_LICENSE_VALUE_LEN (32) |
| #define AGORA_RTC_CHANNEL_NAME_MAX_LEN (64) |
| #define AGORA_RTC_DATA_STREAM_MAX_LEN (1024) |
| #define AGORA_RTC_PRODUCT_ID_MAX_LEN (63) |
| #define AGORA_RTC_USER_ACCOUNT_MAX_LEN (256) |
| #define AGORA_RTM_DATA_MAX_LEN (31 * 1024) |
| #define AGORA_RTM_UID_MAX_LEN (64) |
| #define CONNECTION_ID_ALL ((connection_id_t)0) |
Special connection id
| #define CONNECTION_ID_INVALID ((connection_id_t)-1) |
An invalid connection ID.
| typedef uint32_t connection_id_t |
Connection identification
| typedef enum rdt_state rdt_state_e |
Reliable Data Transmission tunnel state
| typedef struct rdt_status_info rdt_status_info_t |
Reliable Data Transmission tunnel status info
| typedef enum rdt_stream_type rdt_stream_type_e |
Reliable Data Transmission Tunnel message type
| typedef struct user_info_s user_info_t |
User information for a string user ID scenario.
| typedef uint16_t video_frame_rate_e |
Deprecated video frame rate type.
| enum agora_err_code_e |
Error code.
| Enumerator | |
|---|---|
| ERR_OKAY | No error. |
| ERR_FAILED | General error |
| ERR_INVALID_PARAM | 2: An invalid parameter is passed, for example, a channel name containing illegal characters. Reset the parameter. |
| ERR_INVALID_STATE | 3: The API call is invalid in the current state, for example, publishing audio or video after local capture is disabled. |
| ERR_NOT_SUPPORTED | 4: The operation is not supported in the current state. |
| ERR_NOT_IN_CHANNEL | 6: The connection has not successfully joined a channel. |
| ERR_NOT_INITIALIZED | 7: The service is not initialized. Call agora_rtc_init first. |
| ERR_NOT_EXIST_CONNECTION | 8: The connection does not exist. |
| ERR_TIMEDOUT | An API 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_NO_MEMORY | 11: Insufficient memory. |
| ERR_CALL_FAILED | 12: The API call failed. |
| ERR_NET_DOWN | 14: The network is unavailable. Check the system network connection. |
| ERR_JOIN_CHANNEL_REJECTED | Request to join channel is rejected. It occurs when local user is already in channel and try to join the same channel again. |
| ERR_LEAVE_CHANNEL_REJECTED | Request to leave channel is rejected. It occurs when local user is already not in channel and try to leave the channel. |
| ERR_LICENSE_VERIFICATION_FAILURE | 23: SDK initialization failed because license validation failed. This error is reported only for legacy licenses. |
| ERR_ENCRYPTION | 30: An encryption error occurred. |
| ERR_DECRYPTION | 31: A decryption error occurred. |
| ERR_INVALID_APP_ID | 101: The App ID is invalid. Replace it with a valid App ID and join the channel again. |
| ERR_INVALID_CHANNEL_NAME | 102: The channel name is invalid. The parameter may have the wrong data type. Use a valid channel name and join the channel again. |
| ERR_NO_SERVER_RESOURCES | 103: Failed to obtain server resources in the specified region. |
| ERR_LOOKUP_CHANNEL_REJECTED | 105: The Agora server rejected the channel lookup request. Check whether the RTC token is valid. |
| ERR_OPEN_CHANNEL_REJECTED | 107: The Agora server rejected the request to open the channel. Check whether the RTC token is valid. |
| ERR_TOKEN_EXPIRED | 109: The RTC token has expired. Generate a new RTC token on your server and call agora_rtc_join_channel to rejoin the channel with it. The token may expire for either of the following reasons:
|
| ERR_INVALID_TOKEN | Token is invalid due to reasons belows:
|
| ERR_DYNAMIC_TOKEN_BUT_USE_STATIC_KEY | 115: Token authentication is enabled, but an App ID was passed to the join method instead of a token. Pass a valid token when calling agora_rtc_join_channel. |
| ERR_SET_CLIENT_ROLE_NOT_AUTHORIZED | 119: Failed to switch the user role. Try joining the channel again. |
| ERR_DECRYPTION_FAILED | 120: Decryption failed. The user may have used a different encryption password to join the channel. Check your settings or try rejoining the channel. |
| ERR_OPEN_CHANNEL_INVALID_TICKET | 121: A signaling error occurred while opening the channel. Try joining the channel again. |
| ERR_OPEN_CHANNEL_TRY_NEXT_VOS | 122: The system is switching servers. No additional action is usually required because the system automatically tries another server to open the channel. |
| ERR_CLIENT_IS_BANNED_BY_SERVER | 123: The server banned this client. Check whether the license is valid. |
| ERR_AUDIO_CODEC_NOT_SUPPORT | 200: The SDK does not support the selected audio codec. |
| ERR_AUDIO_INVALID_PCM_LEN | 201: The PCM audio data length is invalid. |
| ERR_AUDIO_INVALID_CODEC_PARAM | 202: The audio codec parameter is invalid. |
| ERR_VIDEO_SEND_OVER_BANDWIDTH_LIMIT | Sending video data too fast and over the bandwidth limit. Very likely that packet loss occurs with this sending speed. |
| ERR_VIDEO_SEND_PACKETIZE_FAILED | 301: Failed to packetize the video packet. |
| ERR_RDT_USER_NOT_EXIST | 600: The user does not exist. |
| ERR_RDT_USER_NOT_READY | 601: The user is not ready. |
| ERR_RDT_DATA_BLOCKED | 602: The data is blocked. |
| ERR_RDT_CMD_EXCEED_LIMIT | 603: The command exceeds the limit. |
| ERR_RDT_DATA_EXCEED_LIMIT | 604: The data message size exceeds the limit. |
| ERR_TOO_MANY_DATA_STREAMS | 621: Too many data streams have been created. |
| ERR_DATA_STREAM_SIZE_TOO_LARGE | 622: The data stream size exceeds 1 KB. |
| ERR_NOT_EXIST_STREAM_ID | 623: The specified data stream ID does not exist. |
| ERR_DATA_STREAM_BITRATE_LIMIT | 624: The data stream bitrate exceeds the 6 Kbps limit. |
| ERR_DATA_STREAM_SEND_TOO_OFTEN | 625: Data stream packets are sent too frequently, exceeding the limit of 60 packets per second. |
| ERR_DATA_STREAM_TIME_OUT | 626: The connection to the remote user receiving the data stream timed out. |
| ERR_RTM_NOT_LOGINED | 1001: The user is not logged in to RTM. |
| ERR_RTM_HAD_LOGINED | 1002: The user is already logged in to RTM. |
| ERR_RTM_SEND_TO_SELF | 1003: The local user's own user ID was specified in rtmUid. |
| ERR_RTM_EXCEED_MSG_SIZE | 1004: The RTM message exceeds the maximum length of 31 KB. |
| ERR_RTM_EXCEED_MSG_CNT | 1005: The RTM message rate exceeds the limit of 60 messages per second. |
| ERR_RTM_EXCEED_SND_BUFFER | 1006: The message channel is full. Wait one second and try again. |
| enum area_code_e |
region code
| Enumerator | |
|---|---|
| AREA_CODE_DEFAULT | The same as AREA_CODE_GLOB: the global region. |
| AREA_CODE_CN | Mainland China. |
| AREA_CODE_NA | North America. |
| AREA_CODE_EU | Europe. |
| AREA_CODE_AS | Asia, excluding Mainland China. |
| AREA_CODE_JP | Japan. |
| AREA_CODE_IN | India. |
| AREA_CODE_GLOB | The global region (default). |
| enum audio_codec_type_e |
Audio codec type list.
| enum audio_data_type_e |
Audio data type list.
| enum crypto_mode_e |
Encryption mode.
Agora recommends AES_128_GCM2 or AES_256_GCM2 because these modes support a salt and provide stronger security.
| enum license_err_reason_e |
Error codes for device license validation failures.
| Enumerator | |
|---|---|
| ERR_LICENSE_INVALID | 1: The license is invalid. Call agora_rtc_init again and provide a valid license in the license_value member of rtc_service_option_t. |
| ERR_LICENSE_EXPIRE | 2: License expired |
| ERR_LICENSE_MINUTES_EXCEED | 3: The license has no remaining call minutes. Contact sales.nosp@m.@she.nosp@m.ngwan.nosp@m.g.cn to purchase a license with additional minutes. |
| ERR_LICENSE_LIMITED_PERIOD | 4: Calls are not allowed during the current time period. Use the service during a period permitted by the license, or contact sales.nosp@m.@she.nosp@m.ngwan.nosp@m.g.cn to purchase a license with a longer permitted period. |
| ERR_LICENSE_DIFF_DEVICES | 5: The license is already in use on another device. A license can be used on only one device. Call agora_rtc_init again and provide a new license in the license_value member of rtc_service_option_t. |
| ERR_LICENSE_INTERNAL | 99: SDK internal error |
| enum rdt_state |
Reliable Data Transmission tunnel state
| Enumerator | |
|---|---|
| RDT_STATE_CLOSED | The initial state. The RDT channel is not connected, and the user cannot send or receive RDT messages. |
| RDT_STATE_OPENED | The RDT channel is connected, and the user can send and receive RDT messages. |
| RDT_STATE_BLOCKED | The RDT channel's send buffer is full. The user cannot send data messages (RDT_STREAM_DATA), but can still send control messages (RDT_STREAM_CMD). |
| RDT_STATE_PENDING | The SDK is reconnecting the RDT channel.
|
| RDT_STATE_BROKEN | The RDT channel connection is broken and the SDK attempts to reconnect. The SDK clears buffered send and receive data whether reconnection succeeds or fails. |
| enum rdt_stream_type |
Reliable Data Transmission Tunnel message type
| enum rtc_log_level_e |
The definition of log level enum
| enum rtm_err_code_e |
RTM error code
| enum rtm_event_type_e |
RTM RTM event type list
| Enumerator | |
|---|---|
| RTM_EVENT_TYPE_LOGIN | 0: LOGIN |
| RTM_EVENT_TYPE_KICKOFF | 1: KICKOFF |
| RTM_EVENT_TYPE_EXIT | 2: The user exits the RTM service. Possible causes include:
The SDK automatically reconnects and restores the login when reconnection succeeds. |
| enum rtm_msg_state_e |
RTM message send state
The definition of the user_offline_reason_e enum.
| enum video_data_type_e |
The definition of the video_data_type_e enum.
| enum video_frame_type_e |
The definition of the video_frame_type_e enum.
| Enumerator | |
|---|---|
| VIDEO_FRAME_AUTO_DETECT | 0: unknow frame type If you set it ,the SDK will judge the frame type |
| VIDEO_FRAME_KEY | 3: key frame |
| VIDEO_FRAME_DELTA | 4: A delta frame, such as a P-frame. |
| enum video_orientation_e |
Rotation of an encoded video frame.
| enum video_stream_type_e |
|
extern |
Sets the log file configuration.
| [in] | size_per_file | The size (bytes) of each log file. The value range is [0, 10*1024*1024(10MB)], default 1*1024*1024(1MB). 0 means set log off |
| [in] | max_file_count | The maximum number of log files. The value range is [0, 100], default 10. 0 means set log off |
|
extern |
Creates a connection.
Create a connection before joining a channel. Create multiple connections to join different channels with one user ID or to join one channel with different user IDs.
| [out] | conn_id | The created connection ID. |
|
extern |
Creates a data stream.
Each user can create up to five data streams during a connection lifecycle.
| [in] | conn_id | Connection identification. |
| [out] | stream_id | Pointer to the generated stream ID. |
| [in] | reliable | Whether to provide limited reliability through packet-loss detection and retransmission for five seconds: true enables it; false disables it. |
| [in] | ordered | Whether receivers obtain messages in sending order: true preserves order; false does not. |
|
extern |
Destroys a connection.
| [in] | conn_id | Connection ID. Set to CONNECTION_ID_ALL to target all created connections. See agora_rtc_create_connection. |
|
extern |
Convert error code to const static string.
| [in] | err | Error code |
|
extern |
Releases all RTSA service resources allocated by agora_rtc_init.
|
extern |
Gets connection information.
| [in] | conn_id | Connection ID. Set to CONNECTION_ID_ALL to target all created connections. See agora_rtc_create_connection. |
| [out] | conn_info | Connection information. See connection_info_t. |
|
extern |
Gets information about an RDT channel.
The returned state and buffer sizes indicate whether the remote user has received all RDT messages and whether more messages can be sent. For example, a send_queue_size of 0 means that the remote user has received all queued messages.
| [in] | conn_id | Connection identification. |
| [in] | remote_uid | Remote user ID. |
| [out] | info | RDT channel information. See rdt_status_info_t. |
|
extern |
Gets user information by integer user ID.
| [in] | conn_id | : Connection identification |
| [in] | uid | : user id |
| [out] | user | User information. See user_info_t. |
|
extern |
Gets user information by user account.
| [in] | conn_id | : Connection identification |
| [in] | user_account | : user account |
| [out] | user | User information. See user_info_t. |
|
extern |
Get SDK version.
|
extern |
Initializes the RTSA service.
| [in] | app_id | App ID issued by Agora. |
| [in] | event_handler | Event callbacks. See agora_rtc_event_handler_t. |
| [in] | option | Service options. Set to NULL if no options are required. See rtc_service_option_t. |
|
extern |
Joins the RTC channel associated with a connection.
Users in the same channel with the same App ID can exchange data.
| [in] | conn_id | Connection identification. Set to CONNECTION_ID_ALL to target all created connections. |
| [in] | channel_name | : Channel name Length=strlen(channel_name) should be less than 64 bytes. Supported character scopes are:
|
| [in] | uid | : User ID. A 32-bit unsigned integer with a value ranging from 1 to 2^32-1. The uid must be unique. If a uid is set to 0, the SDK assigns and returns a uid in the on_join_channel_success callback. Your application must record and maintain the returned uid, because the SDK does not do so. |
| [in] | token | RTC token used for authentication. Set it to NULL for App ID authentication. For App ID and token authentication, pass a server-generated token. See RTC token authentication. RTSA Lite SDK v1.8.0 and later support AccessToken2; earlier versions support AccessToken. |
| [in] | options | Channel options. See rtc_channel_options_t. |
|
extern |
Joins the RTC channel associated with a connection by using a user account.
| [in] | conn_id | : Connection identification |
| [in] | channel_name | : Channel name Length=strlen(channel_name) should be less than 64 bytes, Supported character scopes are:
|
| [in] | user_account | : The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are:
|
| [in] | token | RTC token used for authentication. Set it to NULL for App ID authentication. For App ID and token authentication, pass a server-generated token. See RTC token authentication. RTSA Lite SDK v1.8.0 and later support AccessToken2; earlier versions support AccessToken. |
| [in] | options | Channel options. See rtc_channel_options_t. |
|
extern |
Leaves the RTC channel associated with a connection.
Leave a channel after data transmission to that channel stops.
| [in] | conn_id | Connection identification. Set to CONNECTION_ID_ALL to target all connections created by agora_rtc_create_connection. |
|
extern |
Generates the credential that uniquely identifies the device.
| [out] | credential | Buffer that receives the credential. |
| [in,out] | credential_len | On input, the available buffer size in bytes, which must be greater than AGORA_CREDENTIAL_MAX_LEN; on output, the actual credential length in bytes. |
|
extern |
Gets the license error description.
| [in] | err | Error code. |
|
extern |
Authenticates the SDK.
When the Agora License mechanism is enabled, a device can join an Agora channel and transfer data only after its certificate is validated.
| [in] | certificate | License certificate. |
| [in] | certificate_len | Certificate length. |
| [in] | credential | Device credential. |
| [in] | credential_len | Credential length. |
|
extern |
Logs in to the Agora RTM service.
| [in] | rtm_uid | RTM user id (different from uid) Length should be less than 64 bytes Supported character scopes are:
|
| [in] | rtm_token | RTM token generated by the token server. Set it to NULL when token authentication is disabled; the literal string "NULL" is not a valid user ID or token.
|
| [in] | handler | RTM event callbacks. See agora_rtm_handler_t. |
|
extern |
Logout agora RTM service
|
extern |
Pauses or resumes sending local audio in a specific channel or all channels.
| [in] | conn_id | Connection identification. Set to CONNECTION_ID_ALL for all connections created by agora_rtc_create_connection. |
| [in] | mute | Toggle sending local audio
|
|
extern |
Pauses or resumes sending local video in a specific channel or all channels.
| [in] | conn_id | Connection identification. Set to CONNECTION_ID_ALL for all connections created by agora_rtc_create_connection. |
| [in] | mute | Toggle sending local video
|
|
extern |
Pauses or resumes receiving audio from a remote user in a specific channel or all channels.
| [in] | conn_id | Connection identification. Set to CONNECTION_ID_ALL for all connections created by agora_rtc_create_connection. |
| [in] | remote_uid | Remote user ID
|
| [in] | mute | Toggle receiving remote audio
|
|
extern |
Pauses or resumes receiving video from a remote user in a specific channel or all channels. You can pause video in all channels and then resume it for a selected channel.
| [in] | conn_id | Connection identification. Set to CONNECTION_ID_ALL for all connections created by agora_rtc_create_connection. |
| [in] | remote_uid | Remote user ID
|
| [in] | mute | Toggle receiving remote video
|
|
extern |
Renews the token for a specific channel or all channels.
| [in] | conn_id | Connection identification. Set to CONNECTION_ID_ALL to target all connections created by agora_rtc_create_connection. |
| [in] | token | Token string, strlen(token) Range is [32, 512] |
|
extern |
Requests a keyframe for a specified remote video stream.
| [in] | conn_id | Connection identification. Set to CONNECTION_ID_ALL for all connections created by agora_rtc_create_connection. |
| [in] | remote_uid | Remote user ID
|
| [in] | stream_type | Video stream type. See video_stream_type_e. |
|
extern |
Send an audio frame to all channels OR specific channel. All remote users in this channel will receive the audio frame.
| [in] | conn_id | Connection identification. Set to CONNECTION_ID_ALL for all connections created by agora_rtc_create_connection. |
| [in] | data_ptr | Audio frame buffer |
| [in] | data_len | Audio frame buffer length (bytes) |
| [in] | info_ptr | Audio frame info, see audio_frame_info_t |
|
extern |
Sends a message to all channels or a specified channel.
All remote users in this channel will receive the message.
| [in] | conn_id | Connection identification |
| [in] | remote_uid | Remote user ID
|
| [in] | payload | Message's payload buffer |
| [in] | length | Message payload length, up to 1 KB. On success, remote users receive on_media_ctrl_msg. |
|
extern |
Sends an RDT (Reliable Data Transmission) message.
For reliable scenarios such as file transfer and download:
The remote user receives on_rdt_msg. Call agora_rtc_get_rdt_status_info to inspect delivery and buffer status.
| [in] | conn_id | Connection identification. |
| [in] | remote_uid | Remote user ID. |
| [in] | type | RDT message type. See rdt_stream_type_e. Enable it by setting enable_rdt in rtc_channel_options_t before calling agora_rtc_send_rdt_msg. |
| [in] | msg | Message payload. |
| [in] | length | Message length. |
|
extern |
Sends a message through the RTM service.
RTM transport is always protected with TLS and cannot be disabled.
| [in] | rtm_uid | RTM user ID. |
| [in] | msg | UTF-8 message content. |
| [in] | msg_len | Message length in bytes, up to 31 KB. |
| [in] | msg_id | Message ID. |
|
extern |
Sends a data-stream message to all users in a channel.
Call this method after agora_rtc_create_data_stream. The remote users receive on_stream_message.
| [in] | conn_id | Connection identification. |
| [in] | stream_id | Stream ID returned by agora_rtc_create_data_stream. |
| [in] | data | Data to send. |
| [in] | length | Data length. |
|
extern |
Send a video frame to all channels OR specific channel. All remote users in the channel will receive the video frame.
| [in] | conn_id | Connection identification. Set to CONNECTION_ID_ALL for all connections created by agora_rtc_create_connection. |
| [in] | data_ptr | Video frame buffer |
| [in] | data_len | Video frame buffer length (bytes) |
| [in] | info_ptr | Video frame information. See video_frame_info_t. |
|
extern |
Sets bandwidth estimation (BWE) parameters.
| [in] | conn_id | Connection identification. Set to CONNECTION_ID_ALL for all connections created by agora_rtc_create_connection. |
| [in] | min_bps | : bwe min bps |
| [in] | max_bps | : bwe max bps |
| [in] | start_bps | : bwe start bps |
|
extern |
Sets the SDK log level. The SDK outputs messages at this level and all more severe levels.
| [in] | level | Log level. See rtc_log_level_e. |
|
extern |
Configures technical-preview or customized SDK functionality with JSON. JSON options are not public by default.
| [in] | conn_id | Connection identification. Set to CONNECTION_ID_ALL (0) for all connections. |
| [in] | params | Configuration parameters represented as JSON. |