Skip to content
This SDK only works with devices released within the past 3 years. We regularly optimize and update the SDK to ensure compatibility and performance. We do not guarantee compatibility or provide technical support for devices older than 3 years.

# NET_SDK_EncodeAudioFrame

### Interface Definition

C++C#

    1
    2
    3
    4
    5
    6
    BOOL NET_SDK_EncodeAudioFrame(
        POINTERHANDLE lEncodeHandle,
        unsigned char* pInBuffer,
        LONG inLen,
        unsigned char* pOutBuffer,
        int* pOutLen);

    1
    2
    3
    4
    5
    6
    public static extern bool NET_SDK_EncodeAudioFrame(
        POINTERHANDLE lEncodeHandle,
        IntPtr pInBuffer,
        int inLen,
        IntPtr pOutBuffer,
        ref int pOutLen);

### Function Description

Audio encoding.

### Parameter Description

Parameters | Type | Remark
--- | --- | ---
lEncodeHandlein | POINTERHANDLE | Audio encoder handle, the return value of `NET_SDK_InitAudioEncoder`.
pInBufferin | unsigned char* | The input buffer obtains PCM audio data according to the sampling standard (sampling frequency is 16000Hz, 16-bit sampling, single channel), and the size of the input data is specified to be 1280 bytes.
inLenin | LONG | The length of the input buffer pInBuffer.
pOutBufferout | unsigned char* | Output buffer, the encoded output data size is 80 bytes.
pOutLenout | int* | The length of the output buffer pOutBuffer.

### Return Value

- Type：BOOL

- Remark：Returns TRUE if successful, FALSE if failed.

### Remarks

It is mainly set to cooperate with the voice intercom and forwarding functions. When the original audio data of the client needs to be sent to the device, the audio encoding function can be used to compress and encode the original data before sending it to the device. The client obtains the compressed code stream sent by the device and can call the audio decoding function `NET_SDK_DecodeAudioFrame` to decode the data. Before calling the encoding and decoding function, you need to do the corresponding initialization operation, and after the call, you need to release the resources.

Error Code