IRTCASREngineEventHandler

class bytertc::IRTCASREngineEventHandler

语音识别服务使用状态回调

成员函数

返回 名称
virtual void OnSuccess
virtual void OnMessage
virtual void OnError

函数说明

OnSuccess

virtual void bytertc::IRTCASREngineEventHandler::OnSuccess()

语音识别服务开启成功回调

OnMessage

virtual void bytertc::IRTCASREngineEventHandler::OnMessage(
    const char* message)

语音转文字成功回调,该回调返回识别后的全量消息。

传入参数

参数名 类型 说明
message const char* 识别完成后得到的文字消息

注意 若识别过程中发生了网络连接中断,则重连后回调的信息中只包含重连后识别的文字消息,不再包含上一次连接后识别的消息。

OnError

virtual void bytertc::IRTCASREngineEventHandler::OnError(
    int error_code,
    const char* error_message)

当语音识别服务内部发生错误事件时触发该回调。

传入参数

参数名 类型 说明
error_code int 错误码
• < 0: 参数错误或 API 调用顺序错误,参看 RTCASRErrorCode;
• >0: 参看 语音识别服务错误码
error_message const char* 错误原因说明

AudioFrameType

enum bytertc::AudioFrameType

音频帧类型

枚举值

类型 说明
kFrameTypePCM16 = 0 PCM 16bit

AudioFrameBuilder

typedef struct bytertc::AudioFrameBuilder

音频帧构建类

成员变量

类型 名称
AudioSampleRate sample_rate
AudioChannel channel
int64_t timestamp_us
uint8_t* data
int64_t data_size

变量说明

sample_rate

AudioSampleRate bytertc::AudioFrameBuilder::sample_rate;

音频采样率

channel

AudioChannel bytertc::AudioFrameBuilder::channel;

音频通道数

timestamp_us

int64_t bytertc::AudioFrameBuilder::timestamp_us = 0;

音频帧时间戳,单位:微秒

data

uint8_t* bytertc::AudioFrameBuilder::data;

音频帧数据

data_size

int64_t bytertc::AudioFrameBuilder::data_size = 0;

音频帧数据大小

IAudioFrame

class bytertc::IAudioFrame

音频帧

成员函数

返回 名称
virtual int64_t timestamp_us
virtual AudioSampleRate sample_rate
virtual AudioChannel channel
virtual uint8_t* data
virtual int data_size
virtual AudioFrameType frame_type
virtual void release
virtual bool is_muted_data

函数说明

timestamp_us

virtual int64_t bytertc::IAudioFrame::timestamp_us() const

获取音频帧时间戳。

返回值 音频帧时间戳,单位:微秒

sample_rate

virtual AudioSampleRate bytertc::IAudioFrame::sample_rate() const

获取音频采样率。参看 AudioSampleRate

返回值 音频采样率,单位:Hz

channel

virtual AudioChannel bytertc::IAudioFrame::channel() const

获取音频通道数。参看 AudioChannel

返回值 音频通道数

data

virtual uint8_t* bytertc::IAudioFrame::data() const

获取音频帧内存块地址

返回值 音频帧内存块地址

data_size

virtual int bytertc::IAudioFrame::data_size() const

获取音频帧数据大小

返回值 音频帧数据大小

frame_type

virtual AudioFrameType bytertc::IAudioFrame::frame_type() const

获取音频帧类型

返回值 音频帧类型,目前只支持 PCM,详见 AudioFrameType

release

virtual void bytertc::IAudioFrame::release()

释放音频帧

is_muted_data

virtual bool bytertc::IAudioFrame::is_muted_data() const

获取音频静音标志

返回值 是否静音数据

RenderMode

enum bytertc::RenderMode

渲染模式

枚举值

类型 说明
kRenderModeHidden 视窗填满优先。

视频帧等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的多出部分将无法显示。

缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长大于等于视窗对应边长。
kRenderModeFit 视频帧内容全部显示优先。

视频帧等比缩放,直至视频帧能够在视窗上全部显示。如果视频帧长宽比例与视窗不同,视窗上未被视频帧填满区域将被涂黑。

缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长小于等于视窗对应边长。

UserOfflineReason

enum bytertc::UserOfflineReason

用户离开房间的原因。

枚举值

类型 说明
kUserOfflineReasonQuit 远端用户调用 LeaveRoom 方法主动退出房间,或切换为不可见。
kUserOfflineReasonDropped 远端用户因网络等原因掉线,或切换至隐身状态。

StreamRemoveReason

enum bytertc::StreamRemoveReason

房间内远端流被移除的原因。

枚举值

类型 说明
kStreamRemoveReasonUnpublish 远端用户停止发布流。
kStreamRemoveReasonPublishFailed 远端用户发布流失败。
kStreamRemoveReasonKeepLiveFailed 保活失败。
kStreamRemoveReasonClientDisconnected 远端用户断网。
kStreamRemoveReasonRepublish 远端用户重新发布流。
kStreamRemoveReasonOther 其他原因。

JoinRoomType

enum bytertc::JoinRoomType

用户加入房间的类型。

枚举值

类型 说明
kJoinRoomTypeFirst 首次加入房间。用户手动调用 JoinRoom 以加入房间。
kJoinRoomTypeReconnected 重新加入房间。用户网络较差,失去与服务器的连接,进行重连时收到加入成功。

LoginType

enum bytertc::LoginType

用户登录的类型

枚举值

类型 说明
kLoginTypeFirst 首次登录。用户手动调用 Login,收到登录成功。
kLoginTypeReconnected 重连。用户网络较差,失去与服务器的连接,SDK 自动重连登录成功。

RoomMessageSendResult

enum bytertc::RoomMessageSendResult

发送消息给房间的结果

枚举值

类型 说明
kRoomMessageSendResultSuccess 房间Broadcast消息发送成功
kRoomMessageSendResultNotJoin 没有加入房间
kRoomMessageSendResultNoConnection 没有可用的数据传输通道连接
kRoomMessageSendResultExceedMaxLength 消息超过最大长度,当前为64KB
kRoomMessageSendResultUnknown 未知错误

ConnectionState

enum bytertc::ConnectionState

SDK 与信令服务器连接状态。

枚举值

类型 说明
kConnectionStateDisconnected 连接断开。
kConnectionStateConnecting 首次连接,正在连接中。
kConnectionStateConnected 首次连接成功。
kConnectionStateReconnecting 连接断开后重新连接中。
kConnectionStateReconnected 连接断开后重连成功。
kConnectionStateLost 网络连接断开超过 10 秒,仍然会继续重连。

NetworkDetectionStopReason

enum bytertc::NetworkDetectionStopReason

通话前探测的停止原因 OnNetworkDetectionStopped 回调的参数类型

枚举值

类型 说明
kNetworkDetectionStopReasonUser 用户主动停止
kNetworkDetectionStopReasonTimeout 探测超过三分钟
kNetworkDetectionStopReasonConnectionLost 探测网络连接断开。
当超过 12s 没有收到回复,SDK 将断开网络连接,并且不再尝试重连。
kNetworkDetectionStopReasonStreaming 本地开始推拉流,停止探测
kNetworkDetectionStopReasonInnerErr 网络探测失败,内部异常

NetworkDetectionLinkType

enum bytertc::NetworkDetectionLinkType

通话前探测链接的类型。 OnNetworkDetectionResult 回调的参数类型

枚举值

类型 说明
kNetworkDetectionLinkTypeUp 上行网络探测
kNetworkDetectionLinkTypeDown 下行网络探测

NetworkQuality

enum bytertc::NetworkQuality

媒体流网络质量。

枚举值

类型 说明
kNetworkQualityUnknown 网络质量未知。
kNetworkQualityExcellent 网络质量极好。
kNetworkQualityGood 主观感觉和 kNetworkQualityExcellent 差不多,但码率可能略低。
kNetworkQualityPoor 主观感受有瑕疵但不影响沟通。
kNetworkQualityBad 勉强能沟通但不顺畅。
kNetworkQualityVbad 网络质量非常差,基本不能沟通。

UserNetworkQualityMsg

struct bytertc::UserNetworkQualityMsg

用户维度媒体流网络质量。

成员变量

类型 名称
const char* uid
double fraction_lost
int rtt
int total_bandwidth
int tx_quality
int rx_quality

变量说明

uid

const char* bytertc::UserNetworkQualityMsg::uid;

自己或者远端用户的 uid。

fraction_lost

double bytertc::UserNetworkQualityMsg::fraction_lost;

端到端的丢包,取值 (0~1)

rtt

int bytertc::UserNetworkQualityMsg::rtt;

端到端的往返延时,单位:ms

total_bandwidth

int bytertc::UserNetworkQualityMsg::total_bandwidth;

rtp包的传输总量,单位:bps

tx_quality

int bytertc::UserNetworkQualityMsg::tx_quality;

上行质量分,取值见 NetworkQuality

rx_quality

int bytertc::UserNetworkQualityMsg::rx_quality;

下行质量分,取值见 NetworkQuality

NetworkType

enum bytertc::NetworkType

SDK 网络连接类型。

枚举值

类型 说明
kNetworkTypeUnknown 网络连接类型未知。
kNetworkTypeDisconnected 网络连接已断开。
kNetworkTypeLAN 网络连接类型为 LAN 。
kNetworkTypeWIFI 网络连接类型为 Wi-Fi(包含热点)。
kNetworkTypeMobile2G 网络连接类型为 2G 移动网络。
kNetworkTypeMobile3G 网络连接类型为 3G 移动网络。
kNetworkTypeMobile4G 网络连接类型为 4G 移动网络。
kNetworkTypeMobile5G 网络连接类型为 5G 移动网络。

PublishFallbackOption

enum bytertc::PublishFallbackOption

性能回退

枚举值

类型 说明
kPublishFallbackOptionDisabled 关闭发送视频流时的性能回退功能,默认值
kPublishFallbackOptionSimulcast 开启在网络情况不佳或设备性能不足时只发送小流的功能

RoomProfileType

enum bytertc::RoomProfileType

房间模式

枚举值

类型 说明
kRoomProfileTypeCommunication 普通音视频通话模式。

单声道,采样率为 48kHz。

你应在 1V1 音视频通话时,使用此设置。

此设置下,弱网抗性较好。
kRoomProfileTypeLiveBroadcasting 直播模式。

单声道,采样率为 48kHz。

当你对音视频通话的音质和画质要求较高时,应使用此设置。

此设置下,当用户使用蓝牙耳机收听时,蓝牙耳机使用媒体模式。
kRoomProfileTypeGame 游戏语音模式。

单声道,采样率为 16kHz。

低端机在此模式下运行时,进行了额外的性能优化:

+ 部分低端机型配置编码帧长 40/60

+ 部分低端机型关闭软件 3A 音频处理

增强对 iOS 其他屏幕录制进行的兼容性,避免音频录制被 RTC 打断。
kRoomProfileTypeCloudGame 云游戏模式。

单声道,采样率为 48kHz。

如果你需要低延迟、高码率的设置时,你可以使用此设置。

此设置下,弱网抗性较差。
kRoomProfileTypeLowLatency 低时延模式。SDK 会使用低延时设置。

当你的场景非游戏或云游戏场景,又需要极低延时的体验时,可以使用该模式。

该模式下,音视频通话延时会明显降低,但同时弱网抗性、通话音质等均会受到一定影响。

在使用此模式前,强烈建议咨询技术支持同学。

RTCRoomConfig

struct bytertc::RTCRoomConfig

房间参数配置

成员变量

类型 名称
RoomProfileType room_profile_type
bool is_auto_publish
bool is_auto_subscribe_audio
bool is_auto_subscribe_video

变量说明

room_profile_type

RoomProfileType bytertc::RTCRoomConfig::room_profile_type = kRoomProfileTypeCommunication;

房间模式,参看 RoomProfileType,默认为 kRoomProfileTypeCommunication,进房后不可更改。

is_auto_publish

bool bytertc::RTCRoomConfig::is_auto_publish = true;

是否自动发布音视频流,默认为自动发布。
若调用 SetUserVisibility 将自身可见性设为 false,无论是默认的自动发布流还是手动设置的自动发布流都不会进行发布,你需要将自身可见性设为 true 后方可发布。

is_auto_subscribe_audio

bool bytertc::RTCRoomConfig::is_auto_subscribe_audio = true;

是否自动订阅音频流,默认为自动订阅。
进房后,你可以调用 SubscribeUserStream 修改订阅设置。

is_auto_subscribe_video

bool bytertc::RTCRoomConfig::is_auto_subscribe_video = true;

是否自动订阅主视频流,默认为自动订阅。
进房后,你可以调用 SubscribeUserStream 修改订阅设置。
屏幕流始终自动订阅,不受该方法影响。

MultiRoomConfig

struct bytertc::MultiRoomConfig

多房间参数配置

成员变量

类型 名称
RoomProfileType room_profile_type
bool is_auto_subscribe_audio
bool is_auto_subscribe_video

变量说明

room_profile_type

RoomProfileType bytertc::MultiRoomConfig::room_profile_type = kRoomProfileTypeCommunication;

房间模式,参看 RoomProfileType,默认为普通音视频通话模式,进房后不可更改。

is_auto_subscribe_audio

bool bytertc::MultiRoomConfig::is_auto_subscribe_audio = true;

是否自动订阅音频流,默认为自动订阅

is_auto_subscribe_video

bool bytertc::MultiRoomConfig::is_auto_subscribe_video = true;

是否自动订阅视频流,默认为自动订阅

MediaDeviceType

enum bytertc::MediaDeviceType

当前媒体设备类型

枚举值

类型 说明
kMediaDeviceTypeAudioUnknown 未知设备类型
kMediaDeviceTypeAudioRenderDevice 音频渲染设备类型
kMediaDeviceTypeAudioCaptureDevice 音频采集设备类型
kMediaDeviceTypeVideoCaptureDevice 视频采集设备类型
kMediaDeviceTypeScreenVideoCaptureDevice 屏幕流视频设备
kMediaDeviceTypeScreenAudioCaptureDevice 屏幕流音频设备

MediaDeviceState

enum bytertc::MediaDeviceState

媒体设备状态

枚举值

类型 说明
kMediaDeviceStateStarted 设备已开启
kMediaDeviceStateStopped 设备已停止
kMediaDeviceStateRuntimeError 设备运行时错误
kMediaDeviceStatePaused 设备已暂停
kMediaDeviceStateResumed 设备已恢复
kMediaDeviceStateAdded 设备已插入
kMediaDeviceStateRemoved = 11 设备被移除

MediaDeviceError

enum bytertc::MediaDeviceError

媒体设备错误类型

枚举值

类型 说明
kMediaDeviceErrorOK 媒体设备正常
kMediaDeviceErrorDeviceNoPermission 没有权限启动媒体设备
kMediaDeviceErrorDeviceBusy 媒体设备已经在使用中
kMediaDeviceErrorDeviceFailure 媒体设备错误
kMediaDeviceErrorDeviceNotFound 未找到指定的媒体设备
kMediaDeviceErrorDeviceDisconnected 媒体设备被移除(屏幕采集情况下窗体被关闭or显示器被移除)
kMediaDeviceErrorDeviceNoCallback 设备没有数据回调
kMediaDeviceErrorDeviceUNSupportFormat 设备采样率不支持

