VideoPictureType

enum bytertc::VideoPictureType

编码帧类型

Defined in : bytertc_advance.h

枚举值

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

IEncodedVideoFrame

class bytertc::IEncodedVideoFrame

视频帧信息

Defined in : bytertc_advance.h

成员函数

返回 名称
virtual ~IEncodedVideoFrame
virtual VideoCodecType codec_type
virtual void set_codec_type
virtual int64_t timestamp_us
virtual void set_timestamp_us
virtual int64_t timestamp_pts
virtual void set_timestamp_pts
virtual int64_t timestamp_dts
virtual void set_timestamp_dts
virtual int timebase_num
virtual void set_timestamp_num
virtual int timebase_den
virtual void set_timestamp_den
virtual int width
virtual void set_width
virtual int height
virtual void set_height
virtual VideoPictureType picture_type
virtual void set_picture_type
virtual VideoRotation rotation
virtual void set_rotation
virtual void set_stream_memory
virtual uint8_t* data
virtual int data_size

函数说明

~IEncodedVideoFrame

virtual bytertc::IEncodedVideoFrame::~IEncodedVideoFrame()

析构函数

codec_type

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

获取视频编码类型

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

set_codec_type

virtual void bytertc::IEncodedVideoFrame::set_codec_type(
    VideoCodecType codec_type)

设置视频编码类型

传入参数

参数名 类型 说明
codec_type VideoCodecType 视频编码类型,参看 VideoCodecType

timestamp_us

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

获取视频采集时间戳

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

set_timestamp_us

virtual void bytertc::IEncodedVideoFrame::set_timestamp_us(
    int64_t timestamp_us)

设置视频帧采集时间戳

传入参数

参数名 类型 说明
timestamp_us int64_t 视频采集时间戳,单位:微秒

timestamp_pts

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

获取视频渲染时间戳

返回值 视频渲染时间戳,单位:微秒

set_timestamp_pts

virtual void bytertc::IEncodedVideoFrame::set_timestamp_pts(
    int64_t timestamp_pts)

设置视频渲染时间戳

传入参数

参数名 类型 说明
timestamp_pts int64_t 视频渲染时间戳,单位:微秒

timestamp_dts

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

获取视频解码时间戳

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

set_timestamp_dts

virtual void bytertc::IEncodedVideoFrame::set_timestamp_dts(
    int64_t timestamp_dts)

设置视频解码时间戳

传入参数

参数名 类型 说明
timestamp_dts int64_t 视频解码时间戳,单位:微秒

timebase_num

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

获取时间基分子

返回值 时间基分子

set_timestamp_num

virtual void bytertc::IEncodedVideoFrame::set_timestamp_num(
    int timebase_num)

设置时间基分子

传入参数

参数名 类型 说明
timebase_num int 时间基分子

timebase_den

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

获取时间基分母

返回值 时间基分母

set_timestamp_den

virtual void bytertc::IEncodedVideoFrame::set_timestamp_den(
    int timebase_den)

设置时间基分母

传入参数

参数名 类型 说明
timebase_den int 时间基分母

width

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

获取视频帧宽度

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

set_width

virtual void bytertc::IEncodedVideoFrame::set_width(
    int width)

设置视频帧宽度

传入参数

参数名 类型 说明
width int 视频帧宽度,单位:px

height

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

获取视频帧高度

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

set_height

virtual void bytertc::IEncodedVideoFrame::set_height(
    int height)

设置视频帧高度

传入参数

参数名 类型 说明
height int 视频帧高度,单位:px

picture_type

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

获取视频编码帧类型

返回值 视频编码格式,参看 VideoPictureType

set_picture_type

virtual void bytertc::IEncodedVideoFrame::set_picture_type(
    VideoPictureType type)

设置视频编码帧类型

传入参数

参数名 类型 说明
type VideoPictureType 视频编码格式,参看 VideoPictureType

rotation

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

获取视频帧旋转角度

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

set_rotation

virtual void bytertc::IEncodedVideoFrame::set_rotation(
    VideoRotation rotation)

设置视频帧旋转角度

传入参数

参数名 类型 说明
rotation VideoRotation 视频帧旋转角度,参看 VideoRotation

