RCRTCVideoFrame Class Reference

Inherits from NSObject
Declared in RCRTCVideoFrame.h

Overview

视频帧数据

  format

视频帧格式

@property (nonatomic, readonly) RCRTCVideoFrameFormat format

Discussion

视频帧格式

Declared In

RCRTCVideoFrame.h

  width

视频宽度,单位为像素

@property (nonatomic, readonly) NSInteger width

Discussion

视频宽度,单位为像素

Declared In

RCRTCVideoFrame.h

  height

视频高度,单位为像素

@property (nonatomic, readonly) NSInteger height

Discussion

视频高度,单位为像素

Declared In

RCRTCVideoFrame.h

  pixelBuffer

储存视频 buffer 对象

@property (nonatomic, readonly, nullable) CVPixelBufferRef pixelBuffer

Discussion

储存视频 buffer 对象

Declared In

RCRTCVideoFrame.h

  data

视频原始数据

@property (nonatomic, readonly, nullable) NSData *data

Discussion

视频原始数据

Declared In

RCRTCVideoFrame.h

  rotation

旋转角度,0,90,180,270 顺时针

@property (nonatomic, readonly) int rotation

Discussion

旋转角度,0,90,180,270 顺时针

Declared In

RCRTCVideoFrame.h

  timeStampNs

显示时间戳,单位为纳秒

@property (nonatomic, readonly) int64_t timeStampNs

Discussion

显示时间戳,单位为纳秒

Declared In

RCRTCVideoFrame.h

– initWithPixelBuffer:timeStampNs:rotation:

初始化视频帧数据

- (nullable instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer timeStampNs:(int64_t)timeStampNs rotation:(int)rotation

Parameters

pixelBuffer

储存视频 buffer 对象, 只支持 NV12(420f) 或者 BGRA 格式视频

timeStampNs

显示时间戳,单位为纳秒

rotation

旋转角度,0,90,180,270

Return Value

视频帧数据

Discussion

初始化视频帧数据

SDK 内部会持有 pixelBuffer,所以使用者生成的 pixelBuffer 需要 CVBufferRelease()

Declared In

RCRTCVideoFrame.h

– initWithSampleBuffer:rotation:

初始化视频帧数据

- (nullable instancetype)initWithSampleBuffer:(CMSampleBufferRef)sampleBuffer rotation:(int)rotation

Parameters

sampleBuffer

储存视频 buffer 对象, 只支持 NV12(420f) 或者 BGRA 格式视频

rotation

旋转角度,0,90,180,270

Return Value

视频帧数据

Discussion

初始化视频帧数据

SDK 内部会持有 sampleBuffer,所以使用者生成的 sampleBuffer 需要 CFRelease()

Declared In

RCRTCVideoFrame.h

– convertToPixelBuffer:

转码视频数据

- (void)convertToPixelBuffer:(CVPixelBufferRef)pixelBuffer

Parameters

pixelBuffer

转码后保存视频数据的buffer

@discussion 注意: 1.需要确保传入 CVPixelBufferRef 的宽高和 RCRTCVideoFrame 的宽高一致,否则会放弃转码。 2.请传入一个 NV12 或者 BGRA 格式的 CVPixelBufferRef, 否则会放弃转码。

added from 5.1.15

Discussion

转码视频数据

Declared In

RCRTCVideoFrame.h