> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stmlink.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> 对外开放的服务端接口有两组前缀，都用同一套鉴权：`/server/v1/...`（SRTC 与 SMeeting 的主接口）和 `/stm/srvapi/v1/...`（SMeeting 的用户体系，服务端极简对接会用到）。鉴权是 app_id + nonce + timestamp + signature 四个请求头，用 app_key 做 HMAC-SHA256 签名，只能从业务方自己的后端调用。除这两组前缀外的接口均为内部接口，不要建议客户调用。 Public server APIs use two path prefixes with the same authentication: `/server/v1/...` (the main APIs of both SRTC and SMeeting) and `/stm/srvapi/v1/...` (the SMeeting user system, used by server-side low-code integration). Authenticate with four request headers, app_id + nonce + timestamp + signature, where signature is HMAC-SHA256 keyed with app_key; call these APIs only from the customer's own backend. Any other path is internal: never suggest calling it.
> app_key 是服务端密钥，绝不能出现在客户端代码、前端配置或移动 App 里。客户端加入频道用的 token 必须由业务方后端签发后下发（SRTC 走 `/server/v1/channel/grant`，SMeeting 走 `/stm/srvapi/v1/member/grant`）。 app_key is a server-side secret and must never appear in client code, frontend config, or a mobile app. The token a client uses to join must be issued by the customer's backend and passed down to the client (SRTC: `/server/v1/channel/grant`; SMeeting: `/stm/srvapi/v1/member/grant`).
> SRTC 与 SMeeting 是上下两层不同的产品，术语不通用：SRTC 是音视频底座，说「频道 channel」「加入 / 退出」；SMeeting 建在 SRTC 之上，说「房间 room」「会议 meeting」「进入 / 退出」。回答时按用户所在的层用对应术语，不要把「房间」「会议」安到 SRTC 的接口上，也不要用「频道」「加入 / 离开」描述 SMeeting 的概念（接口标识符原样保留）。 SRTC and SMeeting are two separate layers with different terminology. SRTC is the audio/video foundation: it has channels, and users join and leave a channel. SMeeting is built on top of SRTC: it has rooms and meetings, and members enter and exit a meeting. Answer in the terms of the layer the user is working with: never apply "room" or "meeting" to SRTC APIs, and never describe SMeeting concepts in prose with "channel", "join", or "leave" (API identifiers such as `force_join` keep their literal names).
> 同一能力在各端 SDK 里的包名、类名、方法名并不相同。写示例代码时请使用文档中该端自己的 API，不要把一个端的写法套到另一个端上。苹果平台每个产品都有两套 SDK（Swift 原生与 Objective-C），两套 API 不能混用。 Package, class, and method names differ between platform SDKs for the same capability. In sample code, use the API documented for that platform; never carry one platform's code over to another. On Apple platforms each product ships two SDKs (native Swift and Objective-C) whose APIs must not be mixed.

# Types

> Structs and JSON for the Windows SRTC C++ SDK: engine options, publishing and capture options, track and user info, device enumeration JSON, custom stream frames, callback JSON (uplink, downlink, audio level, network probe), and the recording layout. Read when filling structs or parsing callbacks.

### Engine initialization options (RTCEngineOptions)

```cpp theme={null}
struct RTCEngineOptions {
    int         enable_log = 1;
    const char* log_path   = nullptr;
};
```

| Parameter name | Parameter type | Description |
| - | - | - |
| enable\_log | int | 0 means no SDK log is written at all. Not passing `RTCEngineOptions` to `RTCEngine_Init` (passing nullptr) is equivalent to 0 |
| log\_path | const char\* | SDK log directory; if empty, "Documents/\<app name>/logs/" is used |