set_stream_memory

virtual void bytertc::IEncodedVideoFrame::set_stream_memory(
    const ManagedMemory& memory)

设置视频帧内存管理方式

传入参数

参数名 类型 说明
memory const ManagedMemory& 视频帧内存管理信息,详见 ManagedMemory

data

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

获取视频帧数据指针地址

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

data_size

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

获取视频帧数据大小

返回值 视频帧数据大小

AudioFrameType

enum bytertc::AudioFrameType

音频帧类型

Defined in : bytertc_audio_frame.h

枚举值

类型 值 说明
kFrameTypePCM16 = 0 0 PCM 16bit

AudioFrameBuilder

typedef struct bytertc::AudioFrameBuilder

音频帧构建类

Defined in : bytertc_audio_frame.h

成员变量

类型 名称
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

音频帧

Defined in : bytertc_audio_frame.h

成员函数

返回 名称
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

函数说明

timestamp_us

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

获取音频帧时间戳。

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

sample_rate

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

获取音频采样率

返回值 音频采样率

channel

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

获取音频通道数

返回值 音频通道数

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:AudioFrameType

返回值 音频帧类型

release

virtual void bytertc::IAudioFrame::release()

释放音频帧 释放音频帧

RenderMode

enum bytertc::RenderMode

渲染模式

Defined in : bytertc_defines.h

枚举值

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

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

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

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

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

UserOfflineReason

enum bytertc::UserOfflineReason

用户离开房间的原因。

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kUserOfflineReasonQuit 0 远端用户调用 LeaveRoom 方法主动退出房间,或将身份切换至静默观众。
kUserOfflineReasonDropped 1 远端用户因网络等原因掉线。

StreamRemoveReason

enum bytertc::StreamRemoveReason

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

Defined in : bytertc_defines.h

枚举值

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

UserRoleType

enum bytertc::UserRoleType

用户角色。

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kUserRoleTypeBroadcaster 1 主播角色。该角色用户可在房间内发布和订阅音视频流,房间中的其他用户可以感知到该用户的存在。
kUserRoleTypeSilentAudience 2 静默观众角色。该众角色用户只可在房间内订阅音视频流,房间中的其他用户无法感知到该用户的存在。

JoinRoomType

enum bytertc::JoinRoomType

用户加入房间的类型。

Defined in : bytertc_defines.h

枚举值

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

LoginType

enum bytertc::LoginType

用户登录的类型

Defined in : bytertc_defines.h

枚举值

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

RoomMessageSendResult

enum bytertc::RoomMessageSendResult

发送消息给房间的结果

Defined in : bytertc_defines.h

枚举值

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

ConnectionState

enum bytertc::ConnectionState

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

Defined in : bytertc_defines.h

枚举值

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

NetworkQuality

enum bytertc::NetworkQuality

媒体流网络质量。

Defined in : bytertc_defines.h

枚举值

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

NetworkType

enum bytertc::NetworkType

SDK 网络连接类型。

Defined in : bytertc_defines.h

枚举值

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

PublishFallbackOption

enum bytertc::PublishFallbackOption

性能回退

Defined in : bytertc_defines.h

枚举值

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

ScreenParameters

struct bytertc::ScreenParameters

屏幕共享参数

Defined in : bytertc_defines.h

成员变量

类型 名称
int frame_rate
int kbitrate

变量说明

frame_rate

int bytertc::ScreenParameters::frame_rate = 15;

编码帧率,单位为 fps

kbitrate

int bytertc::ScreenParameters::kbitrate = -1;

编码码率,小于 0 时 SDK 会根据高宽自适应码率, 单位 kbps

RoomProfileType

enum bytertc::RoomProfileType

房间模式

Defined in : bytertc_defines.h

枚举值

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

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

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

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

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

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

+ 采集播放采用 16kHz 单通道采样

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

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

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

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

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

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

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

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

RTCRoomConfig

struct bytertc::RTCRoomConfig

房间参数配置

Defined in : bytertc_defines.h

成员变量

类型 名称
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,默认为普通音视频通话模式,进房后不可更改。

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

多房间参数配置

Defined in : bytertc_defines.h

成员变量

类型 名称
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

