Skip to main content
SDK Introduction

Linux C++ SDK

AOQ Client SDK Linux C++ API reference

This topic describes the C++ APIs, callbacks, and data types of AOQ Client SDK for Linux.

API index

Engine lifecycle

APIDescription
createEngineCreate the engine instance (static method, singleton)
destroyDestroy the engine instance (static method)
getVersionGet the SDK version (static method)
connectConnect to the relay server
disconnectDisconnect from the server

Audio device management

APIDescription
startAudioCaptureOpen the audio capture device (an empty implementation on Linux)
stopAudioCaptureClose the audio capture device (no effect on Linux)
muteAudioCaptureMute or unmute audio capture
startAudioPlayerStart audio rendering (empty implementation on Linux)
stopAudioPlayerStop audio rendering (no effect on Linux)
pauseAudioPlayerPause audio rendering, with fade-out supported
resumeAudioPlayerResume audio rendering, with fade-in supported
interruptAudioPlayerInterrupt the current audio playback

Audio codec configuration

APIDescription
setAudioEncoderConfigSet audio encoding parameters
setAudioDecoderConfigSet audio decoding parameters

Video device management

APIDescription
startVideoCaptureOpen the video capture device (only external capture mode is supported on Linux)
stopVideoCaptureClose the video capture device
setLocalViewSet or remove the local video rendering window (no rendering implementation on Linux)
setRemoteViewSet or remove the remote video rendering window (no rendering implementation on Linux)

Video codec and external input

APIDescription
setVideoEncoderConfigSet video encoding parameters
setVideoDecoderConfigSet video decoding parameters (a codec proposal on the subscribing side)
pushExternalVideoCapturedFramePush an externally captured video frame
pushExternalVideoEncodedFramePush an externally encoded video frame

Media stream control

APIDescription
enableSendMediaStreamEnable or disable sending of a local media stream

Audio file playback

APIDescription
startAudioFileStart playing a local audio file to the publishing stream
stopAudioFileStop audio file playback
pauseAudioFilePause audio file playback
resumeAudioFileResume audio file playback
getAudioFileDurationQuery the total duration of the audio file
getAudioFileCurrentPositionQuery the current playback position of the audio file
setAudioFilePositionMillisSet the playback position of the audio file (seek)
setAudioFileVolumeSet the volume of the audio file
getAudioFileVolumeQuery the current volume of the audio file

External audio streams

APIDescription
addAudioExternalStreamAdd an external audio stream
pushAudioExternalStreamDataFeed external audio PCM data
setAudioExternalStreamVolumeSet the volume of an external audio stream
getAudioExternalStreamVolumeQuery the volume of an external audio stream
clearAudioExternalStreamBufferClear the buffer of an external audio stream
removeAudioExternalStreamRemove an external audio stream

Real-time messaging

APIDescription
sendDataMsgSend a real-time data message

Audio frame callbacks

APIDescription
setAudioFrameObserverRegister the audio frame data listener (pure virtual)
enableAudioFrameObserverEnable or disable the audio frame callback at a specified position (pure virtual)

Local volume indication

APIDescription
enableLocalAudioVolumeIndicationEnable or disable the local capture volume indication callback

Video frame callbacks

APIDescription
setVideoFrameObserverRegister the video frame data listener (pure virtual)
enableVideoFrameObserverEnable or disable the video frame callback at a specified position (pure virtual)

AoqEngineEventListener callbacks

CallbackDescription
onErrorEngine error callback
onWarningEngine warning callback
onConnectionStatusChangeConnection status change callback
onStatsEngine statistics callback
onAudioDeviceStateChangedAudio device operation status change callback
onAudioDeviceRouteChangedAudio output route change callback (not triggered on Linux)
onAudioFileStateAudio file playback status callback
onLocalAudioVolumeIndicationLocal capture volume indication callback
onVideoDeviceStateChangedVideo device operation status change callback
onDataMsgCallback for a received real-time data message

Frame data listener interfaces

APIDescription
IAudioFrameObserverInterface for audio frame data listening (four pure virtual callbacks)
IVideoFrameObserverInterface for video frame data listening (three pure virtual callbacks)

API details

Engine lifecycle

createEngine Creates the engine instance. The SDK holds the engine as a global singleton, so calling this method again returns the existing instance.
static AoqClientEngine* createEngine(const AoqCreateConfig& config,
                                    AoqEngineEventListener* listener);
ParameterTypeDescription
configAoqCreateConfigEngine creation configuration
listenerAoqEngineEventListener*Engine event callback listener, which the caller implements by inheritance
Returns: A pointer to the engine instance. nullptr is returned on failure. The lifecycle of the listener must outlast that of the engine. destroy Destroys the engine instance and releases all resources.
static int destroy();
Returns: 0 indicates success; a non-0 value indicates a failure. getVersion Gets the current SDK version.
static const char* getVersion();
Returns: The version string, which is held by the SDK. connect Connects to the relay server. The application server obtains temporary AOQ connection parameters based on the protocol in use and sends them to the client. For more information, see Token authentication.
virtual int connect(const AoqConnectConfig& config);
ParameterTypeDescription
configAoqConnectConfigConnection configuration, which includes the token, SID, the array of relay access points, and the arrays of publishing and subscribing tracks
Returns: 0 indicates success and the operation runs asynchronously; non-0 indicates a failure. The connection result is notified by onConnectionStatusChange.
relayEndpoints/publishTracks/subscribeTracks are all "C-style array pointer + length" structures. The memory is held by the caller and only needs to be valid during the connect call.
disconnect Disconnects from the server and releases the resources associated with the connection.
virtual int disconnect();
Returns: 0 indicates success; a non-0 value indicates a failure.

Audio device management

