3

在创建 RTCVideoframe 时需要帮助

这是 RTCVideoframe 的 init 方法 RTCVideoFrame(buffer: RTCVideoFrameBuffer, rotation: RTCVideoRotation, timeStampNs: Int64)

我能够将输入缓冲区作为 CVPixelBuffer

我怎样才能转换CVpixelBufferRTCVideoFrameBuffer.

谢谢,非常感谢任何帮助

4

1 回答 1

7

使用我们收到的 cmSampleBuffer

`

sharedRecorder.startCapture(handler: { (cmSampleBuffer, rpSampleType, error) in
   switch rpSampleType {
  case RPSampleBufferType.video:

{
 let pixelBuffer = CMSampleBufferGetImageBuffer(cmSampleBuffer)!
 let rtcpixelBuffer = RTCCVPixelBuffer(pixelBuffer: pixelBuffer)
 videoFrame = RTCVideoFrame(buffer: rtcpixelBuffer, rotation: RTCVideoRotation._0, timeStampNs: Int64(timestamp))
}
} )}

`

于 2018-06-08T04:43:43.727 回答