当前媒体设备类型

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kMediaDeviceTypeAudioRenderDevice 0 音频渲染设备类型
kMediaDeviceTypeAudioCaptureDevice 1 音频采集设备类型
kMediaDeviceTypeVideoCaptureDevice = 3 3 视频采集设备类型

MediaDeviceState

enum bytertc::MediaDeviceState

媒体设备状态类型

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kMediaDeviceStateStarted 1 设备已开启
kMediaDeviceStateStopped 2 设备已停止
kMediaDeviceStateRuntimeError 3 设备运行时错误
kMediaDeviceStateAdded 10 设备已插入
kMediaDeviceStateRemoved = 11 11 设备被移除

MediaDeviceError

enum bytertc::MediaDeviceError

媒体设备错误类型

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kMediaDeviceErrorOK 0 媒体设备正常
kMediaDeviceErrorDeviceNoPermission 1 没有权限启动媒体设备
kMediaDeviceErrorDeviceBusy 2 媒体设备已经在使用中
kMediaDeviceErrorDeviceFailure 3 媒体设备错误
kMediaDeviceErrorDeviceNotFound 4 未找到指定的媒体设备
kMediaDeviceErrorDeviceDisconnected 5 媒体设备被移除

CameraID

enum bytertc::CameraID

移动端摄像头。

Defined in : bytertc_defines.h

枚举值

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

AudioPlaybackDevice

enum bytertc::AudioPlaybackDevice

音频播放设备类型

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kAudioPlaybackDeviceHeadset 1 有线耳机
kAudioPlaybackDeviceEarpiece 2 听筒
kAudioPlaybackDeviceSpeakerphone 3 扬声器
kAudioPlaybackDeviceHeadsetBluetooth = 4 4 蓝牙耳机

SubscribeFallbackOption

enum bytertc::SubscribeFallbackOption

订阅回退选项

Defined in : bytertc_defines.h

枚举值

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

SubscribeMode

enum bytertc::SubscribeMode

订阅模式选项。业务方在加入房间前,调用 EnableAutoSubscribe 接口设置订阅模式。

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kSubscribeModeAuto 0 自动订阅模式。SDK 会自动为你订阅房间中的每一路流。
kSubscribeModeManual = 1 1 手动订阅模式。SDK 不会自动订阅房间内的音视频流,你应根据根据需要调用 SubscribeUserStream 方法手动订阅其他用户发布的音视频流。

SubscribeMediaType

enum bytertc::SubscribeMediaType

订阅媒体的类型

Defined in : bytertc_defines.h

枚举值

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

PauseResumeControlMediaType

enum bytertc::PauseResumeControlMediaType

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

Defined in : bytertc_defines.h

枚举值

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

RemoteUserPriority

enum bytertc::RemoteUserPriority

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

Defined in : bytertc_defines.h

枚举值

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

FallbackOrRecoverReason

enum bytertc::FallbackOrRecoverReason

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

Defined in : bytertc_defines.h

枚举值

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

RemoteStreamSwitch

struct bytertc::RemoteStreamSwitch

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

Defined in : bytertc_defines.h

成员变量

类型 名称
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

用户在线状态。

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kUserOnlineStatusOffline 0 对端用户离线

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

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

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

BusinessCheckCode

enum bytertc::BusinessCheckCode

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

Defined in : bytertc_defines.h

枚举值

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

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

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

LocalAudioStreamState

enum bytertc::LocalAudioStreamState

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

Defined in : bytertc_defines.h

枚举值

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

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

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

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

LocalAudioStreamError

enum bytertc::LocalAudioStreamError

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

Defined in : bytertc_defines.h

枚举值

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

LocalVideoStreamState

enum bytertc::LocalVideoStreamState

本地视频流状态

Defined in : bytertc_defines.h

枚举值

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

RemoteAudioState

enum bytertc::RemoteAudioState

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

Defined in : bytertc_defines.h

枚举值

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

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

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

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

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

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

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

+ 成功解码远端音频首帧,对应原因是:kRemoteAudioStateChangeReasonLocalUnmutedRemoteAudioStateChangeReason

+ 网络由阻塞恢复正常,对应原因是:kRemoteAudioStateChangeReasonNetworkRecoveryRemoteAudioStateChangeReason

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