virtual int startAudioCapture(const AoqAudioCaptureConfig& config);
virtual int stopAudioCapture();
virtual int muteAudioCapture(bool mute);
virtual int startAudioPlayer(const AoqAudioPlaybackConfig& config);
virtual int stopAudioPlayer();
virtual int pauseAudioPlayer(int fadeMs);
virtual int resumeAudioPlayer(int fadeMs);
virtual int interruptAudioPlayer(AoqTrackType trackType, int fadeMs);
ParameterTypeDescription
configAoqAudioCaptureConfig / AoqAudioPlaybackConfigCapture and playback configuration
mutebooltrue mutes; false unmutes
fadeMsintFade-out or fade-in duration, in milliseconds. 0 indicates immediate execution.
trackTypeAoqTrackTypeTrack type
Important constraint on Linux: startAudioCapture/startAudioPlayer have empty implementations in the Linux build (they return 0 directly and do not open any sound card device), and stopAudioCapture/stopAudioPlayer have no actual effect because the internal state is not set. On Linux, use external audio streams (2.8) for audio input, and use audio frame callbacks (2.10) to play audio output yourself. For more information, see 4.3.

Audio codec configuration

virtual int setAudioEncoderConfig(const AoqAudioCodecConfig& config);
virtual int setAudioDecoderConfig(const AoqAudioCodecConfig& config);
We recommend that you call this method before connect(). An invalid combination of the sample rate and the mode triggers the onError callback with AoqECParamInvalid during connect.

Video device management

virtual int startVideoCapture(const AoqVideoCaptureConfig& config);
virtual int stopVideoCapture();
virtual int setLocalView(AoqTrackType trackType, const AoqVideoCanvas& canvas);
virtual int setRemoteView(AoqTrackType trackType, const AoqVideoCanvas& canvas);
ParameterTypeDescription
configAoqVideoCaptureConfigVideo capture configuration
trackTypeAoqTrackTypeVideo track type
canvasAoqVideoCanvasRendering canvas. If canvas.view == nullptr, the binding is removed.
Important constraint on Linux: Camera capture on Linux is a placeholder implementation and does not produce frames. Use startVideoCapture({.isExternal = true}) + pushExternalVideoCapturedFrame to deliver frames. setLocalView/setRemoteView have no rendering backend on Linux (AoqVideoCanvas.view supports only Apple NSView* / Windows HWND / Android rendering views). For preview, render it yourself through the video frame callback (2.12). For more information, see 4.3.

Video codec and external input

virtual int setVideoEncoderConfig(const AoqVideoCodecConfig& config);
virtual int setVideoDecoderConfig(const AoqVideoCodecConfig& config);
virtual int pushExternalVideoCapturedFrame(AoqTrackType trackType, const AoqVideoFrame& frame);
virtual int pushExternalVideoEncodedFrame(AoqTrackType trackType, const AoqVideoEncodedFrame& frame);
ParameterTypeDescription
configAoqVideoCodecConfigCodec configuration, which is routed based on config.trackType
trackTypeAoqTrackTypeRouting target. Set it to AoqTrackTypeVideo.
frameAoqVideoFrame / AoqVideoEncodedFrameRaw frame or encoded frame data
Notes:
  • setVideoDecoderConfig is a codec proposal for the subscribing side and must be called before connect. During decoding, only trackType/codecType/width/height/fps/bitrate take effect.
  • pushExternalVideoCapturedFrame requires startVideoCapture(isExternal=true) first. It returns AoqECVideoExternalCaptureNotEnabled(211) when external capture is not started, AoqECParamInvalid when the format is not supported, and AoqECVideoExternalBufferFull(210) when the buffer is full.
  • pushExternalVideoEncodedFrame requires setVideoEncoderConfig(isExternal=true) first. The SDK packages and sends the frame directly without re-encoding. Only JPEG is currently supported.
  • When frame.timeStamp is 0, the SDK fills it in with the local time.

Media stream control

virtual int enableSendMediaStream(AoqTrackType trackType, bool enable);
Specifies whether to send a specific local media stream. trackType can be AoqTrackTypeAudio or AoqTrackTypeVideo. A return value of 0 indicates that the call is dispatched and runs asynchronously. We recommend that you disable sending after initialization and enable it only after onConnectionStatusChange reports AoqConnectionStatusConnected.

Audio file playback

virtual int startAudioFile(const char* fileId, const AoqAudioFileMixConfig& config);
virtual int stopAudioFile(const char* fileId);
virtual int pauseAudioFile(const char* fileId);
virtual int resumeAudioFile(const char* fileId);
virtual int64_t getAudioFileDuration(const char* fileId);
virtual int64_t getAudioFileCurrentPosition(const char* fileId);
virtual int setAudioFilePositionMillis(const char* fileId, int64_t positionMillis);
virtual int setAudioFileVolume(const char* fileId, AoqAudioStreamDirection type, int volume);
virtual int getAudioFileVolume(const char* fileId, AoqAudioStreamDirection type);
ParameterTypeDescription
fileIdconst char*Audio file ID. The business layer must ensure global uniqueness.
configAoqAudioFileMixConfigFile mixing configuration
positionMillisint64_tTarget playback position, in milliseconds
typeAoqAudioStreamDirectionPublishing volume or local playback volume
volumeintVolume. Valid values: 0 to 100.
Description of the return value:
  • getAudioFileDuration/getAudioFileCurrentPosition: A value >=0 is the value in milliseconds; a value <0 indicates a failure, and its absolute value is -AoqErrorCode.
  • getAudioFileVolume: A value from 0-100 is the volume; a value <0 indicates a failure, and its absolute value is -AoqErrorCode.
Playback state changes are reported through the onAudioFileState callback. File mixing uses the publishing path and does not depend on the local sound card. Therefore, on Linux, you can use it to push a local file as the audio source.

External audio streams