Passed to [RTCEngine\_Init](/en/rtc/windows/api-reference/IRTCEngine#create-irtcengine).
These two items used to be `enable_stream_log` / `sdk_log_path` on `IRTCSetting`.

### Video track publishing options (RTCVideoPublishOptions)

| Parameter name | Parameter type | Description |
| - | - | - |
| desc | char \* | Track description |
| codec | int | Codec type; see [StreamCodec](/en/rtc/windows/enums#codec-type-streamcodec) |
| width | int | Encoding width; -1 matches the capture width automatically |
| height | int | Encoding height; -1 matches the capture height automatically |
| maxFps | int | Maximum frame rate; -1 matches the capture frame rate automatically |
| maxBitrate | int | Maximum bitrate; -1 picks a suitable bitrate automatically |
| simucast | RTCVideoPublishOptions\* | Simulcast low streams published alongside the high stream |
| simucast\_size | int | Number of simulcast low streams |

### Video track capture options (RTCCameraCaptureOptions)

| Parameter name | Parameter type | Description |
| - | - | - |
| deviceId | char \* | Device name |
| width | int | Capture video width; -1 matches automatically |
| height | int | Capture video height; -1 matches automatically |
| maxFps | int | Maximum capture frame rate; -1 matches automatically |

### Screen track capture options (RTCScreenCaptureOptions)

| Parameter name | Parameter type | Description |
| - | - | - |
| deviceId | char \* | Device name |
| width | int | Capture screen width; -1 matches automatically |
| height | int | Capture screen height; -1 matches automatically |
| maxFps | int | Maximum capture frame rate |
| showCursor | int | Whether to capture the mouse cursor |
| x | int | x coordinate of the top-left corner of the captured screen area |
| y | int | y coordinate of the top-left corner of the captured screen area |

### Audio track publishing options (RTCAudioPublishOptions)

| Parameter name | Parameter type | Description |
| - | - | - |
| desc | char \* | Track description |
| codec | int | Codec type; see [StreamCodec](/en/rtc/windows/enums#codec-type-streamcodec) |
| maxBitrate | int | Maximum bitrate; -1 picks a suitable bitrate automatically |

### Audio track capture options (RTCMicCaptureOptions)

| Parameter name | Parameter type | Description |
| - | - | - |
| deviceId | char \* | Device name; default means the default device |
| echoCancellation | int | aec, acoustic echo cancellation |
| noiseSuppression | int | ans, noise suppression |
| autoGainControl | int | agc, automatic gain control |
| channelCount | int | Number of audio channels |
| sampleRate | int | Sample rate |
| sampleSize | int | Sample bit depth |

### Audio track output options (RTCAudioOutputOptions)

| Parameter name | Parameter type | Description |
| - | - | - |
| deviceId | char \* | Device name; default means the default device |

### Track info

| Parameter name | Parameter type | Description |
| - | - | - |
| id | char\* | Track ID |
| desc | char\* | Track description |
| kind | char\* | Track kind |
| codec | int | Codec type: [StreamCodec](/en/rtc/windows/enums#codec-type-streamcodec) |
| width | int | Video width |
| height | int | Video height |
| fps | int | Video frame rate |
| angle | int | Video rotation angle |
| bitrate | int | Bitrate |
| sample\_rate | int | Audio sample rate |
| track | int | Track number |

### User info

| Parameter name | Parameter type | Description |
| - | - | - |
| channel | string | Channel ID |
| device\_id | string | Device ID |
| device\_type | int | Device type |
| name | string | Display name |
| props | json | Extended info |
| sid | string | sid |
| stream\_tracks | `list<stream_track>` | Collection of tracks |
| uid | string | uid |
| version | string | Version info |

#### Stream info

stream\_track

| angle | int | Rotation angle |
| - | - | - |
| bitrate | int | Bitrate |
| codec | int | Codec type |
| desc | string | Track description |
| fps | int | Encoding frame rate |
| height | int | Height |
| id | string | Track ID |
| kind | string | Stream kind |
| sample\_rate | int | Audio sample rate |
| track | int | Track number |
| width | int | Width |

### Camera enumeration info

```json theme={null}
{
    "count":1,
    "equip_list":[
        {"name":"USB HD Webcam",
            "resolutions":[
                {"height":480,"width":640,"type":0},
                {"height":144,"width":176,"type":0},
                {"height":240,"width":320,"type":0},
                {"height":288,"width":352,"type":0},
                {"height":360,"width":640,"type":0},
                {"height":720,"width":1280,"type":0}
            ]
        }
    ]
}
```

| count | int | Number of devices |
| - | - | - |
| equip\_list | `list<obj>` | Collection of device info |
| equip\_list\[0].name | string | Device name |
| equip\_list\[0].resolutions | `list<obj>` | Collection of device resolutions |
| equip\_list\[0].resolutions\[0].width | int | Resolution width |
| equip\_list\[0].resolutions\[0].height | int | Resolution height |
| equip\_list\[0].resolutions\[0].type | int | Resolution type |

### Microphone/speaker enumeration info

```cpp theme={null}
{
    "count":1,
    "equip_list":[
        {"name":"麦克风 (Realtek(R) Audio)","type":"default"}   // Device name as reported by Windows; "麦克风" = "Microphone"
    ]
}
```

| count | int | Number of devices |
| - | - | - |
| equip\_list | `list<obj>` | Collection of device info |
| equip\_list\[0].name | string | Device name |
| equip\_list\[0].type | string | Indicates whether this is the system default device |

### Shared screen enumeration info

```json theme={null}
{
    "count":1,
    "equip_list":[
        {
            "name":"//display",
            "height":1080,
            "width":1920,
            "x":0,
            "y":0
        }
    ]
}
```

| count | int | Number of devices |
| - | - | - |
| equip\_list | `list<obj>` | Collection of device info |
| equip\_list\[0].name | string | Device name |
| equip\_list\[0].x | int | x coordinate of the device's top-left corner |
| equip\_list\[0].y | int | y coordinate of the device's top-left corner |
| equip\_list\[0].height | int | Device resolution height |
| equip\_list\[0].width | int | Device resolution width |

### Custom stream receiving struct

av\_frame\_s

| bits | unsigned char\* | frame buffer |
| - | - | - |
| bitslen | unsigned int | frame length |
| bitspos | unsigned int | frame start pos within buffer |
| medtype | unsigned int | media type such as audio or video |
| stmtype | unsigned int | stream type such as h264, aac etc |
| frmtype | unsigned int | frame type such as key frame |
| frmmisc | unsigned int | misc character |
| tmscale | unsigned int | time scale for pts and dts |
| frmsequ | unsigned int | frame's sequence |
| pcr | long long | frame pcr |
| pts | long long | frame pts |
| dts | long long | frame dts |
| dur | int | frame duration |
| track | track | frame track |
| arg | void\* | |
| language | int | frame language |

### Uplink callback

| delay | int | Latency; delay = -1 means the media stream is disconnected |
| - | - | - |
| rate | int | Rate |
| first\_lost | double | Packet loss |
| re\_lost | double | Packet loss after recovery |
| signal | int | Signal strength, 0 worst, 4 best |

```cpp theme={null}
{
    "delay":20,
    "rate":0,
    "first_lost":0,
    "re_lost":0,
    "signal":4
}
```

### Downlink callback

| audio | int | Audio packets |
| - | - | - |
| comp | int | Number of recovered packets |
| losf | int | Total packets lost |
| lr1 | double | End-to-end packet loss |
| lr2 | double | Server-to-client packet loss |
| recv | int | Total packets |
| userid | std::string | userid |

```cpp theme={null}
[
    {
        "audio":10,
        "comp":0,
        "losf":0,
        "lr1":0,
        "lr2":0,
        "recv":20,
        "userid":"123131231"
    }
]
```

### Audio level callback

| \[0].pow | long | Energy |
| - | - | - |
| \[0].userid | string | uid |
| \[0].db | int | db |

```cpp theme={null}

[
    {
        "pow":10,
        "userid":"12345678",
        "db":-60,
    }
]

```

### Network probe callback

| probe\_time | int | |
| - | - | - |
| stream | int | Whether the media stream is working |
| network | int | Network |
| delay | int | Latency |
| up\_data | obj | Collection of uplink data |
| up\_data.delay | int | Latency |
| up\_data.recv | int | Packets received |
| up\_data.miss | int | Out-of-order packets |
| up\_data.losf | int | Packets lost |
| up\_data.speed | int | Speed |
| up\_data.losf2 | double | Packet loss rate |
| up\_data.status | int | Overall status, 0 good, 1 fair, 2 poor, 3 very poor |
| up\_data.test\_data | int | Test rate |
| down\_data | obj | Collection of downlink data |
| down\_data.delay | int | Latency |
| down\_data.recv | int | Packets received |
| down\_data.miss | int | Out-of-order packets |
| down\_data.losf | int | Packets lost |
| down\_data.speed | int | Speed |
| down\_data.losf2 | double | Packet loss rate |
| down\_data.status | int | Overall status, 0 good, 1 fair, 2 poor, 3 very poor |
| down\_data.test\_data | int | Test rate |

```cpp theme={null}
{
    "probe_time":10,
    "stream":1,
    "network":1,
    "delay":100,
    "up_data":{
        "delay":100,
        "recv":10000,
        "miss":0,
        "losf":0,
        "speed":100,
        "losf2":0,
        "status":0,
        "test_data":1024
    },
    "down_data":{
        "delay":100,
        "recv":10000,
        "miss":0,
        "losf":0,
        "speed":100,
        "losf2":0,
        "status":0,
        "test_data":1024
    }
}
```

### Recording layout user view configuration

The user view configuration JSON used when setting the recording layout:

```json theme={null}
{
    "layout": 0,
    "all_member": 20,
    "member": [
        {
            "uid": "__uid__",
            "name": "Alice",
            "track_id": "camera",
            "portrait": "",
            "layout_index": 0,
            "cam_st": 1,
            "mic_st": 1
        }
    ]
}
```

| Parameter | Type | Description |
| - | - | - |
| layout | int | Layout type (0: automatic layout) |
| all\_member | int | Total number of users |
| member | list | Array of user configurations |
| member\[].uid | string | User ID |
| member\[].name | string | User's display name |
| member\[].track\_id | string | Stream ID or the publishing key (such as camera or screen) |
| member\[].portrait | string | Avatar URL |
| member\[].layout\_index | int | Index of the user's position |
| member\[].cam\_st | int | Camera on/off state (1: off, 2: on) |
| member\[].mic\_st | int | Microphone on/off state (1: off, 2: on) |