+ 远端用户恢复发送音频流,对应原因是:kRemoteAudioStateChangeReasonRemoteUnmutedRemoteAudioStateChangeReason
kRemoteAudioStateFrozen 3 远端音频流卡顿。

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

RemoteAudioStateChangeReason

enum bytertc::RemoteAudioStateChangeReason

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

Defined in : bytertc_defines.h

枚举值

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

RemoteVideoState

enum bytertc::RemoteVideoState

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

Defined in : bytertc_defines.h

枚举值

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

RemoteVideoStateChangeReason

enum bytertc::RemoteVideoStateChangeReason

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

Defined in : bytertc_defines.h

枚举值

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

AudioVolumeInfo

struct bytertc::AudioVolumeInfo

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

Defined in : bytertc_defines.h

成员变量

类型 名称
unsigned int volume
const char* uid

变量说明

volume

unsigned int bytertc::AudioVolumeInfo::volume;

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

uid

const char* bytertc::AudioVolumeInfo::uid;

音频流来源的用户 ID

PerformanceAlarmReason

enum bytertc::PerformanceAlarmReason

OnPerformanceAlarms 告警的原因

Defined in : bytertc_defines.h

枚举值

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

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

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

PerformanceAlarmMode

enum bytertc::PerformanceAlarmMode

是否开启发布性能回退

Defined in : bytertc_defines.h

枚举值

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

SourceWantedData

struct bytertc::SourceWantedData

性能回退相关数据

Defined in : bytertc_defines.h

成员变量

类型 名称
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

用户信息

Defined in : bytertc_defines.h

成员变量

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

变量说明

uid

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

用户 ID,长度在 128 字节以内的非空字符串。支持以下字符集范围:
1. 26 个大写字母 A ~ Z
2. 26 个小写字母 a ~ z
3. 10 个数字 0 ~ 9
4. 下划线 "_",at 符 "@",减 号 "-"

extra_info

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

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

RtcRoomStats

struct bytertc::RtcRoomStats

通话相关的统计信息

Defined in : bytertc_defines.h

成员变量

类型 名称
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

变量说明

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;

通话时长,单位为秒,累计值

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;

当前房间内的用户人数

RemoteAudioStats

struct bytertc::RemoteAudioStats

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

Defined in : bytertc_defines.h

成员变量

类型 名称
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

变量说明

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 。

LocalAudioStats

struct bytertc::LocalAudioStats

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

Defined in : bytertc_defines.h

成员变量

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

变量说明

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 。

rtt

int bytertc::LocalAudioStats::rtt;

往返时延。单位为 ms 。

num_channels

int bytertc::LocalAudioStats::num_channels;

音频声道数。

sent_sample_rate

int bytertc::LocalAudioStats::sent_sample_rate;

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

MediaStreamInfo

struct bytertc::MediaStreamInfo

流属性。

Defined in : bytertc_defines.h

成员变量

类型 名称
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

视频订阅配置信息

Defined in : bytertc_defines.h

成员变量

类型 名称
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

手动订阅流的配置信息。

Defined in : bytertc_defines.h

成员变量

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

变量说明

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 方法),弱网或性能不足时会优先保证收到的高优先级用户的流的质量。

ProblemFeedbackOption

enum bytertc::ProblemFeedbackOption

音视频质量反馈问题类型

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kProblemFeedbackOptionNone 0 没有问题
kProblemFeedbackOptionOtherMessage (1 << 0) 其他问题
kProblemFeedbackOptionAudioNotClear (1 << 1) 声音不清晰
kProblemFeedbackOptionVideoNotClear (1 << 2) 视频不清晰
kProblemFeedbackOptionNotSync (1 << 3) 音视频不同步
kProblemFeedbackOptionAudioLagging (1 << 4) 音频卡顿
kProblemFeedbackOptionVideoLagging (1 << 5) 视频卡顿
kProblemFeedbackOptionConnectionFailed (1 << 6) 无法连接
kProblemFeedbackOptionAudioDelay (1 << 7) 音频延迟
kProblemFeedbackOptionVideoDelay (1 << 8) 视频延迟
kProblemFeedbackOptionDisconnected (1 << 9) 连接断开
kProblemFeedbackOptionNoAudio (1 << 10) 无声音
kProblemFeedbackOptionNoVideo (1 << 11) 无画面
kProblemFeedbackOptionAudioStrength (1 << 12) 声音过大或过小
kProblemFeedbackOptionEcho (1 << 13) 回声噪音