virtual int addAudioExternalStream(const char* streamId, const AoqAudioExternalStreamConfig& config);
virtual int pushAudioExternalStreamData(const char* streamId, AoqAudioFrameData& data);
virtual int setAudioExternalStreamVolume(const char* streamId, AoqAudioStreamDirection type, int vol);
virtual int getAudioExternalStreamVolume(const char* streamId, AoqAudioStreamDirection type);
virtual void clearAudioExternalStreamBuffer(const char* streamId, int fadeoutMs);
virtual int removeAudioExternalStream(const char* streamId);
ParameterTypeDescription
streamIdconst char*External audio stream ID. The business layer must ensure global uniqueness.
configAoqAudioExternalStreamConfigExternal audio stream configuration
dataAoqAudioFrameDataRaw external audio data (PCM), as a non-const reference
typeAoqAudioStreamDirectionPublishing volume or local playback volume
volintVolume. Valid values: 0 to 100.
fadeoutMsintFade-out duration. -1 uses the SDK default fade-out, 0 clears the buffer with no fade-out, and a value greater than 0 keeps the specified fade-out duration in milliseconds.
Notes:
  • When pushAudioExternalStreamData returns AoqECAudioExternalBufferFull(110), the SDK's internal buffer is full. We recommend that you wait 20 ms and then send the current data frame again.
  • Best practice: In real-time capture scenarios, push 10 ms of data at a time and push whenever data is available. In file source scenarios, push 40 ms of data at a time at 30 ms intervals, and handle the AoqECAudioExternalBufferFull return value.
  • getAudioExternalStreamVolume: A value from 0-100 is the volume; a value <0 indicates a failure, and its absolute value is -AoqErrorCode.
  • clearAudioExternalStreamBuffer returns void and has no return value.
  • data.pushSequence is used for the SDK's consumption completion notification (PCM input round).
There is no real capture device on Linux. This group of APIs is the main path for the audio uplink.

Real-time messaging

virtual int sendDataMsg(const AoqDataMsg& msg);
Sends a real-time data message. msg.data points to memory held by the caller and only needs to be valid during the call. Messages from the peer are reported through the onDataMsg callback.

Audio frame callbacks

virtual int setAudioFrameObserver(IAudioFrameObserver* observer) = 0;
virtual int enableAudioFrameObserver(bool enabled, AoqAudioSource audioSource,
                                     const AoqAudioObserverConfig& config) = 0;
ParameterTypeDescription
observerIAudioFrameObserver*Listener instance. Pass nullptr to stop callbacks.
enabledboolSpecifies whether to enable data callbacks at this position
audioSourceAoqAudioSourcePosition of the raw audio data source
configAoqAudioObserverConfigCallback sample rate, number of channels, and read-write mode
Usage: First, call setAudioFrameObserver(observer) to register the listener. Then, call enableAudioFrameObserver for each position that you need. The lifecycle of the observer must cover the entire callback period. Release the observer only after you unregister it. Read-write mode support (see the IAudioFrameObserver declaration): onCapturedAudioFrame/onProcessCapturedAudioFrame/onPlaybackAudioFrame support read-write mode, whereas onPublishAudioFrame supports only read-only mode.
On Linux, setAudioFrameObserver completes registration through asynchronous dispatch (PostTask to the control thread), so the callback may take effect slightly after the call returns. Before releasing the observer, leave a sufficient safety interval or keep the object alive.

Local volume indication

virtual int enableLocalAudioVolumeIndication(const AoqAudioVolumeIndicationConfig& config);
Enables or disables local capture volume indication. If config.interval <= 0, the callback is disabled. After it is enabled, onLocalAudioVolumeIndication is triggered at the interval specified by config.interval. You must call this method after startAudioCapture to obtain volume data.
There is no device capture on Linux. The volume data in this callback comes from the publishing/playback mixing path (mixer).

Video frame callbacks

virtual int setVideoFrameObserver(IVideoFrameObserver* observer) = 0;
virtual int enableVideoFrameObserver(bool enabled, AoqVideoSource videoSource,
                                     const AoqVideoObserverConfig& config) = 0;
ParameterTypeDescription
observerIVideoFrameObserver*Listener instance. Pass nullptr to stop callbacks.
enabledboolSpecifies whether to enable data callbacks at this position
videoSourceAoqVideoSourceData source of the video frame callback (position in the pipeline)
configAoqVideoObserverConfigExpected pixel format, alignment policy, read-write mode, and mirroring
If the callback returns true, the data is modified and must be written back to the SDK. This takes effect only for I420 / CVPixelBuffer, which means only I420 on Linux. If the callback returns false, the data is read-only.
Linux has no built-in rendering. This group of callbacks is the only way to obtain the remote video image (AoqVideoSourceRemote).

AoqEngineEventListener callbacks

