I use the Replaykit extension to recode the screen and transform the CMSampleBufferRef to CVPixelBufferRef, then add the video frame like this:
let rotation = RTCVideoRotation(rawValue: videoRotation)
let rtcPixlBuffer = RTCCVPixelBuffer(pixelBuffer: imageBuffer)
let rtcVideoFrame = RTCVideoFrame(buffer: rtcPixlBuffer,
rotation: rotation ?? ._0,
timeStampNs: Int64(timeStampNs))
webRTCClient.addVideoCapture(videoFrame: rtcVideoFrame)
}
func addVideoCapture(videoFrame: RTCVideoFrame) {
videoSource?.capturer(videoCapturer!, didCapture: videoFrame)
}
It works ok on iOS 15, but when I test it on iOS 16, I scroll the page on the sender, and I find the picture is choppy on the receiver. Does anyone know how to resolve this issue?