VideoStreamType

enum bytertc::VideoStreamType

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

Defined in : bytertc_defines.h

枚举值

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

VideoCanvas

struct bytertc::VideoCanvas

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

Defined in : bytertc_defines.h

成员变量

类型 名称
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 通知本地用户订阅的远端视频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。

Defined in : bytertc_defines.h

成员变量

类型 名称
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

变量说明

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 。

rtt

int bytertc::RemoteVideoStats::rtt;

往返时延,单位为 ms 。

frozen_rate

int bytertc::RemoteVideoStats::frozen_rate;

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

video_index

int bytertc::RemoteVideoStats::video_index;

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

LocalVideoStats

struct bytertc::LocalVideoStats

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

Defined in : bytertc_defines.h

成员变量

类型 名称
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

变量说明

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 。

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;

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

LocalStreamStats

struct bytertc::LocalStreamStats

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

Defined in : bytertc_defines.h

成员变量

类型 名称
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 通知本地用户订阅的远端音/视频流在此次统计周期内的接收状况。此数据结构即为回调给本地用户的参数类型。

Defined in : bytertc_defines.h

成员变量

类型 名称
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 回调通知给用户。

Defined in : bytertc_defines.h

成员变量

类型 名称
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 窗口句柄

Defined in : bytertc_defines.h

Rectangle

struct bytertc::Rectangle

矩形,用于屏幕共享指定区域

Defined in : bytertc_defines.h

成员变量

类型 名称
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

高亮边框标识屏幕共享指定区域

Defined in : bytertc_defines.h

成员变量

类型 名称
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;

边框的宽度

DesktopCaptureParameters

struct bytertc::DesktopCaptureParameters

屏幕共享的编码参数配置

Defined in : bytertc_defines.h

成员变量

类型 名称
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

自定义加密类型

Defined in : bytertc_defines.h

枚举值

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

AudioMixingState

enum bytertc::AudioMixingState

音频混音文件播放状态。

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kAudioMixingStatePreloaded 0 混音已加载
kAudioMixingStatePlaying 1 混音正在播放
kAudioMixingStatePaused 2 混音暂停
kAudioMixingStateStopped 3 混音停止
kAudioMixingStateFailed 4 混音播放失败
kAudioMixingStateFinished 5 混音播放结束

AudioMixingError

enum bytertc::AudioMixingError

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

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kAudioMixingErrorOk 0 混音错误码,正常
kAudioMixingErrorPreloadFailed 1 预加载失败,找不到混音文件或者文件长度超出 20s
kAudioMixingErrorStartFailed 2 混音开启失败,找不到混音文件或者混音文件打开失败
kAudioMixingErrorIdNotFound 3 混音 ID 异常
kAudioMixingErrorSetPositionFailed 4 设置混音文件的播放位置出错
kAudioMixingErrorInValidVolume 5 音量参数不合法,仅支持设置的音量值为[0 400]
kAudioMixingErrorLoadConflict 6 播放的文件与预加载的文件不一致,请先使用 UnloadAudioMixing 卸载文件

IVideoSink

class bytertc::IVideoSink

自定义视频渲染器

Defined in : bytertc_defines.h

成员函数

返回 名称
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

视频帧编码格式

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kI420 VideoPixelFormat::kVideoPixelFormatI420 YUV I420 格式
kOriginal VideoPixelFormat::kVideoPixelFormatUnknown 原始视频帧格式

RtcUser

struct bytertc::RtcUser

用户信息

Defined in : bytertc_defines.h

成员变量

类型 名称
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

首帧发送状态

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kFirstFrameSendStateSending 0 发送中
kFirstFrameSendStateSent 1 发送成功
kFirstFrameSendStateEnd 2 发送失败

FirstFramePlayState

enum bytertc::FirstFramePlayState