AoqEngineEventListener is the unified entry point for all asynchronous event notifications from the SDK. You inherit and implement it, and then pass it in when you call createEngine.
Key differences from Android: All callbacks in this class are pure virtual functions (= 0) with no default empty implementation. On Linux, you must fully implement the following 10 methods; otherwise, the derived class cannot be instantiated. Callbacks may be triggered on internal SDK threads.
class AOQ_API AoqEngineEventListener {
public:
  AoqEngineEventListener();
  virtual ~AoqEngineEventListener();
  virtual void onError(int code, const char* message) = 0;
  virtual void onWarning(int code, const char* message) = 0;
  virtual void onConnectionStatusChange(AoqConnectionStatus status) = 0;
  virtual void onStats(const AoqStats& stats) = 0;
  virtual void onAudioDeviceStateChanged(const AoqAudioDeviceState& state) = 0;
  virtual void onAudioDeviceRouteChanged(int routeType) = 0;
  virtual void onAudioFileState(const AoqAudioFileState& state) = 0;
  virtual void onLocalAudioVolumeIndication(const AoqAudioVolume& volume) = 0;
  virtual void onVideoDeviceStateChanged(const AoqVideoDeviceState& state) = 0;
  virtual void onDataMsg(const AoqDataMsg& msg) = 0;
};
onError Engine error callback. code corresponds to an AoqErrorCode enum value (see 3.3), and message is valid only during the callback. onWarning Engine warning callback. code corresponds to an AoqWarningCode enum value (see 3.3). onConnectionStatusChange Connection status change callback. State transitions: Disconnected -> Connecting -> Connected / Failed -> Disconnected. onStats Engine statistics callback. The SDK periodically reports publishing and subscribing statistics for audio and video and network statistics, which you can use to monitor call quality and network status in real time and to diagnose audio and video issues.
ParameterTypeDescription
statsAoqStatsPublishing and subscribing statistics and network statistics for audio, video, and data messages
AoqStats internally uses an "array pointer + count" structure. The pointer is valid only during the callback, so you must copy the data yourself for asynchronous use.
onAudioDeviceStateChanged Callback for audio device capture and playback operation status changes. state.reason is an AoqErrorCode value. onAudioDeviceRouteChanged Audio output route change callback. routeType corresponds to an AoqAudioDeviceRouteType enum value (see 3.4).
Not triggered on Linux: The Linux build does not include the platform device listener (AOQ_HAS_NATIVE_DEVICE_MONITOR is defined only on Windows / macOS), and server-side audio devices do not generate route events. You must still implement this method (pure virtual), but the implementation can be empty.
onAudioFileState Callback for audio file playback status. state.fileId is valid only during the callback. onLocalAudioVolumeIndication Local capture volume indication callback. To enable it, call enableLocalAudioVolumeIndication. onVideoDeviceStateChanged Callback for video device capture operation status changes. state.reason is an AoqErrorCode value. onDataMsg Callback for a received real-time data message. msg.data is guaranteed to be valid only during the callback. If you need to use it asynchronously, copy it yourself.

Frame data listener interfaces

IAudioFrameObserver Interface for audio data listening. Do not perform any time-consuming operations in the callbacks. Otherwise, audio anomalies may occur. All methods are pure virtual functions and must be fully implemented.
class AOQ_API IAudioFrameObserver {
public:
  virtual ~IAudioFrameObserver() {}
  virtual void onCapturedAudioFrame(const AoqAudioFrameData& data) = 0;
  virtual void onProcessCapturedAudioFrame(const AoqAudioFrameData& data) = 0;
  virtual void onPublishAudioFrame(AoqTrackType trackType, const AoqAudioFrameData& data) = 0;
  virtual void onPlaybackAudioFrame(const AoqAudioFrameData& data) = 0;
};
CallbackHow to enable it (audioSource)Read-write mode
onCapturedAudioFrameAoqAudioSourceCapturedRead-write supported
onProcessCapturedAudioFrameAoqAudioSourceProcessCapturedRead-write supported
onPublishAudioFrameAoqAudioSourcePublish (requires a successful connect)Only read-only is supported
onPlaybackAudioFrameAoqAudioSourcePlaybackRead-write supported
All the preceding callbacks support setting the sample rate and the number of channels by using AoqAudioObserverConfig.
On Linux, onPlaybackAudioFrame is the main path for obtaining the remote downlink PCM. Because the 3A module is not compiled on Linux, the data from onProcessCapturedAudioFrame (data after 3A processing) is essentially the same as the raw captured data. For more information, see 4.3.
IVideoFrameObserver Interface for video data listening. Do not perform any time-consuming operations in the callbacks. Otherwise, video stuttering may occur. All methods are pure virtual functions.
class AOQ_API IVideoFrameObserver {
public:
  virtual ~IVideoFrameObserver() {}
  virtual bool onCapturedVideoFrame(AoqVideoFrame& frame) = 0;
  virtual bool onPreEncodeVideoFrame(AoqTrackType trackType, AoqVideoFrame& frame) = 0;
  virtual bool onRemoteVideoFrame(AoqTrackType trackType, AoqVideoFrame& frame) = 0;
};
CallbackHow to enable it (videoSource)Description
onCapturedVideoFrameAoqVideoSourceCapturedLocal raw data after capture, before preprocessing
onPreEncodeVideoFrameAoqVideoSourcePreEncodeLocal raw data before encoding, after preprocessing
onRemoteVideoFrameAoqVideoSourceRemoteRemote raw data after decoding and before rendering
Returns: true indicates that the data is modified and must be written back to the SDK, which takes effect only for I420 / CVPixelBuffer; false indicates read-only. The pointers in frame are valid only during the callback. To use them asynchronously, copy them yourself.

Data types and enumerations

All types are defined in AoqClientEngine.h in the AoqClientSdk namespace. All structures are POD types with default values, so you get the default values in the table simply by declaring them. Fields marked as mobile-only are excluded by conditional compilation on Linux and do not exist in the structures.

General types

AoqCreateConfig
FieldTypeDefault valueDescription
workDirconst char*nullptrSDK working directory (for logs and temporary files)
enableDumpAudioboolfalseSpecifies whether to save audio data (for debugging)
extrasconst char*nullptrExtended parameters (a JSON string)
String fields must remain valid at least until createEngine returns. The engine copies them internally as needed. The isBTScoMode field on Android is mobile-only and does not exist on Linux.
AoqConnectConfig
FieldTypeDefault valueDescription
tokenconst char*nullptrConnection authentication token
sidconst char*nullptrSession ID
certFingerprintconst char*nullptrServer certificate fingerprint
workspaceIdHashconst char*nullptrWorkspace ID hash
relayEndpointsconst AoqRelayEndpoint*nullptrStart address of the relay access point array
relayEndpointsCountsize_t0Number of relay access points
publishTracksconst AoqTrackParam*nullptrStart address of the array of publishing track attributes
publishTracksCountsize_t0Number of publishing tracks
subscribeTracksconst AoqTrackParam*nullptrStart address of the array of subscribing track attributes
subscribeTracksCountsize_t0Number of subscribing tracks
AoqRelayEndpoint
FieldTypeDefault valueDescription
route_indexint-1Route index
endpointconst char*nullptrDomain name or IP address of the relay server
portint0Port of the relay server
Note that the field name route_index uses snake case, unlike the camel case used by the other fields.
AoqTrackParam
FieldTypeDefault valueDescription
trackTypeAoqTrackTypeAoqTrackTypeAudioTrack type
trackModeAoqTrackModeAoqTrackModeSegmentStreaming or non-streaming mode. Effective only for the audio downlink.
AoqDataMsg
FieldTypeDefault valueDescription
dataconst uint8_t*nullptrMessage content. It points to memory held by the caller.
dataSizesize_t0Number of bytes
When the data is used in a callback, it is guaranteed to be valid only during the callback. For asynchronous use, copy the data yourself.