MediaDeviceWarning

enum bytertc::MediaDeviceWarning

媒体设备警告

枚举值

类型 说明
kMediaDeviceWarningOK 无警告
kMediaDeviceWarningOperationDenied 非法设备操作。在使用外部设备时,调用了 SDK 内部设备 API。
kMediaDeviceWarningCaptureSilence 采集静音。
kMediaDeviceWarningAndroidSysSilence Android 特有的静音,系统层面的静音上报
kMediaDeviceWarningAndroidSysSilenceDisappear Android 特有的静音消失

CameraID

enum bytertc::CameraID

移动端摄像头。

枚举值

类型 说明
kCameraIDFront 前置摄像头
kCameraIDBack = 1 后置摄像头

AudioPlaybackDevice

enum bytertc::AudioPlaybackDevice

音频播放设备

枚举值

类型 说明
kAudioPlaybackDeviceHeadset 有线耳机
kAudioPlaybackDeviceEarpiece 听筒
kAudioPlaybackDeviceSpeakerphone 扬声器
kAudioPlaybackDeviceHeadsetBluetooth 蓝牙耳机
kAudioPlaybackDeviceHeadsetUSB = 5 USB设备

AudioScenarioType

enum bytertc::AudioScenarioType

音频场景类型。
选择音频场景后,RTC 会自动根据客户端音频采集播放设备和采集播放状态,适用通话音量/媒体音量。
你可以调用 SetAudioScenario 设置音频场景。
如果预设的音频场景类型无法满足你的业务需要,请联系技术支持同学进行定制。

枚举值

类型 说明
kAudioScenarioTypeMusic 音乐场景。默认为此场景。

此场景适用于对音乐表现力有要求的场景。如音乐直播等。

音频采集播放设备和采集播放状态,到音量类型的映射如下:






仅采集音频,不播放音频仅播放音频,不采集音频采集并播放音频备注
设备自带麦克风和扬声器/听筒媒体音量媒体音量通话音量/
有线耳机媒体音量媒体音量媒体音量/
蓝牙耳机媒体音量媒体音量媒体音量即使蓝牙耳机有麦克风,也只能使用设备自带麦克风进行本地音频采集。
kAudioScenarioTypeHighQualityCommunication 高质量通话场景。

此场景适用于对音乐表现力有要求的场景。但又希望能够使用蓝牙耳机上自带的麦克风进行音频采集的场景。
此场景可以兼顾外放/使用蓝牙耳机时的音频体验;并尽可能避免使用蓝牙耳机时音量类型切换导致的听感突变。

音频采集播放设备和采集播放状态,到音量类型的映射如下:






仅采集音频,不播放音频仅播放音频,不采集音频采集并播放音频 备注
设备自带麦克风和扬声器/听筒媒体音量媒体音量通话音量/
有线耳机媒体音量媒体音量媒体音量/
蓝牙耳机通话音量通话音量通话音量能够使用蓝牙耳机上自带的麦克风进行音频采集。
kAudioScenarioTypeCommunication 纯通话音量场景。

此场景下,无论客户端音频采集播放设备和采集播放状态,全程使用通话音量。
适用于需要频繁上下麦的通话或会议场景。

此场景可以保持统一的音频模式,不会有音量突变的听感;
最大程度上的消除回声,使通话清晰度达到最优;
使用蓝牙耳机时,能够使用蓝牙耳机上自带的麦克风进行音频采集。

但是,使用媒体音量进行播放的其他音频的音量会被压低,且音质会变差。
kAudioScenarioTypeMedia 纯媒体场景。一般不建议使用。

此场景下,无论客户端音频采集播放设备和采集播放状态,全程使用媒体音量。
kAudioScenarioTypeGameStreaming 游戏媒体场景。仅适合游戏场景。

此场景下,蓝牙耳机时使用通话音量,其它设备使用媒体音量。
外放通话且无游戏音效消除优化时,极易出现回声和啸叫。

VoiceChangerType

enum bytertc::VoiceChangerType

变声特效类型

枚举值

类型 说明
kVoiceChangerTypeOriginal 原声,不含特效
kVoiceChangerTypeGiant 巨人
kVoiceChangerTypeChipmunk 花栗鼠
kVoiceChangerTypeMinionst 小黄人
kVoiceChangerTypeVibrato 颤音
kVoiceChangerTypeRobot 机器人

VoiceReverbType

enum bytertc::VoiceReverbType

混响特效类型

枚举值

类型 说明
kVoiceReverbTypeOriginal 原声,不含特效
kVoiceReverbTypeEcho 回声
kVoiceReverbTypeConcert 演唱会
kVoiceReverbTypeEthereal 空灵
kVoiceReverbTypeKTV KTV
kVoiceReverbTypeStudio 录音棚

SubscribeFallbackOption

enum bytertc::SubscribeFallbackOption

订阅回退选项

枚举值

类型 说明
kSubscribeFallbackOptionDisable 下行网络较弱时,关闭订阅音视频流时的性能回退功能,默认值
kSubscribeFallbackOptionVideoStreamLow 下行网络较弱时,只接收视频小流
kSubscribeFallbackOptionAudioOnly 下行网络较弱时,先尝试只接收视频小流;如果网络环境无法显示视频,则再回退到只接收远端订阅的音频流

SubscribeMediaType

enum bytertc::SubscribeMediaType

订阅媒体的类型

枚举值

类型 说明
kRTCSubscribeMediaTypeNone 既不订阅音频,也不订阅视频
kRTCSubscribeMediaTypeAudioOnly 只订阅音频,不订阅视频
kRTCSubscribeMediaTypeVideoOnly 只订阅视频,不订阅音频
kRTCSubscribeMediaTypeVideoAndAudio 同时订阅音频和视频

PauseResumeControlMediaType

enum bytertc::PauseResumeControlMediaType

暂停/恢复接收远端的媒体流类型。

枚举值

类型 说明
kRTCPauseResumeControlMediaTypeAudio 只控制音频,不影响视频
kRTCPauseResumeControlMediaTypeVideo 只控制视频,不影响音频
kRTCPauseResumeControlMediaTypeVideoAndAudio = 2 同时控制音频和视频

RemoteUserPriority

enum bytertc::RemoteUserPriority

远端用户优先级,在性能不足需要回退时,会优先回退优先级低的用户的音视频流

枚举值

类型 说明
kRemoteUserPriorityLow 用户优先级为低(默认值)
kRemoteUserPriorityMedium 用户优先级为正常
kRemoteUserPriorityHigh 用户优先级为高

SVCLayer

enum bytertc::SVCLayer

时域分层定义

枚举值

类型 说明
kSVCLayerDefault 不指定分层(默认值)
kSVCLayerBase T0层
kSVCLayerMain T0+T1层
kSVCLayerHigh T0+T1+T2层

FallbackOrRecoverReason

enum bytertc::FallbackOrRecoverReason

远端订阅流发生回退或恢复的原因

枚举值

类型 说明
kFallbackOrRecoverReasonUnknown 其他原因,非带宽和性能原因引起的回退或恢复。默认值
kFallbackOrRecoverReasonSubscribeFallbackByBandwidth 由带宽不足导致的订阅端音视频流回退。
kFallbackOrRecoverReasonSubscribeFallbackByPerformance 由性能不足导致的订阅端音视频流回退。
kFallbackOrRecoverReasonSubscribeRecoverByBandwidth 由带宽恢复导致的订阅端音视频流恢复。
kFallbackOrRecoverReasonSubscribeRecoverByPerformance 由性能恢复导致的订阅端音视频流恢复。
kFallbackOrRecoverReasonPublishFallbackByBandwidth 由带宽不足导致的发布端音视频流回退。
kFallbackOrRecoverReasonPublishFallbackByPerformance 由性能不足导致的发布端音视频流回退。
kFallbackOrRecoverReasonPublishRecoverByBandwidth 由带宽恢复导致的发布端音视频流恢复。
kFallbackOrRecoverReasonPublishRecoverByPerformance 由性能恢复导致的发布端音视频流恢复。

RemoteStreamSwitch

struct bytertc::RemoteStreamSwitch

流切换信息。本地用户订阅的远端流触发回退策略时的流切换信息。

成员变量

类型 名称
const char* uid
bool is_screen
int before_video_index
int after_video_index
bool before_enable
bool after_enable
FallbackOrRecoverReason reason

变量说明

uid

const char* bytertc::RemoteStreamSwitch::uid;

订阅的音视频流的发布者的用户 ID。

is_screen

bool bytertc::RemoteStreamSwitch::is_screen;

是否是屏幕流。

before_video_index

int bytertc::RemoteStreamSwitch::before_video_index;

流切换前本地用户订阅的视频流的分辨率对应的索引。

after_video_index

int bytertc::RemoteStreamSwitch::after_video_index;

流切换后本地用户订阅的视频流的分辨率对应的索引。

before_enable

bool bytertc::RemoteStreamSwitch::before_enable;

流切换前是否有视频流。

after_enable

bool bytertc::RemoteStreamSwitch::after_enable;

流切换后是否有视频流。

reason

FallbackOrRecoverReason bytertc::RemoteStreamSwitch::reason;

触发流回退的原因,详见类型 FallbackOrRecoverReason 。

USER_ONLINE_STATUS

enum bytertc::USER_ONLINE_STATUS

用户在线状态。

枚举值

类型 说明
kUserOnlineStatusOffline 对端用户离线

对端用户已调用 Logout,或者没有调用 Login 进行登录。
kUserOnlineStatusOnline 对端用户在线

对端用户调用 Login 登录,并且连接状态正常。
kUserOnlineStatusUnreachable 无法获取对端用户在线状态

发生级联错误、对端用户在线状态异常时返回。

TransCodingError

enum bytertc::TransCodingError

直播推流转码功能错误码。

枚举值

类型 说明
kTransCodingErrorOK 推流成功。
kTransCodingErrorInvalidArgument 推流参数错误。
kTransCodingErrorSubscribe 和 RTC 服务端建立连接失败。会自动重连
kTransCodingErrorProcessing 合流服务中间过程存在错误,建议重试。
kTransCodingErrorPublish 推流失败,可以等待服务端重新推流。

BusinessCheckCode

enum bytertc::BusinessCheckCode

事务检查码
用户调用 SetBusinessId 方法设置业务标识参数的返回错误码。

枚举值

类型 说明
ERROR_ALREADY_IN_ROOM 用户已经在房间中。

业务标识需要在加入房间之前设置,加入后设置无效。
ERROR_INPUT_INVALIDATE 输入参数非法。

用户传入的业务标识参数非法,参数合法性参考 SetBusinessId 方法的参数说明。

LocalAudioStreamState

enum bytertc::LocalAudioStreamState

本地音频流状态。 SDK 通过 OnLocalAudioStateChanged 回调本地音频流状态

枚举值

类型 说明
kLocalAudioStreamStateStopped 本地音频默认初始状态。
麦克风停止工作时回调该状态,对应错误码 kLocalAudioStreamErrorOk
kLocalAudioStreamStateRecording 本地音频录制设备启动成功。
采集到音频首帧时回调该状态,对应错误码 kLocalAudioStreamErrorOk
kLocalAudioStreamStateEncoding 本地音频首帧编码成功。
音频首帧编码成功时回调该状态,对应错误码 kLocalAudioStreamErrorOk
kLocalAudioStreamStateFailed 本地音频启动失败,在以下时机回调该状态:

+ 本地录音设备启动失败,对应错误码 kLocalAudioStreamErrorRecordFailure

+ 检测到没有录音设备权限,对应错误码 kLocalAudioStreamErrorDeviceNoPermission

+ 音频编码失败,对应错误码 kLocalAudioStreamErrorEncodeFailure

kLocalAudioStreamMute 本地音频静音成功后回调该状态。
调用 MuteLocalAudioStream 成功后回调,对应错误码 LocalAudioStreamError 中的 kLocalAudioStreamErrorOk 。
kLocalAudioStreamUnmute 本地音频解除静音成功后回调该状态。
调用 MuteLocalAudioStream 成功后回调,对应错误码 LocalAudioStreamError 中的 kLocalAudioStreamErrorOk 。

LocalAudioStreamError

enum bytertc::LocalAudioStreamError

本地音频流状态改变时的错误码。 SDK 通过 OnLocalAudioStateChanged 回调该错误码。

枚举值

类型 说明
kLocalAudioStreamErrorOk 本地音频状态正常
kLocalAudioStreamErrorFailure 本地音频出错原因未知
kLocalAudioStreamErrorDeviceNoPermission 没有权限启动本地音频录制设备
kLocalAudioStreamErrorDeviceBusy 本地音频录制设备已经在使用中
kLocalAudioStreamErrorRecordFailure 本地音频录制失败,建议你检查录制设备是否正常工作
kLocalAudioStreamErrorEncodeFailure 本地音频编码失败
kLocalAudioStreamErrorNoRecordingDevice 没有可用的音频录制设备

LocalVideoStreamState

enum bytertc::LocalVideoStreamState

本地视频流状态

枚举值

类型 说明
kLocalVideoStreamStateStopped 本地视频采集停止状态
kLocalVideoStreamStateRecording 本地视频采集设备启动成功
kLocalVideoStreamStateEncoding 本地视频采集后,首帧编码成功
kLocalVideoStreamStateFailed 本地视频采集设备启动失败

RemoteAudioState

enum bytertc::RemoteAudioState

远端音频流状态。
用户可以通过 OnRemoteAudioStateChanged 了解该状态。

枚举值

类型 说明
kRemoteAudioStateStopped 不接收远端音频流。

以下情况下会触发回调 OnRemoteAudioStateChanged:

+ 本地用户停止接收远端音频流,对应原因是:kRemoteAudioStateChangeReasonLocalMutedRemoteAudioStateChangeReason

+ 远端用户停止发送音频流,对应原因是:kRemoteAudioStateChangeReasonRemoteMutedRemoteAudioStateChangeReason

+ 远端用户离开房间,对应原因是:kRemoteAudioStateChangeReasonRemoteOfflineRemoteAudioStateChangeReason
kRemoteAudioStateStarting 开始接收远端音频流首包。

刚收到远端音频流首包会触发回调 OnRemoteAudioStateChanged,
对应原因是: RemoteAudioStateChangeReason 中的 kRemoteAudioStateChangeReasonLocalUnmuted
kRemoteAudioStateDecoding 远端音频流正在解码,正常播放。

以下情况下会触发回调 OnRemoteAudioStateChanged:

+ 成功解码远端音频首帧,对应原因是: RemoteAudioStateChangeReason 中的 kRemoteAudioStateChangeReasonLocalUnmuted

+ 网络由阻塞恢复正常,对应原因是: RemoteAudioStateChangeReason 中的 kRemoteAudioStateChangeReasonNetworkRecovery

+ 本地用户恢复接收远端音频流,对应原因是:RemoteAudioStateChangeReason 中的 kRemoteAudioStateChangeReasonLocalUnmuted

+ 远端用户恢复发送音频流,对应原因是: RemoteAudioStateChangeReason 中的 kRemoteAudioStateChangeReasonRemoteUnmuted
kRemoteAudioStateFrozen 远端音频流卡顿。