首帧播放状态

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kFirstFramePlayStatePlaying 0 播放中
kFirstFramePlayStatePlayed 1 播放成功
kFirstFramePlayStateEnd 2 播放失败

MirrorMode

enum bytertc::MirrorMode

是否开启镜像模式

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kMirrorModeOff 0 不开启
kMirrorModeOn 1 开启

MuteState

enum bytertc::MuteState

停止/启动发送音/视频流的状态

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kMuteStateOff 0 启动发送音/视频流的状态
kMuteStateOn 1 停止发送音/视频流的状态

StreamIndex

enum bytertc::StreamIndex

流属性

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kStreamIndexMain 0 主流。

包括:

+ 通过默认摄像头/麦克风采集到的视频/音频;

+ 通过自定义设备采集到的视频/音频。
kStreamIndexScreen 1 屏幕流。

屏幕共享时共享的视频流,或来自声卡的本地播放音频流。

RemoteStreamKey

struct bytertc::RemoteStreamKey

远端流信息

Defined in : bytertc_defines.h

成员变量

类型 名称
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

VideoSourceType

enum bytertc::VideoSourceType

视频输入源类型

Defined in : bytertc_defines.h

枚举值

类型 值 说明
VideoSourceTypeExternal 0
VideoSourceTypeInternal 1

VideoFrameInfo

struct bytertc::VideoFrameInfo

视频帧信息

Defined in : bytertc_defines.h

成员变量

类型 名称
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。

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kAudioSampleRate8000 8000 8000 采样率
kAudioSampleRate16000 16000 16000 采样率
kAudioSampleRate32000 32000 32000 采样率
kAudioSampleRate44100 44100 44100 采样率
kAudioSampleRate48000 = 48000 48000 48000 采样率

AudioChannel

enum bytertc::AudioChannel

音频声道

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kAudioChannelMono 1 单声道
kAudioChannelStereo = 2 2 双声道

AudioFormat

struct bytertc::AudioFormat

音频参数格式

Defined in : bytertc_defines.h

成员变量

类型 名称
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 代理状态

Defined in : bytertc_defines.h

枚举值

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

Socks5ProxyState

enum bytertc::Socks5ProxyState

SOCKS5 代理连接状态

Defined in : bytertc_defines.h

枚举值

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

ASRAuthorizationType

enum bytertc::ASRAuthorizationType

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

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kASRAuthorizationTypeToken 0 Token 鉴权
kASRAuthorizationTypeSignature 1 Signature 鉴权

RTCASRConfig

struct bytertc::RTCASRConfig

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

Defined in : bytertc_defines.h

成员变量

类型 名称
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 重启语音识别功能。

Defined in : bytertc_defines.h

枚举值

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

RecordingType

enum bytertc::RecordingType

本地录制的媒体类型

Defined in : bytertc_defines.h

枚举值

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

RecordingFileType

enum bytertc::RecordingFileType

本地录制文件的存储格式

Defined in : bytertc_defines.h

枚举值

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

RecordingState

enum bytertc::RecordingState

本地录制的状态

Defined in : bytertc_defines.h

枚举值

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

RecordingErrorCode

enum bytertc::RecordingErrorCode

本地录制的错误码

Defined in : bytertc_defines.h

枚举值

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

RecordingProgress

struct bytertc::RecordingProgress

本地录制进度

Defined in : bytertc_defines.h

成员变量

类型 名称
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

本地录制的详细信息

Defined in : bytertc_defines.h

成员变量

类型 名称
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

本地录制参数配置

Defined in : bytertc_defines.h

成员变量

类型 名称
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

混音播放类型

Defined in : bytertc_defines.h

枚举值

类型 值 说明
kAudioMixingTypePlayout 0 仅本地播放
kAudioMixingTypePublish 1 仅远端播放
kAudioMixingTypePlayoutAndPublish 2 本地和远端同时播放

AudioMixingConfig

struct bytertc::AudioMixingConfig

混音配置

Defined in : bytertc_defines.h

成员变量

类型 名称
AudioMixingType type
int play_count

变量说明

type

AudioMixingType bytertc::AudioMixingConfig::type;

混音播放类型,详见 AudioMixingType

play_count

int bytertc::AudioMixingConfig::play_count;