Statistics types

AoqStats A summary of engine statistics, which is periodically reported through onStats. It uses an "array pointer + count" structure, in which all pointers default to nullptr and all counts default to 0.
FieldTypeDescription
audioPublishStatsconst AoqAudioPublishStats*Array of publishing statistics for audio
audioPublishStatsCountunsigned intNumber of publishing statistics entries for audio
videoPublishStatsconst AoqVideoPublishStats*Array of publishing statistics for video
videoPublishStatsCountunsigned intNumber of publishing statistics entries for video
dataMsgPublishStatsconst AoqDataMsgPublishStats*Array of publishing statistics for data messages
dataMsgPublishStatsCountunsigned intNumber of publishing statistics entries for data messages
audioSubscribeStatsconst AoqAudioSubscribeStats*Array of subscribing statistics for audio
audioSubscribeStatsCountunsigned intNumber of subscribing statistics entries for audio
videoSubscribeStatsconst AoqVideoSubscribeStats*Array of subscribing statistics for video
videoSubscribeStatsCountunsigned intNumber of subscribing statistics entries for video
dataMsgSubscribeStatsconst AoqDataMsgSubscribeStats*Array of subscribing statistics for data messages
dataMsgSubscribeStatsCountunsigned intNumber of subscribing statistics entries for data messages
networkStatsconst AoqNetworkStats*Network statistics
AoqAudioPublishStats
FieldTypeDefault valueDescription
trackTypeAoqTrackTypeAoqTrackTypeAudioTrack type
bitrateunsigned int0Bitrate, in bit/s
bytesuint64_t0Cumulative bytes sent
encodeVolumeunsigned int0Encoding volume of the publishing stream
AoqAudioSubscribeStats
FieldTypeDefault valueDescription
trackTypeAoqTrackTypeAoqTrackTypeAudioTrack type
bitrateunsigned int0Bitrate, in bit/s
bytesuint64_t0Cumulative bytes received
playVolumeunsigned int0Playback volume
AoqVideoPublishStats
FieldTypeDefault valueDescription
trackTypeAoqTrackTypeAoqTrackTypeVideoTrack type
bitrateunsigned int0Bitrate, in bit/s
bytesuint64_t0Cumulative bytes sent
encodeFpsunsigned int0Encoding frame rate
AoqVideoSubscribeStats
FieldTypeDefault valueDescription
trackTypeAoqTrackTypeAoqTrackTypeVideoTrack type
bitrateunsigned int0Bitrate, in bit/s
bytesuint64_t0Cumulative bytes received
decodeFpsunsigned int0Decoding frame rate
renderFpsunsigned int0Rendering frame rate
AoqDataMsgPublishStats / AoqDataMsgSubscribeStats
FieldTypeDefault valueDescription
trackTypeAoqTrackTypeAoqTrackTypeDataTrack type
bitrateunsigned int0Bitrate, in bit/s
bytesuint64_t0Cumulative bytes sent and received
AoqNetworkStats
FieldTypeDefault valueDescription
sendBitrateunsigned int0Send bitrate, in bit/s
sendBytesuint64_t0Cumulative bytes sent
recvBitrateunsigned int0Receive bitrate, in bit/s
recvBytesuint64_t0Cumulative bytes received
lossunsigned int0Packet loss rate, from 0 to 100
rttunsigned int0Round-trip latency, in ms

Enumerations