网络阻塞、丢包率大于 40% 时,会触发回调 OnRemoteAudioStateChanged,
对应原因是: RemoteAudioStateChangeReason 中的 kRemoteAudioStateChangeReasonNetworkCongestion

RemoteAudioStateChangeReason

enum bytertc::RemoteAudioStateChangeReason

接收远端音频流状态改变的原因。
用户可以通过 OnRemoteAudioStateChanged 了解该原因。

枚举值

类型 说明
kRemoteAudioStateChangeReasonInternal 内部原因
kRemoteAudioStateChangeReasonNetworkCongestion 网络阻塞
kRemoteAudioStateChangeReasonNetworkRecovery 网络恢复正常
kRemoteAudioStateChangeReasonLocalMuted 本地用户停止接收远端音频流
kRemoteAudioStateChangeReasonLocalUnmuted 本地用户恢复接收远端音频流
kRemoteAudioStateChangeReasonRemoteMuted 远端用户停止发送音频流
kRemoteAudioStateChangeReasonRemoteUnmuted 远端用户恢复发送音频流
kRemoteAudioStateChangeReasonRemoteOffline 远端用户离开房间

RemoteVideoState

enum bytertc::RemoteVideoState

远端视频流状态。状态改变时,会收到回调:OnRemoteVideoStateChanged

枚举值

类型 说明
kRemoteVideoStateStopped 远端视频流默认初始状态,视频尚未开始播放。
kRemoteVideoStateStarting 本地用户已接收远端视频流首包。
kRemoteVideoStateDecoding 远端视频流正在解码,正常播放。
kRemoteVideoStateFrozen 远端视频流卡顿,可能有网络等原因。
kRemoteVideoStateFailed 远端视频流播放失败。

RemoteVideoStateChangeReason

enum bytertc::RemoteVideoStateChangeReason

远端视频流状态改变的原因

枚举值

类型 说明
kRemoteVideoStateChangeReasonInternal 内部原因
kRemoteVideoStateChangeReasonNetworkCongestion 网络阻塞
kRemoteVideoStateChangeReasonNetworkRecovery 网络恢复正常
kRemoteVideoStateChangeReasonLocalMuted 本地用户停止接收远端视频流或本地用户禁用视频模块
kRemoteVideoStateChangeReasonLocalUnmuted 本地用户恢复接收远端视频流或本地用户启用视频模块
kRemoteVideoStateChangeReasonRemoteMuted 远端用户停止发送视频流或远端用户禁用视频模块
kRemoteVideoStateChangeReasonRemoteUnmuted 远端用户恢复发送视频流或远端用户启用视频模块
kRemoteVideoStateChangeReasonRemoteOffline 远端用户离开频道。
状态转换参考 OnStreamRemove

AudioVolumeInfo

struct bytertc::AudioVolumeInfo

音频流来源的用户 ID 及对应的音量。

成员变量

类型 名称
int volume
const char* uid

变量说明

volume

int bytertc::AudioVolumeInfo::volume;

音量,取值范围为:[0,255]

uid

const char* bytertc::AudioVolumeInfo::uid;

音频流来源的用户 ID

PerformanceAlarmReason

enum bytertc::PerformanceAlarmReason

OnPerformanceAlarms 告警的原因

枚举值

类型 说明
kPerformanceAlarmReasonBandwidthFallbacked 网络原因差,造成了发送性能回退。仅在开启发送性能回退时,会收到此原因。
kPerformanceAlarmReasonBandwidthResumed 网络性能恢复,发送性能回退恢复。仅在开启发送性能回退时,会收到此原因。
kPerformanceAlarmReasonPerformanceFallbacked 如果未开启发送性能回退,收到此告警时,意味着性能不足;

如果开启了发送性能回退,收到此告警时,意味着性能不足,且已发生发送性能回退。
kPerformanceAlarmReasonPerformanceResumed 如果未开启发送性能回退,收到此告警时,意味着性能不足已恢复;

如果开启了发送性能回退,收到此告警时,意味着性能不足已恢复,且已发生发送性能回退恢复。

PerformanceAlarmMode

enum bytertc::PerformanceAlarmMode

是否开启发布性能回退

枚举值

类型 说明
kPerformanceAlarmModeNormal 未开启发布性能回退
kPerformanceAlarmModeSimulcast 已开启发布性能回退

SourceWantedData

struct bytertc::SourceWantedData

性能回退相关数据

成员变量

类型 名称
int width
int height
int frame_rate

变量说明

width

int bytertc::SourceWantedData::width;


未开启发布回退时,此值表示推荐的视频输入宽度,当回退模式为大小流模式时,表示当前推流的最大宽度 如果未开启发送性能回退,此值表示推荐的视频输入宽度;
如果开启了发送性能回退,此值表示当前推流的最大宽度。

height

int bytertc::SourceWantedData::height;

如果未开启发送性能回退,此值表示推荐的视频输入高度;
如果开启了发送性能回退,此值表示当前推流的最大高度。

frame_rate

int bytertc::SourceWantedData::frame_rate;

如果未开启发送性能回退,此值表示推荐的视频输入帧率,单位 fps;
如果开启了发送性能回退,此值表示当前推流的最大帧率,单位 fps。

UserInfo

struct bytertc::UserInfo

用户信息

成员变量

类型 名称
const char* uid
const char* extra_info

变量说明

uid

const char* bytertc::UserInfo::uid = nullptr;

用户 ID。该字符串符合正则表达式:[a-zA-Z0-9_@\-]{1,128}。

extra_info

const char* bytertc::UserInfo::extra_info = nullptr;

用户的额外信息,最大长度为 200 字节。会在 OnUserJoined 中回调给远端用户。

RtcRoomStats

struct bytertc::RtcRoomStats

通话相关的统计信息

成员变量

类型 名称
float txLostrate
float rxLostrate
int rtt
unsigned int duration
unsigned int tx_bytes
unsigned int rx_bytes
unsigned short tx_kbitrate
unsigned short rx_kbitrate
unsigned short rx_audio_kbitrate
unsigned short tx_audio_kbitrate
unsigned short rx_video_kbitrate
unsigned short tx_video_kbitrate
unsigned int user_count
double cpu_app_usage
int tx_jitter
int rx_jitter

变量说明

txLostrate

float bytertc::RtcRoomStats::txLostrate;

当前应用的上行丢包率,取值范围为 [0, 1]

rxLostrate

float bytertc::RtcRoomStats::rxLostrate;

当前应用的下行丢包率,取值范围为 [0, 1]

rtt

int bytertc::RtcRoomStats::rtt;

客户端到服务端数据传输的往返时延(单位 ms)

duration

unsigned int bytertc::RtcRoomStats::duration;

进房到退房之间累计时长,单位为 s

tx_bytes

unsigned int bytertc::RtcRoomStats::tx_bytes;

本地用户的总发送字节数 (bytes),累计值

rx_bytes

unsigned int bytertc::RtcRoomStats::rx_bytes;

本地用户的总接收字节数 (bytes),累计值

tx_kbitrate

unsigned short bytertc::RtcRoomStats::tx_kbitrate;

发送码率(kbps),获取该数据时的瞬时值

rx_kbitrate

unsigned short bytertc::RtcRoomStats::rx_kbitrate;

接收码率(kbps),获取该数据时的瞬时值

rx_audio_kbitrate

unsigned short bytertc::RtcRoomStats::rx_audio_kbitrate;

音频接收码率(kbps),获取该数据时的瞬时值

tx_audio_kbitrate

unsigned short bytertc::RtcRoomStats::tx_audio_kbitrate;

音频包的发送码率(kbps),获取该数据时的瞬时值

rx_video_kbitrate

unsigned short bytertc::RtcRoomStats::rx_video_kbitrate;

视频接收码率(kbps),获取该数据时的瞬时值

tx_video_kbitrate

unsigned short bytertc::RtcRoomStats::tx_video_kbitrate;

视频发送码率(kbps),获取该数据时的瞬时值

user_count

unsigned int bytertc::RtcRoomStats::user_count;

当前房间内的人数

cpu_app_usage

double bytertc::RtcRoomStats::cpu_app_usage;

当前应用的 CPU 使用率 (%)

tx_jitter

int bytertc::RtcRoomStats::tx_jitter;

系统上行网络抖动(ms)

rx_jitter

int bytertc::RtcRoomStats::rx_jitter;

系统下行网络抖动(ms)

RemoteAudioStats

struct bytertc::RemoteAudioStats

远端音频流统计信息,统计周期为 2s。
本地用户订阅远端音频流成功后,SDK 会周期性地通过 OnRemoteStreamStats 通知本地用户订阅的音频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。

成员变量

类型 名称
float audio_loss_rate
int received_kbitrate
int stall_count
int stall_duration
long e2e_delay
int playout_sample_rate
int stats_interval
int rtt
int total_rtt
int quality
int jitter_buffer_delay
int num_channels
int received_sample_rate
int frozen_rate
int concealed_samples
int concealment_event
int dec_sample_rate
int dec_duration
int jitter

变量说明

audio_loss_rate

float bytertc::RemoteAudioStats::audio_loss_rate;

音频丢包率。统计周期内的音频下行丢包率,取值范围为 [0, 1] 。

received_kbitrate

int bytertc::RemoteAudioStats::received_kbitrate;

接收码率。统计周期内的音频接收码率,单位为 kbps 。

stall_count

int bytertc::RemoteAudioStats::stall_count;

音频卡顿次数。统计周期内的卡顿次数。

stall_duration

int bytertc::RemoteAudioStats::stall_duration;

音频卡顿时长。统计周期内的卡顿时长,单位为 ms 。

e2e_delay

long bytertc::RemoteAudioStats::e2e_delay;

用户体验级别的端到端延时。从发送端采集完成编码开始到接收端解码完成渲染开始的延时,单位为 ms 。

playout_sample_rate

int bytertc::RemoteAudioStats::playout_sample_rate;

播放采样率。统计周期内的音频播放采样率信息,单位为 Hz 。

stats_interval

int bytertc::RemoteAudioStats::stats_interval;

统计间隔。此次统计周期的间隔,单位为 ms 。

rtt

int bytertc::RemoteAudioStats::rtt;

客户端到服务端数据传输的往返时延,单位为 ms。

total_rtt

int bytertc::RemoteAudioStats::total_rtt;

发送端——服务端——接收端全链路数据传输往返时延。单位为 ms 。

quality

int bytertc::RemoteAudioStats::quality;

远端用户发送的音频流质量。值含义参考 NetworkQuality 。

jitter_buffer_delay

int bytertc::RemoteAudioStats::jitter_buffer_delay;

因引入 jitter buffer 机制导致的延时。单位为 ms 。

num_channels

int bytertc::RemoteAudioStats::num_channels;

音频声道数。

received_sample_rate

int bytertc::RemoteAudioStats::received_sample_rate;

音频接收采样率。统计周期内接收到的远端音频采样率信息,单位为 Hz 。

frozen_rate

int bytertc::RemoteAudioStats::frozen_rate;

远端用户在加入房间后发生音频卡顿的累计时长占音频总有效时长的百分比。音频有效时长是指远端用户进房发布音频流后,除停止发送音频流和禁用音频模块之外的音频时长。

concealed_samples

int bytertc::RemoteAudioStats::concealed_samples;

音频丢包补偿(PLC) 样点总个数。

concealment_event

int bytertc::RemoteAudioStats::concealment_event;

音频丢包补偿(PLC) 累计次数。

dec_sample_rate

int bytertc::RemoteAudioStats::dec_sample_rate;

音频解码采样率。统计周期内的音频解码采样率信息,单位为 Hz 。

dec_duration

int bytertc::RemoteAudioStats::dec_duration;

解码时长。对此次统计周期内接收的远端音频流进行解码的总耗时,单位为 s 。

jitter

int bytertc::RemoteAudioStats::jitter;

音频下行网络抖动,单位为 ms 。

LocalAudioStats

struct bytertc::LocalAudioStats

本地音频流统计信息,统计周期为 2s 。
本地用户发布音频流成功后,SDK 会周期性地通过 OnLocalStreamStats 通知用户发布的音频流在此次统计周期内的发送状况。此数据结构即为回调给用户的参数类型。

成员变量

类型 名称
float audio_loss_rate
int send_kbitrate
int record_sample_rate
int stats_interval
int rtt
int num_channels
int sent_sample_rate
int jitter

变量说明

audio_loss_rate

float bytertc::LocalAudioStats::audio_loss_rate;

音频丢包率。此次统计周期内的音频上行丢包率,单位为 % ,取值范围为 [0, 1]。

send_kbitrate

int bytertc::LocalAudioStats::send_kbitrate;

发送码率。此次统计周期内的音频发送码率,单位为 kbps 。

record_sample_rate

int bytertc::LocalAudioStats::record_sample_rate;

采集采样率。此次统计周期内的音频采集采样率信息,单位为 Hz 。

stats_interval

int bytertc::LocalAudioStats::stats_interval;

统计间隔。此次统计周期的间隔,单位为 ms 。

注意: 此字段用于设置回调的统计周期,默认设置为 2s 。 此字段用于设置回调的统计周期,默认设置为 2s 。

rtt

int bytertc::LocalAudioStats::rtt;

往返时延。单位为 ms 。

num_channels

int bytertc::LocalAudioStats::num_channels;

音频声道数。

sent_sample_rate

int bytertc::LocalAudioStats::sent_sample_rate;

音频发送采样率。此次统计周期内的音频发送采样率信息,单位为 Hz 。

jitter

int bytertc::LocalAudioStats::jitter;

音频上行网络抖动,单位为 ms 。

MediaStreamInfo

struct bytertc::MediaStreamInfo

流属性。

成员变量

类型 名称
const char* user_id
bool is_screen
bool has_video
bool has_audio
VideoSolutionDescription* profiles
int profile_count

变量说明

user_id

const char* bytertc::MediaStreamInfo::user_id;

发布此流的用户 ID 。

is_screen

bool bytertc::MediaStreamInfo::is_screen;

此流是否为共享屏幕流。

has_video

bool bytertc::MediaStreamInfo::has_video;

此流是否包括视频流。

has_audio

bool bytertc::MediaStreamInfo::has_audio;

流是否包括音频流。

profiles

VideoSolutionDescription* bytertc::MediaStreamInfo::profiles;

视频流的属性。
当远端用户调用 SetVideoEncoderConfig 方法发布多个配置的视频流时,此处会包含该用户发布的所有视频流的属性信息。 参看 VideoSolutionDescription。

profile_count

int bytertc::MediaStreamInfo::profile_count;

不同配置流的个数。
当远端用户调用 SetVideoEncoderConfig 方法发布多个配置的视频流时,此处会包含该用户发布的视频流的数目。

SubscribeVideoConfig

struct bytertc::SubscribeVideoConfig

视频订阅配置信息

成员变量

类型 名称
int video_index
int priority

变量说明

video_index

int bytertc::SubscribeVideoConfig::video_index = 0;

订阅的视频流分辨率下标。
当远端用户通过调用 SetVideoEncoderConfig 方法启动发布多路不同分辨率的视频流时,本地用户需通过此参数指定希望订阅的流。
默认值为 0,即订阅第一路流。
如果不想更改之前的设置,可以输入 -1。

priority

int bytertc::SubscribeVideoConfig::priority = 0;

远端用户优先级,参看 RemoteUserPriority,默认值为 0。