混音播放次数,

VideoMetadataBuffer

struct bytertc::VideoMetadataBuffer

视频帧中包含的 metadata 信息

Defined in : bytertc_engine_lite_interface.h

成员变量

类型 名称
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

音频帧类型

Defined in : bytertc_engine_lite_interface.h

枚举值

类型 值 说明
FRAME_TYPE_PCM16 0 PCM 16bit

AudioFrame

struct bytertc::IAudioFrameObserver::AudioFrame

音频帧

Defined in : bytertc_engine_lite_interface.h

成员变量

类型 名称
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;

渲染时间

VideoRotation

enum bytertc::VideoRotation

视频帧旋转角度

Defined in : bytertc_video_frame.h

枚举值

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

VideoStreamScaleMode

enum bytertc::VideoStreamScaleMode

视频帧缩放模式

Defined in : bytertc_video_frame.h

枚举值

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

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

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

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

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

VideoCodecMode

enum bytertc::VideoCodecMode

视频编码模式

Defined in : bytertc_video_frame.h

枚举值

类型 值 说明
kCodecModeAuto 0 自动选择
kCodecModeHardware 1 硬编码
kCodecModeSoftware 2 软编码

VideoCodecType

enum bytertc::VideoCodecType

视频的编码类型

Defined in : bytertc_video_frame.h

枚举值

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

VideoEncodePreference

enum bytertc::VideoEncodePreference

网络不好时的视频编码降级策略

Defined in : bytertc_video_frame.h

枚举值

类型 值 说明
kVideoEncodePreferenceDisabled 0 不降级
kVideoEncodePreferenceFramerate 1 优先保证帧率,以保证视频流畅度
kVideoEncodePreferenceQuality 2 优先保证画质
kVideoEncodePreferenceBalance 3 平衡模式

VideoSolution

struct bytertc::VideoSolution

视频参数

Defined in : bytertc_video_frame.h

成员变量

类型 名称
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

视频属性

Defined in : bytertc_video_frame.h

成员变量

类型 名称
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

视频帧颜色编码格式

Defined in : bytertc_video_frame.h

枚举值

类型 值 说明
kVideoPixelFormatUnknown 0 未知的颜色编码格式
kVideoPixelFormatI420 1 YUV I420 格式
kVideoPixelFormatNV12 2 YUV NV12 格式
kVideoPixelFormatNV21 3 YUV NV21 格式
kVideoPixelFormatRGB24 4 RGB 24bit格式,
kVideoPixelFormatRGBA 5 RGBA 编码格式
kVideoPixelFormatARGB 6 ARGB 编码格式
kVideoPixelFormatBGRA 7 BGRA 编码格式

VideoFrameType

enum bytertc::VideoFrameType

视频帧格式

Defined in : bytertc_video_frame.h

枚举值

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

ManagedMemory

struct bytertc::ManagedMemory

自定义内存释放器

Defined in : bytertc_video_frame.h

成员变量

类型 名称
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

视频帧构建类

Defined in : bytertc_video_frame.h

成员变量

类型 名称
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;

视频旋转角度

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

设置视频帧

Defined in : bytertc_video_frame.h

静态函数

返回 名称
static IVideoFrame* build_video_frame

成员函数

返回 名称
virtual int frame_type
virtual int pixel_format
virtual int64_t timestamp_us
virtual int width
virtual int height
virtual int rotation
virtual int 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:VideoFrameBuilder

frame_type

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

获取视频帧类型

pixel_format

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

获取视频帧格式

timestamp_us

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

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

width

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

获取视频帧宽度

height

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

获取视频帧高度

rotation

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

获取视频帧旋转角度

color_space

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

获取视频帧颜色空间

number_of_planes

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

视频帧颜色 plane 数量

注意 yuv 数据存储格式分为 plane 存储格式和 pack 存储格式,plane 格式中有 y,u,v 分开存储,pack 中 yuv 数据

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()

视频帧数据转为 YUV I420 格式

IRTCASREngineEventHandler

class bytertc::IRTCASREngineEventHandler

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

Defined in : byte_rtc_asr_engine_event_handler.h

成员函数

返回 名称
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* 错误原因说明