屏幕共享质量配置
功能介绍
通过 setScreenShareCfg 在开始共享时设置分辨率、帧率、码率等参数。配置采用 JSON 格式,参考 CRScreenShareCfg。
1. 质量参数
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| maxFPS | int | 12 | 最大帧率(1~60) |
| maxKbps | int | 2000 | 最大码率 kbit/s(1~4000) |
| qp | int | 22 | 画质(0~51,0 为无损) |
2. 配置示例
共享指定屏幕,720p、15 帧:
// monitorID 来自 getScreenCaptureSources 的屏幕 _sourceId
const char* cfg = R"({
"monitorID": 0,
"maxFPS": 15,
"maxKbps": 2000
})";
meeting.setScreenShareCfg(cfg);
共享指定窗口:
// catchWnd 来自 getScreenCaptureSources 的窗口 _sourceId
const char* cfg = R"({
"catchWnd": 12345678,
"maxFPS": 15,
"maxKbps": 2000
})";
meeting.setScreenShareCfg(cfg);
共享指定区域:
const char* cfg = R"({
"catchRect": {"left": 0, "top": 0, "width": 800, "height": 600},
"maxFPS": 12,
"maxFPS": 15,
"maxKbps": 1000
})";
meeting.setScreenShareCfg(cfg);
3. 其它可选参数
| 参数 | 说明 |
|---|---|
| shareSound | 是否共享电脑声音(默认 false),仅 Windows |
| excludeSharerPID | 是否排除本进程窗口(默认 false),仅 Windows |
| activateWindow | 共享时是否激活窗口到前台,适用窗口共享 |
| borderHighLight | 是否对共享源描边高亮,适用窗口共享 |
| highLightColor | 共享时描边颜色,如 #54DB00 |
| highLightWidth | 描边宽度 |