SubscribeConfig

struct bytertc::SubscribeConfig

手动订阅流的配置信息。

成员变量

类型 名称
bool is_screen
bool sub_video
bool sub_audio
int video_index
int priority
int svc_layer

变量说明

is_screen

bool bytertc::SubscribeConfig::is_screen = false;

是否是屏幕流(默认为否)。

sub_video

bool bytertc::SubscribeConfig::sub_video;

是否订阅视频。

sub_audio

bool bytertc::SubscribeConfig::sub_audio;

是否订阅音频。

video_index

int bytertc::SubscribeConfig::video_index;

订阅的视频流分辨率下标。
用户可以通过调用 SetVideoEncoderConfig 方法在一路流中发布多个不同分辨率的视频。因此订阅流时,需要指定订阅的具体分辨率。此参数即用于指定需订阅的分辨率的下标,默认值为 0 。

priority

int bytertc::SubscribeConfig::priority = 0;

远端用户的需求优先级,参看 RemoteUserPriority,默认值为 0 。
当开启了订阅流回退选项功能(详见 SetSubscribeFallbackOption 方法),弱网或性能不足时会优先保证收到的高优先级用户的流的质量。

svc_layer

int bytertc::SubscribeConfig::svc_layer = 0;

远端用户的时域分层,参看 SVCLayer,默认值为 0 。
仅码流支持SVC特性时可以生效。

ProblemFeedbackOption

enum bytertc::ProblemFeedbackOption

音视频质量反馈问题类型

枚举值

类型 说明
kProblemFeedbackOptionNone 没有问题
kProblemFeedbackOptionOtherMessage 其他问题
kProblemFeedbackOptionAudioNotClear 声音不清晰
kProblemFeedbackOptionVideoNotClear 视频不清晰
kProblemFeedbackOptionNotSync 音视频不同步
kProblemFeedbackOptionAudioLagging 音频卡顿
kProblemFeedbackOptionVideoLagging 视频卡顿
kProblemFeedbackOptionDisconnected 连接失败
kProblemFeedbackOptionNoAudio 无声音
kProblemFeedbackOptionNoVideo 无画面
kProblemFeedbackOptionAudioStrength 声音过小
kProblemFeedbackOptionEcho 回声噪音
KFeedbackOptionEarBackDelay 耳返延迟大

VideoStreamType

enum bytertc::VideoStreamType

远端视频类型 目前C++ sdk 只支持 kVideoStreamTypeHigh 类型

枚举值

类型 说明
kVideoStreamTypeHigh 高分辨率视频流
kVideoStreamTypeLow 低分辨率视频

VideoCanvas

struct bytertc::VideoCanvas

画布信息和渲染模式。
你应使用 SetLocalVideoCanvas 将视频流绑定到本地视图。

成员变量

类型 名称
void* view
int render_mode
const char* uid
void* priv

变量说明

view

void* bytertc::VideoCanvas::view;

本地视图句柄

render_mode

int bytertc::VideoCanvas::render_mode;

渲染模式,参看 RenderMode

uid

const char* bytertc::VideoCanvas::uid;

视图对应的用户 ID

priv

void* bytertc::VideoCanvas::priv;

你的自定义数据,SDK 透传该数据。

RemoteVideoStats

struct bytertc::RemoteVideoStats

远端音频流统计信息,统计周期为 2s 。
本地用户订阅远端音频流成功后,SDK 会周期性地通过 OnRemoteStreamStats 通知本地用户订阅的远端视频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。

成员变量

类型 名称
int width
int height
float video_loss_rate
int received_kbitrate
int decoder_output_frame_rate
int renderer_output_frame_rate
int stall_count
int stall_duration
long e2e_delay
bool is_screen
int stats_interval
int rtt
int frozen_rate
int video_index
int jitter

变量说明

width

int bytertc::RemoteVideoStats::width;

视频宽度

height

int bytertc::RemoteVideoStats::height;

视频高度

video_loss_rate

float bytertc::RemoteVideoStats::video_loss_rate;

视频丢包率。统计周期内的视频下行丢包率,单位为 % ,取值范围:[0,1] 。

received_kbitrate

int bytertc::RemoteVideoStats::received_kbitrate;

接收码率。统计周期内的视频接收码率,单位为 kbps 。

decoder_output_frame_rate

int bytertc::RemoteVideoStats::decoder_output_frame_rate;

解码器输出帧率。统计周期内的视频解码器输出帧率,单位 fps 。

renderer_output_frame_rate

int bytertc::RemoteVideoStats::renderer_output_frame_rate;

渲染帧率。统计周期内的视频渲染帧率,单位 fps 。

stall_count

int bytertc::RemoteVideoStats::stall_count;

卡顿次数。统计周期内的卡顿次数。

stall_duration

int bytertc::RemoteVideoStats::stall_duration;

卡顿时长。统计周期内的视频卡顿总时长。单位 ms 。

e2e_delay

long bytertc::RemoteVideoStats::e2e_delay;

用户体验级别的端到端延时。从发送端采集完成编码开始到接收端解码完成渲染开始的延时,单位为 ms 。

is_screen

bool bytertc::RemoteVideoStats::is_screen;

所属用户的媒体流是否为屏幕流。你可以知道当前数据来自主流还是屏幕流。

stats_interval

int bytertc::RemoteVideoStats::stats_interval;

统计间隔,此次统计周期的间隔,单位为 ms 。

注意: 此字段用于设置回调的统计周期,目前设置为 2s 。 此字段用于设置回调的统计周期,目前设置为 2s 。

rtt

int bytertc::RemoteVideoStats::rtt;

往返时延,单位为 ms 。

frozen_rate

int bytertc::RemoteVideoStats::frozen_rate;

远端用户在进房后发生视频卡顿的累计时长占视频总有效时长的百分比(%)。视频有效时长是指远端用户进房发布视频流后,除停止发送视频流和禁用视频模块之外的视频时长。

video_index

int bytertc::RemoteVideoStats::video_index;

对应多种分辨率的流的下标,详见 VideoSolutionDescription

jitter

int bytertc::RemoteVideoStats::jitter;

视频下行网络抖动,单位为 ms 。

LocalVideoStats

struct bytertc::LocalVideoStats

本地视频流统计信息,统计周期为 2s 。
本地用户发布视频流成功后,SDK 会周期性地通过 OnLocalStreamStats 通知用户发布的视频流在此次统计周期内的发送状况。此数据结构即为回调给用户的参数类型。

成员变量

类型 名称
int sent_kbitrate
int input_frame_rate
int sent_frame_rate
int encoder_output_frame_rate
int renderer_output_frame_rate
int target_kbitrate
int target_frame_rate
int stats_interval
float video_loss_rate
int rtt
int encoded_bitrate
int encoded_frame_width
int encoded_frame_height
int encoded_frame_count
VideoCodecType codec_type
bool is_screen
int jitter

变量说明

sent_kbitrate

int bytertc::LocalVideoStats::sent_kbitrate;

发送码率。此次统计周期内的视频发送码率,单位为 kbps 。

input_frame_rate

int bytertc::LocalVideoStats::input_frame_rate;

采集帧率。此次统计周期内的视频采集帧率,单位为 fps 。

sent_frame_rate

int bytertc::LocalVideoStats::sent_frame_rate;

发送帧率。此次统计周期内的视频发送帧率,单位为 fps 。

encoder_output_frame_rate

int bytertc::LocalVideoStats::encoder_output_frame_rate;

编码器输出帧率。当前编码器在此次统计周期内的输出帧率,单位为 fps 。

renderer_output_frame_rate

int bytertc::LocalVideoStats::renderer_output_frame_rate;

本地渲染帧率。此次统计周期内的本地视频渲染帧率,单位为 fps 。

target_kbitrate

int bytertc::LocalVideoStats::target_kbitrate;

目标发送码率。此次统计周期内的视频目标发送码率,单位为 kbps 。

target_frame_rate

int bytertc::LocalVideoStats::target_frame_rate;

目标发送帧率。当前编码器在此次统计周期内的目标发送帧率,单位为 fps 。

stats_interval

int bytertc::LocalVideoStats::stats_interval;

统计间隔,单位为 ms 。

注意: 此字段用于设置回调的统计周期,默认设置为 2s 。 此字段用于设置回调的统计周期,默认设置为 2s 。

video_loss_rate

float bytertc::LocalVideoStats::video_loss_rate;

视频丢包率。此次统计周期内的视频上行丢包率,取值范围为 [0,1] 。

rtt

int bytertc::LocalVideoStats::rtt;

往返时延,单位为 ms 。

encoded_bitrate

int bytertc::LocalVideoStats::encoded_bitrate;

视频编码码率。此次统计周期内的视频编码码率,单位为 kbps 。

encoded_frame_width

int bytertc::LocalVideoStats::encoded_frame_width;

视频编码宽度,单位为 px 。

encoded_frame_height

int bytertc::LocalVideoStats::encoded_frame_height;

视频编码高度,单位为 px 。

encoded_frame_count

int bytertc::LocalVideoStats::encoded_frame_count;

此次统计周期内发送的视频帧总数。

codec_type

VideoCodecType bytertc::LocalVideoStats::codec_type;

视频的编码类型,具体参考 VideoCodecType 。

is_screen

bool bytertc::LocalVideoStats::is_screen;

所属用户的媒体流是否为屏幕流。你可以知道当前统计数据来自主流还是屏幕流。

jitter

int bytertc::LocalVideoStats::jitter;

视频上行网络抖动,单位为 ms 。

LocalStreamStats

struct bytertc::LocalStreamStats

本地音/视频流统计信息以及网络状况,统计周期为 2s 。
本地用户发布音/视频流成功后,SDK 会周期性地通过 OnLocalStreamStats 通知本地用户发布的音/视频流在此次统计周期内的发送状况。此数据结构即为回调给用户的参数类型。

成员变量

类型 名称
LocalAudioStats audio_stats
LocalVideoStats video_stats
NetworkQuality local_tx_quality
NetworkQuality local_rx_quality
bool is_screen

变量说明

audio_stats

LocalAudioStats bytertc::LocalStreamStats::audio_stats;

本地设备发送音频流的统计信息,详见 LocalAudioStats

video_stats

LocalVideoStats bytertc::LocalStreamStats::video_stats;

本地设备发送视频流的统计信息,详见 LocalVideoStats

local_tx_quality

NetworkQuality bytertc::LocalStreamStats::local_tx_quality;

所属用户的媒体流上行网络质量,详见 NetworkQuality

local_rx_quality

NetworkQuality bytertc::LocalStreamStats::local_rx_quality;

所属用户的媒体流下行网络质量,详见 NetworkQuality

is_screen

bool bytertc::LocalStreamStats::is_screen;

所属用户的媒体流是否为屏幕流。你可以知道当前统计数据来自主流还是屏幕流。

RemoteStreamStats

struct bytertc::RemoteStreamStats

用户订阅的远端音/视频流统计信息以及网络状况,统计周期为 2s 。
订阅远端用户发布音/视频流成功后,SDK 会周期性地通过 OnRemoteStreamStats 通知本地用户订阅的远端音/视频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。

成员变量

类型 名称
const char* uid
RemoteAudioStats audio_stats
RemoteVideoStats video_stats
NetworkQuality remote_tx_quality
NetworkQuality remote_rx_quality
bool is_screen

变量说明

uid

const char* bytertc::RemoteStreamStats::uid;

用户 ID 。音频来源的远端用户 ID 。

audio_stats

RemoteAudioStats bytertc::RemoteStreamStats::audio_stats;

远端音频流的统计信息,详见 RemoteAudioStats

video_stats

RemoteVideoStats bytertc::RemoteStreamStats::video_stats;

远端视频流的统计信息,详见 RemoteVideoStats

remote_tx_quality

NetworkQuality bytertc::RemoteStreamStats::remote_tx_quality;

所属用户的媒体流上行网络质量,详见 NetworkQuality

remote_rx_quality

NetworkQuality bytertc::RemoteStreamStats::remote_rx_quality;

所属用户的媒体流下行网络质量,详见 NetworkQuality

is_screen

bool bytertc::RemoteStreamStats::is_screen;

所属用户的媒体流是否为屏幕流。你可以知道当前统计数据来自主流还是屏幕流。

SysStats

struct bytertc::SysStats

App 使用的 cpu 和内存信息。
信息由 SDK 周期性(2s)地通过 OnSysStats 回调通知给用户。

成员变量

类型 名称
unsigned int cpu_cores
double cpu_app_usage
double cpu_total_usage
double memory_usage
unsigned long long full_memory
unsigned long long total_memory_usage
unsigned long long free_memory
double memory_ratio
double total_memory_ratio

变量说明

cpu_cores

unsigned int bytertc::SysStats::cpu_cores;

当前系统 CPU 核数

cpu_app_usage

double bytertc::SysStats::cpu_app_usage;

当前应用的 cpu 使用率,取值范围为 [0, 1]。

cpu_total_usage

double bytertc::SysStats::cpu_total_usage;

当前系统的 cpu 使用率,取值范围为 [0, 1]。

memory_usage

double bytertc::SysStats::memory_usage;

当前应用的内存使用量(单位 MB)

full_memory

unsigned long long bytertc::SysStats::full_memory;

全量内存(单位字节)

total_memory_usage

unsigned long long bytertc::SysStats::total_memory_usage;

系统已使用内存(单位字节)

free_memory

unsigned long long bytertc::SysStats::free_memory;

空闲可分配内存(单位字节)

memory_ratio

double bytertc::SysStats::memory_ratio;

当前应用的内存使用率(单位 %)

total_memory_ratio

double bytertc::SysStats::total_memory_ratio;

系统内存使用率(单位 %)

view_t

typedef void* bytertc::view_t

windows 窗口 id, windows 平台下传 windows 窗口句柄

Rectangle

struct bytertc::Rectangle

矩形,用于屏幕共享指定区域, 默认值表示抓取整个屏幕

成员变量

类型 名称
int x
int y
int width
int height

变量说明

x

int bytertc::Rectangle::x = 0;

矩形区域左上角的 x 坐标

y

int bytertc::Rectangle::y = 0;

矩形区域左上角的 y 坐标

width

int bytertc::Rectangle::width = 0;

矩形宽度

height

int bytertc::Rectangle::height = 0;

矩形高度

HighlightConfig

struct bytertc::HighlightConfig

屏幕共享时的边框高亮设置

成员变量

类型 名称
bool enable_highlight
uint32_t border_color
int border_width

变量说明

enable_highlight

bool bytertc::HighlightConfig::enable_highlight = true;

是否显示高亮边框,默认显示。

border_color

uint32_t bytertc::HighlightConfig::border_color = 0xFF29CCA3;

边框的颜色, 颜色格式为十六进制 ARGB: 0xAARRGGBB

border_width

int bytertc::HighlightConfig::border_width = 4;

边框的宽度,单位:像素

ScreenFilterConfig

struct bytertc::ScreenFilterConfig

抓取屏幕时排除指定窗口,默认不排除任何窗体

成员变量

类型 名称
view_t* excluded_window_list
int excluded_window_num

变量说明

excluded_window_list

view_t* bytertc::ScreenFilterConfig::excluded_window_list = nullptr;