AoqTrackType
Enum valueValueDescription
AoqTrackTypeAudio0Audio track
AoqTrackTypeVideo1Video track
AoqTrackTypeData2Data message track
AoqTrackMode
Enum valueValueDescription
AoqTrackModeSegment0Segmented: data is packaged and delivered in semantic segments, such as a sentence.
AoqTrackModeStream1Streaming: data is delivered continuously.
AoqEncoderType
Enum valueValueDescription
AoqEncoderTypeUnknown0Unknown format
AoqEncoderTypeAudioPCM1Audio PCM
AoqEncoderTypeAudioOpus2Audio Opus (plug-in based; statically built into Linux and available out of the box)
AoqEncoderTypeVideoH2643Video H.264
AoqEncoderTypeVideoJpeg4Video JPEG
AoqEncoderTypeDataText5Message text
AoqConnectionStatus
Enum valueValueDescription
AoqConnectionStatusDisconnected0Disconnected
AoqConnectionStatusConnecting1Connecting
AoqConnectionStatusConnected2Connected
AoqConnectionStatusFailed3Connection failed
AoqErrorCode
Naming note: In C++ headers, the enum literals use the abbreviated AoqEC* form (unlike the full AoqErrorCode* form on Android), but the values are identical.
Enum valueValueDescription
AoqECOK0Success
AoqECParamInvalid1Invalid parameter
AoqECStateInvalid2Invalid state
AoqECUnSupport3The API is called but is not implemented on the current platform or in the current mode
AoqECAudio100Generic audio error
AoqECAudioExternalBufferFull110External audio buffer is full
AoqECAudioDevice120Generic audio device error
AoqECAudioDeviceRecordingAuthFailed121Recording permission not granted
AoqECAudioDeviceRecordingOccupied122Recording device is in use
AoqECAudioDeviceRecordingBackgroundStart123Failed to start recording in the background
AoqECAudioDeviceRecordingStartFail124Failed to start recording
AoqECAudioDevicePlayoutOccupied125Playback device is in use
AoqECAudioDevicePlayoutBackgroundStart126Failed to start playback in the background
AoqECAudioDevicePlayoutStartFail127Failed to start playback
AoqECAudioDeviceEarpieceRequiresVoipMode128The receiver requires VoIP mode (mobile scenarios)
AoqECVideo200Generic video error
AoqECVideoExternalBufferFull210External video buffer is full
AoqECVideoExternalCaptureNotEnabled211External video capture is not enabled
AoqECVideoExternalEncoderNotEnabled212External video encoding is not enabled
AoqECVideoDevice220Generic video device error
AoqECVideoDeviceCameraOpenFail221Failed to open the camera
AoqECVideoDeviceCameraAuthFailed222Camera permission not granted
AoqECVideoDeviceCameraOccupied223Camera is in use
AoqECVideoDeviceCameraRunningError224Camera runtime exception
AoqECVideoCodec230Generic video codec error
AoqECVideoCodecEncoderInitFail231Failed to initialize the video encoder
AoqECVideoRender240Generic video rendering error
AoqECVideoRenderCreateFail241Failed to create video rendering
AoqECVideoRenderDrawError242Video rendering drawing error
AoqWarningCode
Enum valueValueDescription
AoqWCOK0No warning
AoqWCAudio100Generic audio warning
AoqWCAudioHowling101Audio howling detected
AoqWCAudioDevice120Generic audio device warning
AoqWCAudioDeviceMicEnumerateError121Microphone enumeration error
AoqWCAudioDeviceMicStartTimeout122Microphone startup timed out
AoqWCAudioDeviceRecordingError123Error during recording
AoqWCAudioDeviceSpeakerEnumerateError124Speaker enumeration error
AoqWCAudioDeviceSpeakerStartTimeout125Speaker startup timed out
AoqWCAudioDevicePlayoutError126Error during playback
AoqWCVideo200Generic video warning
AoqWCVideoCameraEnumerateError201Camera enumeration error
AoqWCVideoEncoderSwitched202Video encoder switched
AoqWCVideoRenderDowngrade203Video rendering downgraded
AoqMirrorMode
Enum valueValueDescription
AoqMirrorModeDisabled0Disable mirroring
AoqMirrorModeEnabled1Enable mirroring
AoqOrientationMode
Enum valueValueDescription
AoqOrientationModeAuto0Auto-fit
AoqOrientationModePortrait1Portrait
AoqOrientationModeLandscape2Landscape
AoqRenderMode
Enum valueValueDescription
AoqRenderModeAuto0Adaptive mode
AoqRenderModeStretch1Stretch mode
AoqRenderModeFill2Fill mode
AoqRenderModeCrop3Crop mode
This is used only as AoqVideoCanvas.renderMode. Linux has no rendering implementation, so this enumeration does not actually take effect.
AoqAudioStreamDirection
Enum valueValueDescription
AoqAudioStreamPublish0Publishing audio
AoqAudioStreamPlayout1Playback audio
AoqAudioExternalStreamToggle
Enum valueValueDescription
AoqAudioExternalStreamToggleNormal0Recovered
AoqAudioExternalStreamTogglePause1Paused
This enumeration is declared in the header, but no public API currently uses it. It is a reserved definition.

Audio types

AoqAudioCaptureConfig
FieldTypeDefault valueDescription
isExternalboolfalseSpecifies whether to use external capture
channelint1Number of audio capture channels. 1 and 2 are supported.
isVoipMode is a mobile-only field and does not exist on Linux.
AoqAudioPlaybackConfig
FieldTypeDefault valueDescription
isExternalboolfalseSpecifies whether to use external playback
channelint1Number of audio playback channels. 1 and 2 are supported.
isVoipMode/isDefaultSpeaker are mobile-only fields and do not exist on Linux.
AoqAudioCodecConfig
FieldTypeDefault valueDescription
trackTypeAoqTrackTypeAoqTrackTypeAudioTrack type
codecTypeAoqEncoderTypeAoqEncoderTypeAudioPCMEncoding type
sampleRateint48000Sample rate, in Hz
channelint1Number of channels. 1 and 2 are supported.
bitrateint32000Bitrate, in bit/s
Sample rate constraints (excerpted from the comments in the header file):
  • Encoding: Opus supports 8 / 16 / 48K, and PCM supports 8 / 16 / 32 / 48K;
  • Decoding: 24K is additionally supported, but 24K is limited to Segment mode (Stream mode does not support 24K);
  • An invalid combination triggers the onError callback with AoqECParamInvalid during connect.