抓取屏幕时排除窗口列表。这个参数仅在抓取屏幕时生效。

excluded_window_num

int bytertc::ScreenFilterConfig::excluded_window_num = 0;

排除窗口的数量。

MouseCursorCaptureState

enum bytertc::MouseCursorCaptureState

内部采集屏幕视频流时,是否采集鼠标信息

枚举值

类型 说明
kMouseCursorCaptureStateOn 采集鼠标信息
kMouseCursorCaptureStateOff 不采集鼠标信息

ScreenCaptureParameters

struct bytertc::ScreenCaptureParameters

屏幕共享时,内部采集参数配置

成员变量

类型 名称
Rectangle region_rect
MouseCursorCaptureState capture_mouse_cursor
ScreenFilterConfig filter_config
HighlightConfig highlight_config

变量说明

region_rect

Rectangle bytertc::ScreenCaptureParameters::region_rect;

采集区域,参看 Rectangle

capture_mouse_cursor

MouseCursorCaptureState bytertc::ScreenCaptureParameters::capture_mouse_cursor;

是否采集鼠标状态,参看 MouseCursorCaptureState

filter_config

ScreenFilterConfig bytertc::ScreenCaptureParameters::filter_config;

屏幕过滤设置,参看 ScreenFilterConfig

highlight_config

HighlightConfig bytertc::ScreenCaptureParameters::highlight_config;

采集区域的边框高亮设置,参看 HighlightConfig

DesktopCaptureParameters

struct bytertc::DesktopCaptureParameters

屏幕共享的编码参数配置

成员变量

类型 名称
int max_width
int max_height
int frame_rate
int bitrate
bool capture_mouse_cursor
view_t* excluded_window_list
int excluded_window_num
HighlightConfig highlight_config

变量说明

max_width

int bytertc::DesktopCaptureParameters::max_width = 1920;

屏幕采集编码最大宽度

max_height

int bytertc::DesktopCaptureParameters::max_height = 1080;

屏幕采集编码最大高度

frame_rate

int bytertc::DesktopCaptureParameters::frame_rate = 15;

屏幕采集编码帧率, 单位 fps

bitrate

int bytertc::DesktopCaptureParameters::bitrate = -1;

屏幕采集编码码率, -1 为自动码率, SDK 会根据宽高信息选择合适的码率,单位 kbps

capture_mouse_cursor

bool bytertc::DesktopCaptureParameters::capture_mouse_cursor = true;

是否捕获鼠标光标

excluded_window_list

view_t* bytertc::DesktopCaptureParameters::excluded_window_list = nullptr;

抓取屏幕时排除窗口列表。这个参数仅在抓取屏幕时生效。

excluded_window_num

int bytertc::DesktopCaptureParameters::excluded_window_num = 0;

抓取屏幕时排除的窗口数量。

highlight_config

HighlightConfig bytertc::DesktopCaptureParameters::highlight_config;

高亮边框的配置

EncryptType

enum bytertc::EncryptType

自定义加密类型

枚举值

类型 说明
kEncryptTypeCustomize 不使用内置加密。默认值。
kEncryptTypeAES128CBC AES-128-CBC 加密算法
kEncryptTypeAES256CBC AES-256-CBC 加密算法
kEncryptTypeAES128ECB AES-128-ECB 加密算法
kEncryptTypeAES256ECB = 4 AES-256-ECB 加密算法

AudioMixingState

enum bytertc::AudioMixingState

音频混音文件播放状态。

枚举值

类型 说明
kAudioMixingStatePreloaded 混音已加载
kAudioMixingStatePlaying 混音正在播放
kAudioMixingStatePaused 混音暂停
kAudioMixingStateStopped 混音停止
kAudioMixingStateFailed 混音播放失败
kAudioMixingStateFinished 混音播放结束
kAudioMixingStatePCMEnabled 准备PCM混音
kAudioMixingStatePCMDisabled PCM混音播放结束

AudioMixingError

enum bytertc::AudioMixingError

音频混音文件播放错误码。

枚举值

类型 说明
kAudioMixingErrorOk 混音错误码,正常
kAudioMixingErrorPreloadFailed 预加载失败,找不到混音文件或者文件长度超出 20s
kAudioMixingErrorStartFailed 混音开启失败,找不到混音文件或者混音文件打开失败
kAudioMixingErrorIdNotFound 混音 ID 异常
kAudioMixingErrorSetPositionFailed 设置混音文件的播放位置出错
kAudioMixingErrorInValidVolume 音量参数不合法,仅支持设置的音量值为[0 400]
kAudioMixingErrorLoadConflict 播放的文件与预加载的文件不一致,请先使用 UnloadAudioMixing 卸载文件
kAudioMixingErrorIdTypeNotMatch 混音 ID 类型不匹配,当前操作接口不支持该 ID 代表的音频流类型
kAudioMixingErrorInValidPitch 设置混音文件的音调不合法
kAudioMixingErrorInValidAudioTrack 设置混音文件的音轨不合法

IVideoSink

class bytertc::IVideoSink

自定义视频渲染器

成员函数

返回 名称
virtual bool OnFrame
virtual void Release

函数说明

OnFrame

virtual bool bytertc::IVideoSink::OnFrame(
    IVideoFrame* videoFrame)

视频帧回调

传入参数

参数名 类型 说明
videoFrame IVideoFrame* 视频帧结构类,参看 IVideoFrame

返回值 返回值暂未使用

Release

virtual void bytertc::IVideoSink::Release()

释放渲染器。

注意 通知开发者渲染器即将被废弃。收到该返回通知后即可释放资源。

PixelFormat

enum bytertc::IVideoSink::PixelFormat

视频帧编码格式

枚举值

类型 说明
kI420 YUV I420 格式
kOriginal 原始视频帧格式

RtcUser

struct bytertc::RtcUser

用户信息

成员变量

类型 名称
const char* user_id
const char* meta_data

变量说明

user_id

const char* bytertc::RtcUser::user_id;

meta_data

const char* bytertc::RtcUser::meta_data;

FirstFrameSendState

enum bytertc::FirstFrameSendState

首帧发送状态

枚举值

类型 说明
kFirstFrameSendStateSending 发送中
kFirstFrameSendStateSent 发送成功
kFirstFrameSendStateEnd 发送失败

FirstFramePlayState

enum bytertc::FirstFramePlayState

首帧播放状态

枚举值

类型 说明
kFirstFramePlayStatePlaying 播放中
kFirstFramePlayStatePlayed 播放成功
kFirstFramePlayStateEnd 播放失败

EarMonitorMode

enum bytertc::EarMonitorMode

是否开启耳返功能

枚举值

类型 说明
kEarMonitorModeOff 不开启
kEarMonitorModeOn 开启

MirrorType

enum bytertc::MirrorType

镜像类型

枚举值

类型 说明
kMirrorTypeNone 本地预览和编码传输时均无镜像效果
kMirrorTypeRender 本地预览时有镜像效果,编码传输时无镜像效果
kMirrorTypeRenderAndEncoder 本地预览和编码传输时均有镜像效果

MuteState

enum bytertc::MuteState

音视频流的发送/播放状态

枚举值

类型 说明
kMuteStateOff 发送
kMuteStateOn 停止发送

StreamIndex

enum bytertc::StreamIndex

流属性

枚举值

类型 说明
kStreamIndexMain 主流。包括:

+ 由摄像头/麦克风通过内部采集机制,采集到的视频/音频;

+ 通过自定义采集,采集到的视频/音频。
kStreamIndexScreen 屏幕流。屏幕共享时共享的视频流,或来自声卡的本地播放音频流。

RemoteStreamKey

struct bytertc::RemoteStreamKey

远端流信息

成员变量

类型 名称
const char* room_id
const char* user_id
StreamIndex stream_index

变量说明

room_id

const char* bytertc::RemoteStreamKey::room_id;

房间 ID

user_id

const char* bytertc::RemoteStreamKey::user_id;

用户 ID

stream_index

StreamIndex bytertc::RemoteStreamKey::stream_index;

流属性,主流或屏幕流。参看 StreamIndex

AudioSourceType

enum bytertc::AudioSourceType

音频输入源类型

枚举值

类型 说明
kAudioSourceTypeExternal
kAudioSourceTypeInternal

VideoSourceType

enum bytertc::VideoSourceType

视频输入源类型

枚举值

类型 说明
VideoSourceTypeExternal 自定义采集视频源
VideoSourceTypeInternal 内部采集视频源
VideoSourceTypeEncodedWithAutoSimulcast 自定义编码视频源。

你仅需推送分辨率最大的一路编码后视频流,SDK 将自动转码生成多路小流
VideoSourceTypeEncodedWithoutAutoSimulcast 自定义编码视频源。

SDK 不会自动生成多路流,你需要自行生成并推送多路流

VideoFrameInfo

struct bytertc::VideoFrameInfo

视频帧信息

成员变量

类型 名称
int width
int height
VideoRotation rotation

变量说明

width

int bytertc::VideoFrameInfo::width = 0;

宽(像素)

height

int bytertc::VideoFrameInfo::height = 0;

高(像素)

rotation

VideoRotation bytertc::VideoFrameInfo::rotation = VideoRotation::kVideoRotation0;

视频帧顺时针旋转角度。参看 VideoRotation。

AudioSampleRate

enum bytertc::AudioSampleRate

音频采样率,单位为 Hz。

枚举值

类型 说明
kAudioSampleRateAuto 默认设置。
kAudioSampleRate8000 8000 Hz
kAudioSampleRate16000 16000 Hz
kAudioSampleRate32000 32000 Hz
kAudioSampleRate44100 44100 Hz
kAudioSampleRate48000 = 48000 48000 Hz

AudioChannel

enum bytertc::AudioChannel

音频声道。

枚举值

类型 说明
kAudioChannelAuto 默认设置。
kAudioChannelMono 单声道
kAudioChannelStereo = 2 双声道

AudioFormat

struct bytertc::AudioFormat

音频参数格式

成员变量

类型 名称
AudioSampleRate sample_rate
AudioChannel channel

变量说明

sample_rate

AudioSampleRate bytertc::AudioFormat::sample_rate;

音频采样率,详见 AudioSampleRate

channel

AudioChannel bytertc::AudioFormat::channel;

音频声道,详见 AudioChannel

HttpProxyState

enum bytertc::HttpProxyState

HTTP/HTTPS 代理状态

枚举值

类型 说明
kHttpInit HTTP/HTTPS 初始化状态
kHttpConnected HTTP/HTTPS 连接成功
kHttpError HTTP/HTTPS 连接失败

Socks5ProxyState

enum bytertc::Socks5ProxyState

SOCKS5 代理连接状态

枚举值

类型 说明
kSocks5Init SOCKS5 连接初始化
kSocks5Connected SOCKS5 连接成功
kSocks5Error SOCKS5 连接错误
kSocks5TcpConnectFail TCP 连接失败
kSocks5TcpClose TCP 连接关闭
kSocks5ProtocolTcpFail SOCKS 协议 TCP 协商阶段失败
kSocks5ProtocolUdpFail UDP 连接失败
kSocks5AuthFail 授权失败
kSocks5Unknown 未知状态

ASRAuthorizationType

enum bytertc::ASRAuthorizationType

语音识别服务鉴权方式,详情请咨询语音识别服务服务相关同学

枚举值

类型 说明
kASRAuthorizationTypeToken Token 鉴权
kASRAuthorizationTypeSignature Signature 鉴权

RTCASRConfig

struct bytertc::RTCASRConfig

使用自动语音识别服务所需校验信息

成员变量

类型 名称
const char* app_id
const char* user_id
ASRAuthorizationType authorization_type
const char* access_token
const char* secret_key
const char* cluster

变量说明

app_id

const char* bytertc::RTCASRConfig::app_id;

应用 ID

user_id

const char* bytertc::RTCASRConfig::user_id;

用户 ID

authorization_type

ASRAuthorizationType bytertc::RTCASRConfig::authorization_type;

鉴权方式,参看 ASRAuthorizationType

access_token

const char* bytertc::RTCASRConfig::access_token;

访问令牌

secret_key

const char* bytertc::RTCASRConfig::secret_key;

私钥。Signature 鉴权模式下不能为空,token 鉴权模式下为空。参看关于鉴权

cluster

const char* bytertc::RTCASRConfig::cluster;

场景信息,参看业务集群

RTCASRErrorCode

enum bytertc::RTCASRErrorCode

语音识别服务错误码。
除网络原因导致的错误,语音识别服务内部会自行重试之外,其他错误都会停止服务,此时建议再次调用 StartASR 重启语音识别功能。

枚举值

类型 说明
kRTCASRErrorNetworkInterrupted 网络连接中断,服务不可用,内部会进行重连
kRTCASRErrorAlreadyStarted 重复调用 StartASR。开启语音识别服务后,你需要先调用 StopASR 停止语音识别服务,才能二次调用 StartASR 再次开启服务。
kRTCASRErrorTokenEmpty 语音识别服务所需 token 为空
kRTCErrorSignatureKeyEmpty Signature 鉴权模式下 secret_key 为空
kRTCASRErrorUserIdNull 用户 ID 为空
kRTCASRErrorAPPIDNull 应用 ID 为空
kRTCASRErrorClusterNull 语音识别服务 cluster 为空
kRTCASRErrorOperationDenied = -8 语音识别服务连接失败,该版本没有语音识别功能,请联系 RTC 技术支持。

RecordingType

enum bytertc::RecordingType

本地录制的媒体类型

枚举值

类型 说明
kRecordAudioOnly 只录制音频
kRecordVideoOnly 只录制视频
kRecordVideoAndAudio 同时录制音频和视频

RecordingFileType

enum bytertc::RecordingFileType

本地录制文件的存储格式

枚举值

类型 说明
kRecordingFileTypeAAC aac 格式文件
kRecordingFileTypeMP4 mp4 格式文件

RecordingState

enum bytertc::RecordingState

本地录制的状态

枚举值

类型 说明
kRecordingStateError 录制异常
kRecordingStateProcessing 录制进行中
kRecordingStateSuccess 录制文件保存成功,调用 StopFileRecording 结束录制之后才会收到该状态码。

RecordingErrorCode

enum bytertc::RecordingErrorCode

本地录制的错误码

枚举值

类型 说明
kRecordingErrorCodeOk 录制正常
kRecordingErrorCodeNoPermission 没有文件写权限
kRecordingErrorCodeNotSupport 当前版本 SDK 不支持本地录制功能,请联系技术支持人员
kRecordingErrorCodeOther 其他异常

RecordingProgress

struct bytertc::RecordingProgress

本地录制进度

成员变量

类型 名称
unsigned long long duration
unsigned long long file_size

变量说明

duration

unsigned long long bytertc::RecordingProgress::duration;

当前文件的累计录制时长,单位:毫秒

file_size

unsigned long long bytertc::RecordingProgress::file_size;

当前录制文件的大小,单位:byte

RecordingInfo

struct bytertc::RecordingInfo

本地录制的详细信息

成员变量

类型 名称
const char* file_path
VideoCodecType video_codec_type
int width
int height

变量说明

file_path

const char* bytertc::RecordingInfo::file_path;

录制文件的绝对路径,包含文件名和文件后缀

video_codec_type

VideoCodecType bytertc::RecordingInfo::video_codec_type;

录制文件的视频编码类型,参看 VideoCodecType

width

int bytertc::RecordingInfo::width;

录制视频的宽,单位:像素。纯音频录制请忽略该字段

height

int bytertc::RecordingInfo::height;

录制视频的高,单位:像素。纯音频录制请忽略该字段

RecordingConfig

struct bytertc::RecordingConfig

本地录制参数配置

成员变量

类型 名称
const char* dir_path
RecordingFileType file_type
RecordingType recording_type

变量说明

dir_path

const char* bytertc::RecordingConfig::dir_path;

录制文件保存的绝对路径。你需要指定一个有读写权限的合法路径。

file_type

RecordingFileType bytertc::RecordingConfig::file_type;

录制存储文件格式,参看 RecordingFileType

recording_type

RecordingType bytertc::RecordingConfig::recording_type;

录制媒体类型,参看 RecordingType

AudioMixingType

enum bytertc::AudioMixingType

混音播放类型

枚举值

类型 说明
kAudioMixingTypePlayout 仅本地播放
kAudioMixingTypePublish 仅发送到远端
kAudioMixingTypePlayoutAndPublish 在本地播放并发送到远端

AudioMixingConfig

struct bytertc::AudioMixingConfig

混音配置

成员变量

类型 名称
AudioMixingType type
int play_count
int position
int64_t callback_on_progress_interval

变量说明

type

AudioMixingType bytertc::AudioMixingConfig::type;

混音播放类型,详见 AudioMixingType

play_count

int bytertc::AudioMixingConfig::play_count;

混音播放次数,

注意:

position

int bytertc::AudioMixingConfig::position;

混音时音频文件播放进度条位置,参数为整数,单位为毫秒

callback_on_progress_interval

int64_t bytertc::AudioMixingConfig::callback_on_progress_interval = 0;

设置音频文件播放进度回调的时间间隔,单位毫秒,并按照设置的值触发 OnAudioMixingPlayingProgress 回调,默认不回调。

AudioMixingDualMonoMode

enum bytertc::AudioMixingDualMonoMode

混音播放声道类型

枚举值

类型 说明
kAudioMixingDualMonoModeAuto 和音频文件一致
kAudioMixingDualMonoModeL 只能听到音频文件中左声道的音频
kAudioMixingDualMonoModeR 只能听到音频文件中右声道的音频
kAudioMixingDualMonoModeMix 能同时听到音频文件中左右声道的音频

UserWorkerType

enum bytertc::UserWorkerType

定义linux用户的用户功能

枚举值

类型 说明
UserWorkerNormal 正常用户,没有任何特殊属性
UserWorkerSupportSip 用户支持SIP流,信令只下发SIP流
UserWorkerByteVc1Transcoder 用户支持屏幕流的bytevc1到H264转码
UserWorkerNeedUserListAndCb 用户需要信令服务器下发全量的用户列表和回调函数
UserWorkerNeedStreamCallBack 用户需要在房间进入多人模式时获取房间内所有流的相关回调

VideoPreprocessorConfig

struct bytertc::VideoPreprocessorConfig

视频前处理配置参数。

成员变量

类型 名称
VideoPixelFormat required_pixel_format

变量说明

required_pixel_format

VideoPixelFormat bytertc::VideoPreprocessorConfig::required_pixel_format = kVideoPixelFormatUnknown;

视频帧像素格式,参看 VideoPixelFormat

VideoRateInfo

struct bytertc::VideoRateInfo

自定义编码流信息

成员变量

类型 名称
int fps
int bitrate_kbps

变量说明

fps

int bytertc::VideoRateInfo::fps;

帧率,单位 fps

bitrate_kbps

int bytertc::VideoRateInfo::bitrate_kbps;

码率,单位 kbps

VideoDecoderConfig

enum bytertc::VideoDecoderConfig

视频解码方式

枚举值

类型 说明
kVideoDecoderConfigRaw 开启 SDK 内部解码,只回调解码后的数据
kVideoDecoderConfigEncode 开启自定义解码,只回调解码前数据
kVideoDecoderConfigBoth 开启 SDK 内部解码,同时回调解码前和解码后的数据

CapturePreference

enum bytertc::VideoCaptureConfig::CapturePreference

视频采集模式

枚举值

类型 说明
KAuto (默认)自动设置采集参数。
SDK在开启采集时根据服务端下发的采集配置结合编码参数设置最佳采集参数。
KManual 手动设置采集参数,包括采集分辨率、帧率。
KAutoPerformance 采集参数与编码参数一致,即在 SetVideoEncoderConfig 中设置的参数。

AudioPropertiesConfig

struct bytertc::AudioPropertiesConfig

音频属性信息提示的相关配置

成员变量

类型 名称
int interval
bool enable_spectrum
bool enable_vad

变量说明

interval

int bytertc::AudioPropertiesConfig::interval;

信息提示间隔,单位:ms

注意:

enable_spectrum

bool bytertc::AudioPropertiesConfig::enable_spectrum = false;

是否开启音频频谱检测

enable_vad

bool bytertc::AudioPropertiesConfig::enable_vad = false;

是否开启人声检测 (VAD)

AudioPropertiesInfo

struct bytertc::AudioPropertiesInfo

音频属性信息

成员变量

类型 名称
int volume
float spectrum
int vad

变量说明

volume

int bytertc::AudioPropertiesInfo::volume;

音量,取值范围为:[0, 255]

spectrum

float bytertc::AudioPropertiesInfo::spectrum[SPECTRUM_SIZE] = {0};

频谱数组。默认长度为 257。

vad

int bytertc::AudioPropertiesInfo::vad = -1;

人声检测(VAD)结果

注意:

RemoteAudioPropertiesInfo

struct bytertc::RemoteAudioPropertiesInfo

远端音频属性信息

成员变量

类型 名称
RemoteStreamKey stream_key
AudioPropertiesInfo audio_properties_info

变量说明

stream_key

RemoteStreamKey bytertc::RemoteAudioPropertiesInfo::stream_key;

远端流信息,详见 RemoteStreamKey

audio_properties_info

AudioPropertiesInfo bytertc::RemoteAudioPropertiesInfo::audio_properties_info;

音频属性信息,详见 AudioPropertiesInfo

LocalAudioPropertiesInfo

struct bytertc::LocalAudioPropertiesInfo

本地音频属性信息

成员变量

类型 名称
StreamIndex stream_index
AudioPropertiesInfo audio_properties_info

变量说明

stream_index

StreamIndex bytertc::LocalAudioPropertiesInfo::stream_index;

流属性,主流或屏幕流。参看 StreamIndex

audio_properties_info

AudioPropertiesInfo bytertc::LocalAudioPropertiesInfo::audio_properties_info;

音频属性信息,详见 AudioPropertiesInfo

AudioProfileType

enum bytertc::AudioProfileType

音质档位 调用 SetAudioProfile 设置的音质档位

枚举值

类型 说明
kAudioProfileTypeDefault 默认音质
服务器下发或客户端已设置的 RoomProfileType 的音质配置
kAudioProfileTypeFluent 流畅音质。

单声道,采样率为 16kHz,编码码率为 24kbps。

流畅优先、低延迟、低功耗、低流量消耗,适用于大部分游戏场景,如 MMORPG、MOBA、FPS 等游戏中的小队语音、组队语音、国战语音等。
kAudioProfileTypeStandard 标准音质。

单声道,采样率为 48kHz,编码码率为 48kbps。

适用于对音质有一定要求的场景,同时延时、功耗和流量消耗相对适中,适合教育场景和 Sirius 等狼人杀类游戏。
kAudioProfileTypeHD 高清音质

双声道,采样率为 48kHz,编码码率为 128kbps。

超高音质,同时延时、功耗和流量消耗相对较大,适用于连麦 PK 等音乐场景。

游戏场景不建议使用。

SyncInfoStreamType

enum bytertc::SyncInfoStreamType

媒体流信息同步的流类型

枚举值

类型 说明
kSyncInfoStreamTypeAudio = 0 音频流

StreamSycnInfoConfig

struct bytertc::StreamSycnInfoConfig

媒体流信息同步的相关配置

成员变量

类型 名称
StreamIndex stream_index
int repeat_count
SyncInfoStreamType stream_type

变量说明

stream_index

StreamIndex bytertc::StreamSycnInfoConfig::stream_index;

流属性,主流或屏幕流。见 StreamIndex

repeat_count

int bytertc::StreamSycnInfoConfig::repeat_count;

消息发送的重复次数,取值范围是 [0,25],建议设置为 [3,5]。

stream_type

SyncInfoStreamType bytertc::StreamSycnInfoConfig::stream_type;

媒体流信息同步的流类型,见 SyncInfoStreamType

ForwardStreamInfo

struct bytertc::ForwardStreamInfo

媒体流跨房间转发的目标房间的相关信息

成员变量

类型 名称
const char* token
const char* room_id

变量说明

token

const char* bytertc::ForwardStreamInfo::token;

用于向该房间转发媒体流的 Token。
如果 Token 无效,转发失败。

room_id

const char* bytertc::ForwardStreamInfo::room_id;

跨间转发媒体流过程中目标房间 ID

ForwardStreamConfiguration

struct bytertc::ForwardStreamConfiguration

媒体流跨房间转发的目标房间的相关信息

成员变量

类型 名称
ForwardStreamInfo* forward_stream_dests
int dest_count

变量说明

forward_stream_dests

ForwardStreamInfo* bytertc::ForwardStreamConfiguration::forward_stream_dests = nullptr;

目标房间信息,数组中的每个元素包含一个房间的信息。

dest_count

int bytertc::ForwardStreamConfiguration::dest_count = 0;

目标房间数量。媒体流同时转发的目标房间数量建议小于等于 4 个。

ForwardStreamState

enum bytertc::ForwardStreamState

媒体流跨房间转发状态

枚举值

类型 说明
kForwardStreamStateIdle 空闲状态
+ 成功调用 StopForwardStreamToRooms 后,所有目标房间为空闲状态。
+ 成功调用 UpdateForwardStreamToRooms 减少目标房间后,本次减少的目标房间为空闲状态。
kForwardStreamStateSuccess 开始转发
+ 调用 StartForwardStreamToRooms 成功向所有房间开始转发媒体流后,返回此状态。
+ 调用 UpdateForwardStreamToRooms 后,成功向新增目标房间开始转发媒体流后,返回此状态。
kForwardStreamStateFailure 转发失败,失败详情参考 ForwardStreamError
调用 StartForwardStreamToRooms 或 UpdateForwardStreamToRooms 后,如遇转发失败,返回此状态。

ForwardStreamError

enum bytertc::ForwardStreamError

媒体流跨房间转发过程中抛出的错误码

枚举值

类型 说明
kForwardStreamErrorOK 正常
kForwardStreamErrorInvalidArgument 参数异常
kForwardStreamErrorInvalidToken token 错误
kForwardStreamErrorResponse 服务端异常
kForwardStreamErrorRemoteKicked 目标房间有相同 user id 的用户加入,转发中断
kForwardStreamErrorNotSupport 服务端不支持转发功能

ForwardStreamEvent

enum bytertc::ForwardStreamEvent

媒体流跨房间转发事件

枚举值

类型 说明
kForwardStreamEventDisconnected 本端与服务器网络连接断开,暂停转发。
kForwardStreamEventConnected 本端与服务器网络连接恢复,转发服务连接成功。
kForwardStreamEventInterrupt 转发中断。转发过程中,如果相同 user_id 的用户进入目标房间,转发中断。
kForwardStreamEventDstRoomUpdated 目标房间已更新,由 UpdateForwardStreamToRooms 触发。
kForwardStreamEventUnExpectAPICall API 调用时序错误。例如,在调用 StartForwardStreamToRooms 之前调用 UpdateForwardStreamToRooms 。

ForwardStreamStateInfo

struct bytertc::ForwardStreamStateInfo

跨房间转发媒体流过程中的不同目标房间的状态和错误信息

成员变量

类型 名称
const char* room_id
ForwardStreamState state
ForwardStreamError error

变量说明

room_id

const char* bytertc::ForwardStreamStateInfo::room_id;

跨间转发媒体流过程中目标房间 ID

state

ForwardStreamState bytertc::ForwardStreamStateInfo::state;

跨房间转发媒体流过程中该目标房间的状态,参看 ForwardStreamState

error

ForwardStreamError bytertc::ForwardStreamStateInfo::error;

跨房间转发媒体流过程中该目标房间抛出的错误码,参看 ForwardStreamError

ForwardStreamEventInfo

struct bytertc::ForwardStreamEventInfo

跨房间转发媒体流过程中的不同目标房间发生的事件

成员变量

类型 名称
const char* room_id
ForwardStreamEvent event

变量说明

room_id

const char* bytertc::ForwardStreamEventInfo::room_id;

跨房间转发媒体流过程中的发生该事件的目标房间 ID
空字符串代表所有目标房间

event

ForwardStreamEvent bytertc::ForwardStreamEventInfo::event;

跨房间转发媒体流过程中该目标房间发生的事件,参看 ForwardStreamEvent

VideoMetadataBuffer

struct bytertc::VideoMetadataBuffer

视频帧中包含的 metadata 信息

成员变量

类型 名称
char* data
int size
int64_t timestamp_us

变量说明

data

char* bytertc::VideoMetadataBuffer::data;

接收或者发送的 metadata

size

int bytertc::VideoMetadataBuffer::size;

接收或者发送的 metadata 数据大小,不能超过 1024

timestamp_us

int64_t bytertc::VideoMetadataBuffer::timestamp_us;

包含 metadata 视频帧的时间戳,单位微秒

AUDIO_FRAME_TYPE

enum bytertc::IAudioFrameObserver::AUDIO_FRAME_TYPE

音频帧类型

枚举值

类型 说明
FRAME_TYPE_PCM16 PCM 16bit

AudioFrame

struct bytertc::IAudioFrameObserver::AudioFrame

音频帧

成员变量

类型 名称
AUDIO_FRAME_TYPE type
int samples
int channels
int samples_per_sec
void* buffer
int64_t render_time_ms

变量说明

type

AUDIO_FRAME_TYPE bytertc::IAudioFrameObserver::AudioFrame::type;

音频帧类型

samples

int bytertc::IAudioFrameObserver::AudioFrame::samples;

音频采样点数量

channels

int bytertc::IAudioFrameObserver::AudioFrame::channels;

音频通道数

samples_per_sec

int bytertc::IAudioFrameObserver::AudioFrame::samples_per_sec;

音频采样率

buffer

void* bytertc::IAudioFrameObserver::AudioFrame::buffer;

音频数据内存地址

render_time_ms

int64_t bytertc::IAudioFrameObserver::AudioFrame::render_time_ms;

渲染时间

IAudioProcessor

class bytertc::IAudioProcessor

自定义音频处理器

成员函数

返回 名称
virtual int ProcessAudioFrame

函数说明

ProcessAudioFrame

virtual int bytertc::IAudioProcessor::ProcessAudioFrame(
    const IAudioFrame& audioFrame)

获取 RTC SDK 采集得到的音频帧,并进行自定义处理,最终将处理后的音频帧给到 RTC SDK 用于编码传输。

传入参数

参数名 类型 说明
audioFrame const IAudioFrame& RTC SDK 采集到的音频帧,自定义处理可直接对音频 data 中的数据进行修改。参看 IAudioFrame。