AoqAudioDeviceRouteType
Enum valueValueDescription
AoqAudioDeviceRouteDefault0Default route
AoqAudioDeviceRouteHeadset1Headphones
AoqAudioDeviceRouteEarpiece2Receiver
AoqAudioDeviceRouteHeadsetNoMic3Headphones without a microphone
AoqAudioDeviceRouteSpeakerPhone4Built-in speaker
AoqAudioDeviceRouteUsb5USB audio device
AoqAudioDeviceRouteBluetooth6Bluetooth
AoqAudioDeviceRouteBluetoothA2dp7Bluetooth A2DP
This is only a reference for the routeType values of onAudioDeviceRouteChanged. Linux does not trigger this callback.
AoqAudioDeviceStateCode
Enum valueValueDescription
AoqAudioDeviceNone0No state
AoqAudioDeviceRecordStarting1Capture starting
AoqAudioDeviceRecordStarted2Capture started
AoqAudioDeviceRecordStopping3Capture stopping
AoqAudioDeviceRecordStopped4Capture stopped
AoqAudioDeviceRecordFail5Capture failed
AoqAudioDevicePlayStarting6Playback starting
AoqAudioDevicePlayStarted7Playback started
AoqAudioDevicePlayStopping8Playback stopping
AoqAudioDevicePlayStopped9Playback stopped
AoqAudioDevicePlayFail10Playback failed
AoqAudioDeviceState
FieldTypeDefault valueDescription
stateAoqAudioDeviceStateCodeAoqAudioDeviceNoneDevice operation status
reasonint0Error reason code. See AoqErrorCode.
AoqAudioFrameData Raw audio data. It is used for both external stream feeding through pushAudioExternalStreamData and the IAudioFrameObserver callback.
FieldTypeDefault valueDescription
dataPtrvoid*0Pointer to the audio PCM data
numOfSamplesint0Number of samples (per channel)
bytesPerSampleint0Bytes per sample
numOfChannelsint0Number of channels
samplesPerSecint0Number of samples per second (sample rate)
pushSequenceint0PCM input round (used for the stream consumption completion notification)
timeStampint64_t0Timestamp
dataSizeint0Data length, in bytes
autoGenMuteboolfalseEffective only in callbacks. true indicates silent data generated by the SDK.
AoqAudioSource
Enum valueValueDescription
AoqAudioSourceCaptured0Captured audio data
AoqAudioSourceProcessCaptured1Audio data after 3A processing
AoqAudioSourcePublish2Audio data to be published (requires a successful connect)
AoqAudioSourcePlayback3Audio data to be played
AoqAudioSourceMax4Placeholder, do not use
AoqAudioObserverMode
Enum valueValueDescription
AoqAudioObserverModeReadOnly0Read-only mode
AoqAudioObserverModeReadWrite1Read-write mode
AoqAudioObserverConfig
FieldTypeDefault valueDescription
sampleRateint48000Sample rate of the callback audio, in Hz. Resampling is performed if the rate does not match that of the source.
channelsint1Number of audio channels in the callback. 1 and 2 are supported. This parameter is limited by the codec parameters of the subscribing stream.
modeAoqAudioObserverModeAoqAudioObserverModeReadOnlyCallback mode
Supported sample rates: 8, 12, 16, 24, 32, 44.1, 48, 64, 88.2, 96, 176.4, and 192K. AoqAudioVolumeIndicationConfig
FieldTypeDefault valueDescription
intervalint0Callback interval, in milliseconds. A value less than or equal to 0 disables the callback. A value greater than 0 and less than 10 is treated as 10.
smoothint3Volume smoothing coefficient. A larger value results in smoother output. Valid values: 0 to 10.
AoqAudioVolume
FieldTypeDefault valueDescription
volumeint0Smoothed instantaneous volume. Valid values: 0 to 255.

Audio file and external audio stream types

AoqAudioFileMixConfig
FieldTypeDefault valueDescription
fileNameconst char*nullptrFile name (including the path)
cyclesint-1Number of loops. -1 indicates unlimited looping.
startPosMslong0Start playback position, in milliseconds
publishVolumeint100Publishing volume. Valid values: 0 to 100.
playoutVolumeint100Playback volume. Valid values: 0 to 100.
fileId is not part of the configuration body and is passed as a separate parameter to startAudioFile.
AoqAudioFileStateCode
Enum valueValueDescription
AoqAudioFileNone0No state
AoqAudioFileStarted1Started
AoqAudioFileStopped2Stopped
AoqAudioFilePaused3Paused
AoqAudioFileResumed4Resumed
AoqAudioFileEnded5Playback completed
AoqAudioFileBuffering6Buffering
AoqAudioFileBufferingEnd7Buffering ended
AoqAudioFileFailed8Playback failed
AoqAudioFileErrorCode
Enum valueValueDescription
AoqAudioFileNoError0No error
AoqAudioFileOpenFailed1Failed to open the file
AoqAudioFileDecodeFailed2Failed to decode the file
AoqAudioFileState
FieldTypeDefault valueDescription
fileIdconst char*nullptrFile ID. It is valid only during the callback.
stateCodeAoqAudioFileStateCodeAoqAudioFileNoneFile status code
errorCodeAoqAudioFileErrorCodeAoqAudioFileNoErrorFile error code
AoqAudioExternalStreamConfig
FieldTypeDefault valueDescription
trackTypeAoqTrackTypeAoqTrackTypeAudioAudio track type
codecTypeAoqEncoderTypeAoqEncoderTypeAudioPCMAudio stream format. PCM is supported.
channelsint1Number of channels. It is limited by the audio codec of the publishing stream (1 and 2 are supported, and additional channels are ignored).
sampleRateint48000Sample rate, in Hz
playoutVolumeint100Playback volume. Valid values: 0 to 100.
publishVolumeint100Publishing volume. Valid values: 0 to 100.
maxBufferDurationint600000Maximum buffer duration, in milliseconds (that is, 10 minutes). Valid values: 100 and above. If the duration exceeds this value, Push fails.
enable3AboolfalseApply 3A processing to the input PCM (does not take effect on Linux, see 4.3)
Supported sample rates: 8, 12, 16, 24, 32, 44.1, 48, 64, 88.2, 96, 176.4, and 192K.
streamId is not part of the configuration body and is passed as a separate parameter to addAudioExternalStream.

Video types