返回值

0: 未处理
>0: 处理成功
< 0: 处理失败

注意 在进行音频自定义处理前,你需要调用 RegisterLocalAudioProcessor 设置音频自定义处理器。

ScreenCaptureSourceType

enum bytertc::ScreenCaptureSourceType

屏幕采集对象的类型

枚举值

类型 说明
kScreenCaptureSourceTypeUnknown 类型未知
kScreenCaptureSourceTypeWindow 应用程序的窗口
kScreenCaptureSourceTypeScreen 桌面

ScreenCaptureSourceInfo

struct bytertc::ScreenCaptureSourceInfo

屏幕采集对象的具体信息

成员变量

类型 名称
ScreenCaptureSourceType type
view_t source_id
const char* source_name

变量说明

type

ScreenCaptureSourceType bytertc::ScreenCaptureSourceInfo::type = kScreenCaptureSourceTypeUnknown;

屏幕分享时,共享对象的类型,参看 ScreenCaptureSourceType

source_id

view_t bytertc::ScreenCaptureSourceInfo::source_id = nullptr;

屏幕分享时,共享对象的 ID。

source_name

const char* bytertc::ScreenCaptureSourceInfo::source_name = nullptr;

屏幕分享时共享对象的名称。

注意: 内存在调用 Release 时释放,请及时转为string对象保存

内存在调用 Release 时释放,请及时转为string对象保存

StreamMixingEvent

enum bytertc::StreamMixingEvent

合流事件类型

枚举值

类型 说明
kStreamMixingStart 合流功能触发
kStreamMixingStartSuccess 合流成功
kStreamMixingStartFailed 合流启动失败
kStreamMixingUpdate 更新合流
kStreamMixingStop 合流结束
kStreamMixingChangeMixType 合流类型发生改变
kStreamMixingFirstAudioFrameByClientMix 收到客户端合流音频首帧
kStreamMixingFirstVideoFrameByClientMix 收到客户端合流视频首帧
kStreamMixingUpdateTimeout 更新合流超时
kStreamMixingStartTimeout 开始合流超时
kStreamMixingRequestParamError 合流布局参数错误

StreamMixingType

enum bytertc::StreamMixingType

合流类型

枚举值

类型 说明
kStreamMixingTypeByServer 服务端合流
kStreamMixingTypeByClient 端云一体合流

TranscoderAudioCodecProfile

enum bytertc::TranscoderAudioCodecProfile

AAC 编码等级

枚举值

类型 说明
kByteAACProfileLC 编码等级 AAC-LC
kByteAACProfileMain 编码等级 AAC-MAIN
kByteAACProfileHEv1 编码等级 HE-AAC v1
kByteAACProfileHEv2 编码等级 HE-AAC v2

TranscoderVideoCodecProfile

enum bytertc::TranscoderVideoCodecProfile

视频编码规格

枚举值

类型 说明
kByteH264ProfileBaseline H264 格式基本规格编码
kByteH264ProfileMain H264 格式主流规格编码
kByteH264ProfileHigh H264 格式高规格编码
kByteVC1ProfileBaseline ByteVC1 格式基本规格编码
kByteVC1ProfileMain ByteVC1 格式主流规格编码
kByteVC1ProfileHigh ByteVC1 格式高规格编码

TranscoderContentControlType

enum bytertc::TranscoderContentControlType

合流输出内容类型

枚举值

类型 说明
kHasAudioAndVideo 输出的混流包含音频和视频
kHasAudioOnly 输出的混流只包含音频
kHasVideoOnly 输出的混流只包含视频

TranscoderRenderMode

enum bytertc::TranscoderRenderMode

渲染时,视频内容的缩放模式

枚举值

类型 说明
kRenderHidden 视频尺寸等比缩放,优先保证窗口被填满。当视频尺寸与显示窗口尺寸不一致时,多出的视频将被截掉。
kRenderFit 视频尺寸等比缩放,优先保证视频内容全部显示。当视频尺寸与显示窗口尺寸不一致时,会把窗口未被填满的区域填充成黑色。
kRenderAdaptive 视频尺寸非等比例缩放,把窗口充满。当视频尺寸与显示窗口尺寸不一致时,视频高或宽方向会被拉伸。

DataFrameType

enum bytertc::DataFrameType

数据帧类型

枚举值

类型 说明
kDataFrameTypeSei SEI 视频帧

IDataFrame

typedef struct bytertc::IDataFrame

数据帧

成员变量

类型 名称
DataFrameType frame_type
uint8_t* u8_data
uint32_t u32_data_size
uint64_t u64_ts_us

变量说明

frame_type

DataFrameType bytertc::IDataFrame::frame_type;

数据帧类型,参看 DataFrameType

u8_data

uint8_t* bytertc::IDataFrame::u8_data;

数据帧数据

u32_data_size

uint32_t bytertc::IDataFrame::u32_data_size;

数据帧数据大小

u64_ts_us

uint64_t bytertc::IDataFrame::u64_ts_us;

数据帧时间戳,单位:微秒

TranscoderLayoutRegion

typedef struct bytertc::TranscoderLayoutRegion

单个视频流在合流中的布局信息。
开启转推直播功能后,在多路视频流合流时,你可以设置其中一路视频流在合流中的预设布局信息。

成员变量

类型 名称
const char* region_id
const char* room_id
float x
float y
float width
float height
float alpha
int32_t i32_z_order
bool local_user
bool screen_stream
TranscoderContentControlType content_control
TranscoderRenderMode render_mode

变量说明

region_id

const char* bytertc::TranscoderLayoutRegion::region_id;

合流用户的 ID

room_id

const char* bytertc::TranscoderLayoutRegion::room_id;

视频流发布用户的房间 ID

x

float bytertc::TranscoderLayoutRegion::x;

用户视频布局相对画布左侧的偏移量,取值的范围为 [0.0, 1.0)

y

float bytertc::TranscoderLayoutRegion::y;

用户视频布局相对画布顶端的偏移量,取值的范围为 [0.0, 1.0)

width

float bytertc::TranscoderLayoutRegion::width;

用户视频宽度相对画布宽度的比例,取值的范围为 (0.0, 1.0]

height

float bytertc::TranscoderLayoutRegion::height;

用户视频高度相对画布高度的比例,取值的范围为 (0.0, 1.0]

alpha

float bytertc::TranscoderLayoutRegion::alpha;

透明度,取值范围 [0,255]

i32_z_order

int32_t bytertc::TranscoderLayoutRegion::i32_z_order;

用户视频布局在画布中的层级,取值范围 [0,100],0 为底层,值越大层级越高

local_user

bool bytertc::TranscoderLayoutRegion::local_user;

是否为本地用户:

screen_stream

bool bytertc::TranscoderLayoutRegion::screen_stream = false;

是否为屏幕流:

content_control

TranscoderContentControlType bytertc::TranscoderLayoutRegion::content_control;

合流输出内容,参看 TranscoderContentControlType

render_mode

TranscoderRenderMode bytertc::TranscoderLayoutRegion::render_mode;

渲染时,视频内容缩放模式,参看 TranscoderRenderMode

TranscoderAudioParam

typedef struct bytertc::TranscoderAudioParam

合流音频参数

成员变量

类型 名称
int32_t i32_sample_rate
int32_t i32_channel_num
int32_t i32_bitrate_kbps
TranscoderAudioCodecProfile audio_codec_profile

变量说明

i32_sample_rate

int32_t bytertc::TranscoderAudioParam::i32_sample_rate;

音频采样率,包括 16k, 32k, 44.1k, 48k

i32_channel_num

int32_t bytertc::TranscoderAudioParam::i32_channel_num;

声道数

i32_bitrate_kbps

int32_t bytertc::TranscoderAudioParam::i32_bitrate_kbps;

音频码率,单位:kbps,包括 16kbsp, 32kbps, 64kbps

audio_codec_profile

TranscoderAudioCodecProfile bytertc::TranscoderAudioParam::audio_codec_profile;

AAC 等级,参看 TranscoderAudioCodecProfile

TranscoderVideoParam

typedef struct bytertc::TranscoderVideoParam

合流视频参数

成员变量

类型 名称
int32_t i32_width
int32_t i32_height
int32_t i32_fps
int32_t i32_gop
int32_t i32_bitrate_kpbs
TranscoderVideoCodecProfile video_codec_profile
bool lowLatency

变量说明

i32_width

int32_t bytertc::TranscoderVideoParam::i32_width;

合流视频宽度,单位:px。
仅支持设为偶数,如果设为奇数,后处理会直接拒绝,导致合流失败。

i32_height

int32_t bytertc::TranscoderVideoParam::i32_height;

合流视频高度,单位:px。
仅支持设为偶数,如果设为奇数,后处理会直接拒绝,导致合流失败。

i32_fps

int32_t bytertc::TranscoderVideoParam::i32_fps;

合流视频帧率,单位:fps

i32_gop

int32_t bytertc::TranscoderVideoParam::i32_gop;

视频 I 帧间隔

i32_bitrate_kpbs

int32_t bytertc::TranscoderVideoParam::i32_bitrate_kpbs;

合流视频码率,单位:kbps

video_codec_profile

TranscoderVideoCodecProfile bytertc::TranscoderVideoParam::video_codec_profile;

视频编码规格,参看 TranscoderVideoCodecProfile

lowLatency

bool bytertc::TranscoderVideoParam::lowLatency;

是否使用低延时特性:

VirtualBackgroundSourceType

enum bytertc::VirtualBackgroundSourceType

虚拟背景类型。

枚举值

类型 说明
kVirtualBackgroundSourceColor 使用纯色背景替换视频原有背景。
kVirtualBackgroundSourceImage 使用自定义图片背景替换视频原有背景。

VirtualBackgroundSource

struct bytertc::VirtualBackgroundSource

虚拟背景对象。

成员变量

类型 名称
VirtualBackgroundSourceType source_type
uint32_t source_color
const char* source_path

变量说明

source_type

VirtualBackgroundSourceType bytertc::VirtualBackgroundSource::source_type;

虚拟背景类型,详见 VirtualBackgroundSourceType 。

source_color

uint32_t bytertc::VirtualBackgroundSource::source_color = 0xFFFFFFFF;

纯色背景使用的颜色。
格式为 0xAARRGGBB 。

source_path

const char* bytertc::VirtualBackgroundSource::source_path = nullptr;

自定义图片背景使用的图片的绝对路径。

注意:

VideoPictureType

enum bytertc::VideoPictureType

编码帧类型

枚举值

类型 说明
kVideoPictureTypeUnknown 未知类型
kVideoPictureTypeI I帧,关键帧,编解码不需要参考其他视频帧
kVideoPictureTypeP P帧,向前参考帧,编解码需要参考前一帧视频帧
kVideoPictureTypeB B帧,前后参考帧,编解码需要参考前后两帧视频帧

VideoRotation

enum bytertc::VideoRotation

视频帧旋转角度

枚举值

类型 说明
kVideoRotation0 顺时针旋转 0 度
kVideoRotation90 顺时针旋转 90 度
kVideoRotation180 顺时针旋转 180 度
kVideoRotation270 = 270 顺时针旋转 270 度

VideoStreamScaleMode

enum bytertc::VideoStreamScaleMode

视频帧缩放模式

枚举值

类型 说明
kVideoStreamScaleModeAuto 自动模式,默认值为 FitWithCropping。
kVideoStreamScaleModeStretch 对视频帧进行缩放,直至充满和视窗分辨率一致为止。这一过程不保证等比缩放。这一过程不保证等比缩放。
kVideoStreamScaleModeFitWithCropping 视窗填满优先。

视频帧等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的多出部分将无法显示。

缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长大于等于视窗对应边长。
kVideoStreamScaleModeFitWithFilling 视频帧内容全部显示优先。

视频帧等比缩放,直至视频帧能够在视窗上全部显示。如果视频帧长宽比例与视窗不同,视窗上未被视频帧填满区域将被涂黑。

缩放完成后,视频帧的一边长和视窗的对应边长一致,另一边长小于等于视窗对应边长。

VideoCodecMode

enum bytertc::VideoCodecMode

视频编码模式

枚举值

类型 说明
kCodecModeAuto 自动选择
kCodecModeHardware 硬编码
kCodecModeSoftware 软编码

VideoCodecType

enum bytertc::VideoCodecType

视频的编码类型

枚举值

类型 说明
kVideoCodecTypeH264 标准 H264 编码器
kVideoCodecTypeByteVC1 标准 ByteVC1 编码器

VideoEncodePreference

enum bytertc::VideoEncodePreference

编码策略偏好

枚举值

类型 说明
kVideoEncodePreferenceDisabled 无偏好
kVideoEncodePreferenceFramerate 帧率优先
kVideoEncodePreferenceQuality 质量优先
kVideoEncodePreferenceBalance 平衡质量与帧率

VideoSolution

struct bytertc::VideoSolution

视频流参数

成员变量

类型 名称
int width
int height
int fps
int max_send_kbps
VideoStreamScaleMode scale_mode
VideoEncodePreference encode_preference

变量说明

width

int bytertc::VideoSolution::width;

宽(像素)

height

int bytertc::VideoSolution::height;

高(像素)

fps

int bytertc::VideoSolution::fps;

视频帧率

max_send_kbps

int bytertc::VideoSolution::max_send_kbps = SEND_KBPS_AUTO_CALCULATE;

最高编码码率(千比特每秒)
建议使用默认设置。

scale_mode

VideoStreamScaleMode bytertc::VideoSolution::scale_mode = VideoStreamScaleMode::kVideoStreamScaleModeAuto;

视频帧缩放模式。你可以设置缩放以适应视窗,参看 VideoStreamScaleMode

encode_preference

VideoEncodePreference bytertc::VideoSolution::encode_preference = VideoEncodePreference::kVideoEncodePreferenceFrame/;"

视频编码质量策略,参看 VideoEncodePreference

VideoSolutionDescription

struct bytertc::VideoSolutionDescription

视频属性

成员变量

类型 名称
int width
int height
int fps
int max_send_kbps
VideoStreamScaleMode scale_mode
VideoCodecType codec_name
VideoCodecMode codec_mode
VideoEncodePreference encode_preference

变量说明

width

int bytertc::VideoSolutionDescription::width;

宽(像素)

height

int bytertc::VideoSolutionDescription::height;

高(像素)

fps

int bytertc::VideoSolutionDescription::fps;

视频帧率

max_send_kbps

int bytertc::VideoSolutionDescription::max_send_kbps;

最大发送速率(千比特每秒)

scale_mode

VideoStreamScaleMode bytertc::VideoSolutionDescription::scale_mode = VideoStreamScaleMode::kVideoStreamScaleModeAuto;

缩放模式。参看 VideoStreamScaleMode

codec_name

VideoCodecType bytertc::VideoSolutionDescription::codec_name = VideoCodecType::kVideoCodecTypeUnknown;

视频的编码类型。参看 VideoCodecType

codec_mode

VideoCodecMode bytertc::VideoSolutionDescription::codec_mode = VideoCodecMode::kCodecModeAuto;

视频的编码模式。参看 VideoCodecMode

encode_preference

VideoEncodePreference bytertc::VideoSolutionDescription::encode_preference = VideoEncodePreference::kVideoEncodePreferenceFrame/;"

视频编码质量偏好策略。参看 VideoEncodePreference

VideoPixelFormat

enum bytertc::VideoPixelFormat

视频帧颜色编码格式

枚举值

类型 说明
kVideoPixelFormatUnknown 未知的颜色编码格式
kVideoPixelFormatI420 YUV I420 格式
kVideoPixelFormatNV12 YUV NV12 格式
kVideoPixelFormatNV21 YUV NV21 格式
kVideoPixelFormatRGB24 RGB 24bit格式,
kVideoPixelFormatRGBA RGBA 编码格式
kVideoPixelFormatARGB ARGB 编码格式
kVideoPixelFormatBGRA BGRA 编码格式
kVideoPixelFormatTexture2D Texture2D格式
kVideoPixelFormatTextureOES TextureOES格式

VideoFrameType

enum bytertc::VideoFrameType

视频帧格式

枚举值

类型 说明
kVideoFrameTypeRawMemory 原始数据格式,按照内存存储
kVideoFrameTypeCVPixelBuffer CVPixelBufferRef类型,支持 iOS and macOS 平台
kVideoFrameTypeGLTexture open gl 纹理数据类型
kVideoFrameTypeCuda cuda 数据类型
kVideoFrameTypeD3D11 direct3d 11 数据格式
kVideoFrameTypeD3D9 direct3d 9 数据格式
kVideoFrameTypeJavaFrame Java的VideoFrame 数据格式
kVideoFrameTypeVAAPI vaapi 数据格式

ManagedMemory

struct bytertc::ManagedMemory

自定义内存释放器

成员变量

类型 名称
uint8_t* data
int size
void* user_opaque
int ()(uint8_t data, int size, void* user_opaque) memory_deleter

变量说明

data

uint8_t* bytertc::ManagedMemory::data = nullptr;

内存数据地址

size

int bytertc::ManagedMemory::size = 0;

内存空间的大小

user_opaque

void* bytertc::ManagedMemory::user_opaque = nullptr;

用户自定义数据

memory_deleter

int (*bytertc::ManagedMemory::memory_deleter)(uint8_t* data, int size, void* user_opaque) = nullptr;

自定义内存释放方法指针,如果指针不为空,方法会被调用,用来释放内存空间。 函数传入的参数分别是本结构体内 data、size、user_opaque 3个字段。

VideoFrameBuilder

typedef struct bytertc::VideoFrameBuilder

视频帧构建类

成员变量

类型 名称
uint8_t* data
int linesize
uint8_t* extra_data
int extra_data_size
uint8_t* supplementary_info
int supplementary_info_size
int size
int width
int height
VideoRotation rotation
void* hwaccel_buffer
void* user_opaque
int64_t timestamp_us
int ()(struct VideoFrameBuilder builder) memory_deleter

变量说明

data

uint8_t* bytertc::VideoFrameBuilder::data[ByteRTCNumDataPointers];

视频帧数据平面指针数组

linesize

int bytertc::VideoFrameBuilder::linesize[ByteRTCNumDataPointers];

视频帧数据平面行长度

extra_data

uint8_t* bytertc::VideoFrameBuilder::extra_data = nullptr;

SEI 数据地址

extra_data_size

int bytertc::VideoFrameBuilder::extra_data_size = 0;

SEI 数据大小

supplementary_info

uint8_t* bytertc::VideoFrameBuilder::supplementary_info = nullptr;

补充数据地址

supplementary_info_size

int bytertc::VideoFrameBuilder::supplementary_info_size = 0;

补充数据大小

size

int bytertc::VideoFrameBuilder::size = 0;

视频帧内存空间大小

width

int bytertc::VideoFrameBuilder::width = 0;

视频帧宽度

height

int bytertc::VideoFrameBuilder::height = 0;

视频帧高度

rotation

VideoRotation bytertc::VideoFrameBuilder::rotation = kVideoRotation0;

视频旋转角度,参看 VideoRotation

hwaccel_buffer

void* bytertc::VideoFrameBuilder::hwaccel_buffer = nullptr;

硬件加速缓冲区指针

user_opaque

void* bytertc::VideoFrameBuilder::user_opaque = nullptr;

用户私有数据指针

timestamp_us

int64_t bytertc::VideoFrameBuilder::timestamp_us = 0;

视频帧时间戳

memory_deleter

int (*bytertc::VideoFrameBuilder::memory_deleter)(struct VideoFrameBuilder* builder) = nullptr;

用户定义的视频帧释放回调函数指针,如果指针不为空,方法会被调用用来释放内存空间

IVideoFrame

class bytertc::IVideoFrame

设置视频帧

静态函数

返回 名称
static IVideoFrame* build_video_frame

成员函数

返回 名称
virtual VideoFrameType frame_type
virtual VideoPixelFormat pixel_format
virtual int64_t timestamp_us
virtual int width
virtual int height
virtual VideoRotation rotation
virtual ColorSpace color_space
virtual int number_of_planes
virtual uint8_t* get_plane_data
virtual int get_plane_line_size
virtual uint8_t* get_extra_data_info
virtual uint8_t* get_supplementary_info
virtual void* get_hwaccel_buffer
virtual IVideoFrame* shallow_copy
virtual void release
virtual void to_i420

函数说明

build_video_frame

static IVideoFrame* bytertc::IVideoFrame::build_video_frame(
    const VideoFrameBuilder& builder)

根据视频帧参数创建视频帧并返回指针

传入参数

参数名 类型 说明
VideoFrameBuilder const 视频帧创建类对象,详见 VideoFrameBuilder

frame_type

virtual VideoFrameType bytertc::IVideoFrame::frame_type() const

获取视频帧类型,参看 VideoFrameType

pixel_format

virtual VideoPixelFormat bytertc::IVideoFrame::pixel_format() const

获取视频帧格式,参看 VideoPixelFormat

timestamp_us

virtual int64_t bytertc::IVideoFrame::timestamp_us() const

获取视频帧时间戳,单位:微秒

width

virtual int bytertc::IVideoFrame::width() const

获取视频帧宽度,单位:px

height

virtual int bytertc::IVideoFrame::height() const

获取视频帧高度,单位:px

rotation

virtual VideoRotation bytertc::IVideoFrame::rotation() const

获取视频帧旋转角度,参看 VideoRotation

color_space

virtual ColorSpace bytertc::IVideoFrame::color_space() const

获取视频帧颜色空间,参看 ColorSpace

number_of_planes

virtual int bytertc::IVideoFrame::number_of_planes() const

视频帧颜色 plane 数量

注意 yuv 数据存储格式分为打包(planar)存储格式和平面(packed)存储格式,planar 格式中 Y、U、V 分平面存储,packed 格式中 Y、U、V 交叉存储

get_plane_data

virtual uint8_t* bytertc::IVideoFrame::get_plane_data(
    int plane_index)

获取 plane 数据指针

传入参数

参数名 类型 说明
plane_index int plane 数据索引

get_plane_line_size

virtual int bytertc::IVideoFrame::get_plane_line_size(
    int plane_index)

获取 plane 中数据行的长度

传入参数

参数名 类型 说明
plane_index int plane 数据索引

get_extra_data_info

virtual uint8_t* bytertc::IVideoFrame::get_extra_data_info(
    int& size)

获取扩展数据指针

传入参数

参数名 类型 说明
size int& 扩展数据字节数

get_supplementary_info

virtual uint8_t* bytertc::IVideoFrame::get_supplementary_info(
    int& size)

获取补充数据指针

传入参数

参数名 类型 说明
size int& 补充数据字节数

get_hwaccel_buffer

virtual void* bytertc::IVideoFrame::get_hwaccel_buffer()

获取本地缓冲区指针

shallow_copy

virtual IVideoFrame* bytertc::IVideoFrame::shallow_copy()

浅拷贝视频帧并返回指针

release

virtual void bytertc::IVideoFrame::release()

释放视频帧

to_i420

virtual void bytertc::IVideoFrame::to_i420()

转换为i420格式的视频帧

EncodedVideoFrameBuilder

typedef struct bytertc::EncodedVideoFrameBuilder

视频帧参数

成员变量

类型 名称
VideoCodecType codec_type
VideoPictureType picture_type
VideoRotation rotation
uint8_t* data
int size
int width
int height
int64_t timestamp_us
int64_t timestamp_dts_us
int ()(uint8_t data, int size, void* user_opaque) memory_deleter

变量说明

codec_type

VideoCodecType bytertc::EncodedVideoFrameBuilder::codec_type = kVideoCodecTypeUnknown;

视频帧编码格式,参看 VideoCodecType

picture_type

VideoPictureType bytertc::EncodedVideoFrameBuilder::picture_type = kVideoPictureTypeUnknown;

视频帧编码类型,参看 VideoPictureType

rotation

VideoRotation bytertc::EncodedVideoFrameBuilder::rotation = kVideoRotation0;

视频帧旋转角度,参看 VideoRotation

data

uint8_t* bytertc::EncodedVideoFrameBuilder::data;

视频帧数据指针

注意: IEncodedVideoFrame 会获取数据的所有权 IEncodedVideoFrame 会获取数据的所有权

size

int bytertc::EncodedVideoFrameBuilder::size = 0;

视频帧数据大小

width

int bytertc::EncodedVideoFrameBuilder::width = 0;

视频帧宽度,单位:px

height

int bytertc::EncodedVideoFrameBuilder::height = 0;

视频帧高度,单位:px

timestamp_us

int64_t bytertc::EncodedVideoFrameBuilder::timestamp_us = 0;

视频采集时间戳,单位:微秒

timestamp_dts_us

int64_t bytertc::EncodedVideoFrameBuilder::timestamp_dts_us = 0;

视频编码时间戳,单位:微秒

memory_deleter

int (*bytertc::EncodedVideoFrameBuilder::memory_deleter)(uint8_t* data, int size, void* user_opaque) = nullptr;

用户定义的视频帧释放回调函数指针,如果指针不为空,方法会被调用用来释放内存空间

IEncodedVideoFrame

class bytertc::IEncodedVideoFrame

视频帧信息

静态函数

返回 名称
static IEncodedVideoFrame* build_encoded_video_frame

成员函数

返回 名称
virtual VideoCodecType codec_type
virtual int64_t timestamp_us
virtual int64_t timestamp_dts_us
virtual int width
virtual int height
virtual VideoPictureType picture_type
virtual VideoRotation rotation
virtual uint8_t* data
virtual int data_size
virtual IEncodedVideoFrame* shallow_copy
virtual void release

函数说明

build_encoded_video_frame

static IEncodedVideoFrame* bytertc::IEncodedVideoFrame::build_encoded_video_frame(
    const EncodedVideoFrameBuilder& builder)

根据视频帧参数创建视频帧并返回指针

传入参数

参数名 类型 说明
builder const EncodedVideoFrameBuilder& 视频帧参数,参看 EncodedVideoFrameBuilder

返回值 IEncodedVideoFrame 创建的视频帧的指针

codec_type

virtual VideoCodecType bytertc::IEncodedVideoFrame::codec_type() const

获取视频编码类型

返回值 视频编码类型,参看 VideoCodecType

timestamp_us

virtual int64_t bytertc::IEncodedVideoFrame::timestamp_us() const

获取视频采集时间戳

返回值 视频采集时间戳,单位:微秒

timestamp_dts_us

virtual int64_t bytertc::IEncodedVideoFrame::timestamp_dts_us() const

获取视频编码时间戳

返回值 视频编码时间戳,单位:微秒

width

virtual int bytertc::IEncodedVideoFrame::width() const

获取视频帧宽度

返回值 视频帧宽度,单位:px

height

virtual int bytertc::IEncodedVideoFrame::height() const

获取视频帧高度

返回值 视频帧高度,单位:px

picture_type

virtual VideoPictureType bytertc::IEncodedVideoFrame::picture_type() const

获取视频编码帧类型

返回值 视频编码帧类型,参看 VideoPictureType

rotation

virtual VideoRotation bytertc::IEncodedVideoFrame::rotation() const

获取视频帧旋转角度

返回值 视频帧旋转角度,参看 VideoRotation

data

virtual uint8_t* bytertc::IEncodedVideoFrame::data() const

获取视频帧数据指针地址

返回值 视频帧数据指针地址

data_size

virtual int bytertc::IEncodedVideoFrame::data_size() const

获取视频帧数据大小

返回值 视频帧数据大小

shallow_copy

virtual IEncodedVideoFrame* bytertc::IEncodedVideoFrame::shallow_copy() const

浅拷贝视频帧并返回指针

release

virtual void bytertc::IEncodedVideoFrame::release()

释放视频帧

ReceiveRange

struct bytertc::ReceiveRange

描述范围语音中语音接收范围

成员变量

类型 名称
int min
int max

变量说明

min

int bytertc::ReceiveRange::min;

不同小队成员设置收发世界模式并且开启区域语音时,设置收听的最小范围值,在小于 min 的时候,声音完全无衰减;

max

int bytertc::ReceiveRange::max;

不同小队成员设置收发世界模式并且开启区域语音时,设置收听的最大范围值,在大于 max 的时候,声音无法听见 在 [min, max) 之间根据距离远近实现声音的衰减

ReceiveRangeLimit

enum bytertc::ReceiveRangeLimit

描述范围语音中语音接受范围的界限, 当没有合理的范围提供时,作为默认的接收范围

枚举值

类型 说明
defaultMin 默认最小范围
defaultMax 默认最大范围

Orientation

struct bytertc::Orientation

坐标

成员变量

类型 名称
float x
float y
float z

变量说明

x

float bytertc::Orientation::x;

x 方向向量

y

float bytertc::Orientation::y;

y 方向向量

z

float bytertc::Orientation::z;

z 方向向量

HumanOrientation

struct bytertc::HumanOrientation

用于确定朝向的正方向基准。默认的正方向和位置坐标系的三个正方向一致。

成员变量

类型 名称
Orientation forward
Orientation right
Orientation up

变量说明

forward

Orientation bytertc::HumanOrientation::forward =  { 1,0,0 };

正前方朝向向量

Orientation bytertc::HumanOrientation::right = { 0,1,0 };

正右方朝向向量

up

Orientation bytertc::HumanOrientation::up = { 0,0,1 };

正上方朝向向量

RemoteUserPositionInfo

struct bytertc::RemoteUserPositionInfo

远端用户的位置信息。

成员变量

类型 名称
int factor
int recv_mode
int send_mode
Position pos_
const char* user_id
const char* team_id

变量说明

factor

int bytertc::RemoteUserPositionInfo::factor = 0;

音量衰减量。取值范围是 [0,100],随距离呈线性衰减,当 factor 为 0 时,表示听不到声音。

recv_mode

int bytertc::RemoteUserPositionInfo::recv_mode = 0;

接收模式,详见 RangeAudioMode 。

send_mode

int bytertc::RemoteUserPositionInfo::send_mode = 0;

发送模式,详见 RangeAudioMode 。

pos_

Position bytertc::RemoteUserPositionInfo::pos_ = {0, 0, 0};

位置信息

user_id

const char* bytertc::RemoteUserPositionInfo::user_id = nullptr;

用户id

team_id

const char* bytertc::RemoteUserPositionInfo::team_id = nullptr;

小队id