AoqVideoCanvas
FieldTypeDefault valueDescription
viewvoid*nullptrAn opaque pointer to the platform-native view handle. Pass nullptr to remove the binding.
renderModeAoqRenderModeAoqRenderModeAutoRendering fill mode
Platform meanings of view: NSView* on Apple, HWND on Windows, and the SDK's internal rendering view adapter object on Android. You must ensure that the lifecycle of view is longer than the period during which it is set by setLocalView/setRemoteView.
No corresponding platform implementation on Linux. This structure has no practical use on Linux.
AoqVideoCaptureConfig
FieldTypeDefault valueDescription
widthint1280Capture width, in pixels. This parameter is ineffective when isExternal=true.
heightint720Capture height, in pixels. This parameter is ineffective when isExternal=true.
fpsint15Capture frame rate. This parameter is ineffective when isExternal=true (the pace is determined by frame delivery).
isExternalboolfalseSpecifies whether to use external capture. If it is true, the camera is not opened, and frames are fed by pushExternalVideoCapturedFrame.
cameraDirection is a mobile-only field and does not exist on desktop platforms (including Linux). On Linux, we recommend that you always set isExternal = true.
AoqVideoCodecConfig Encoding and decoding share the same structure. For decoding, only trackType/codecType/width/height/fps/bitrate take effect and participate in negotiation as a subscription proposal. minBitrate/keyframeInterval/mirrorMode/orientationMode/isExternal are used only for encoding.
FieldTypeDefault valueDescription
isExternalboolfalseExternal encoding mode. When it is true, you push encoded frames, and the SDK does not perform capture or encoding.
trackTypeAoqTrackTypeAoqTrackTypeVideoTrack type
codecTypeAoqEncoderTypeAoqEncoderTypeVideoH264Encoding type
widthint540Resolution width, in pixels
heightint960Resolution height, in pixels
fpsint5Frame rate
bitrateint500000Initial bitrate, in bit/s
minBitrateint128000Minimum bitrate, in bit/s
keyframeIntervalint2Keyframe interval, in seconds
mirrorModeAoqMirrorModeAoqMirrorModeDisabledMirror mode
orientationModeAoqOrientationModeAoqOrientationModeAutoOrientation mode
AoqVideoPixelFormat
Enum valueValueDescriptionSupported on Linux
AoqVideoPixelFormatUnknown0Unknown format-
AoqVideoPixelFormatI4201I420 (YUV planar format)Supported
AoqVideoPixelFormatNV122NV12 (YUV semi-planar format)Supported
AoqVideoPixelFormatNV213NV21 (YUV semi-planar format)Supported
AoqVideoPixelFormatBGRA4BGRA (32-bit)Supported
AoqVideoPixelFormatRGBA5RGBA (32-bit)Supported
AoqVideoPixelFormatCVPixelBuffer6Effective only on Apple platformsNot supported
AoqVideoPixelFormatTextureOES7Android external OES textureNot supported
AoqVideoPixelFormatTexture2D8Android regular 2D textureNot supported
Enum values 6/7/8 are still visible in the header file (they are not excluded by conditional compilation), but Linux does not have the corresponding platform capability. If you pass them, they are treated as unsupported formats.
AoqVideoFrame An external raw video frame. It is used for both pushExternalVideoCapturedFrame and the IVideoFrameObserver callback.
FieldTypeDefault valueDescription
formatAoqVideoPixelFormatAoqVideoPixelFormatUnknownPixel format
widthint0Width, in pixels
heightint0Height, in pixels
dataPtrvoid*0Packed-format data (NV12 / NV21 / BGRA / RGBA)
dataSizeint0Number of bytes of packed data
dataYvoid*0I420 Y plane
dataUvoid*0I420 U plane
dataVvoid*0I420 V plane
strideYint0Stride of the Y plane
strideUint0Stride of the U plane
strideVint0Stride of the V plane
nativePixelBuffervoid*0Used for Apple zero-copy (CVPixelBufferRef). This field is not used on Linux.
textureIdint0Android texture ID. This field is not used on Linux.
transformMatrixfloat array (16 elements)All zerosTexture transformation matrix (row-major 4x4). This field is not used on Linux.
timeStampint64_t0Timestamp, in milliseconds. If it is 0, the SDK fills it in with the local time.
AoqVideoCodecType
Enum valueValueDescription
AoqVideoCodecTypeJPEG0JPEG encoding
AoqVideoEncodedFrame An externally encoded video frame. The caller performs the encoding, and the SDK packages and sends the frame directly without re-encoding.
FieldTypeDefault valueDescription
codecAoqVideoCodecTypeAoqVideoCodecTypeJPEGCodec format
datavoid*nullptrPointer to the encoded data
dataSizeint0Number of bytes of the encoded data
widthint0Width, in pixels
heightint0Height, in pixels
timeStampint64_t0Timestamp, in milliseconds. If it is 0, the SDK fills it in with the local time.
AoqVideoDeviceStateCode
Enum valueValueDescription
AoqVideoDeviceNone0No state
AoqVideoDeviceCaptureStarting1Camera starting
AoqVideoDeviceCaptureStarted2Camera started
AoqVideoDeviceCaptureStopping3Camera stopping
AoqVideoDeviceCaptureStopped4Camera stopped
AoqVideoDeviceCaptureFail5Failed to start the camera (for example, permission denied or the device is unavailable)
AoqVideoDeviceState
FieldTypeDefault valueDescription
stateAoqVideoDeviceStateCodeAoqVideoDeviceNoneDevice capture operation status
reasonint0Error reason code. See AoqErrorCode.
AoqVideoSource
Enum valueValueDescription
AoqVideoSourceCaptured0Captured video data before preprocessing
AoqVideoSourcePreEncode1Video data before encoding, after preprocessing
AoqVideoSourceRemote2Remote video data after decoding and before rendering
AoqVideoSourceMax3Placeholder, do not use
AoqVideoObserverMode
Enum valueValueDescription
AoqVideoObserverModeReadOnly0Read-only mode
AoqVideoObserverModeReadWrite1Read-write mode (supported only for I420 / CVPixelBuffer)
AoqVideoObserverAlignment
Enum valueValueDescription
AoqVideoObserverAlignmentDefault0Default alignment
AoqVideoObserverAlignmentEven1Even-number alignment
AoqVideoObserverAlignment424-byte alignment
AoqVideoObserverAlignment838-byte alignment
AoqVideoObserverAlignment16416-byte alignment
AoqVideoObserverConfig
FieldTypeDefault valueDescription
formatAoqVideoPixelFormatAoqVideoPixelFormatI420Expected pixel format of the callback data
alignmentAoqVideoObserverAlignmentAoqVideoObserverAlignmentDefaultWidth alignment policy
modeAoqVideoObserverModeAoqVideoObserverModeReadOnlyCallback mode. ReadWrite is supported only for I420 / CVPixelBuffer.
mirrorAppliedboolfalseSpecifies whether to mirror the callback data