quickblox-ios-sdk: Problem sending frames from ReplayKit via QBRTCVideoCapture

I have a subclass of QBRTCVideoCapture that sends frames like this:

   func sendBuffer(buffer: CMSampleBuffer) {
        videoQueue.async {
            guard let buffer = CMSampleBufferGetImageBuffer(buffer) else { abort() }
            let frame = QBRTCVideoFrame(pixelBuffer: buffer, videoRotation: ._0)
            self.send(frame)
        }
    }

The frames appear on the other side’s QBRTCRemoteVideoView for several seconds, then on sender’s side I see multitude of these errors in terminal:

[carc] CAReportingClient.mm:320:-[CAReportingClient sendMessage:category:type:reporters:]_block_invoke: The operation couldn’t be completed. No valid RTCReporting and the session was started
2018-03-27 15:12:51.976283+0300 sender[551:55992] [carc] CAReportingClient.mm:320:-[CAReportingClient sendMessage:category:type:reporters:]_block_invoke: The operation couldn’t be completed. No valid RTCReporting and the session was started
2018-03-27 15:13:01.966826+0300 sender[551:55992] [carc] CAReportingClient.mm:320:-[CAReportingClient sendMessage:category:type:reporters:]_block_invoke: The operation couldn’t be completed. No valid RTCReporting and the session was started
2018-03-27 15:13:11.976554+0300 sender[551:56902] [carc] CAReportingClient.mm:320:-[CAReportingClient sendMessage:category:type:reporters:]_block_invoke: The operation couldn’t be completed. No valid RTCReporting and the session was started

PODS:

  • QuickBlox (2.16)
  • Quickblox-WebRTC (2.6.3)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23

Most upvoted comments

If you will have any other problems please let us know by creating a separate issue.

@truemetal Use self.adaptOutputFormat(toWidth: 340, height: 420, fps: 30) after setting the capture to localmediasteam videotrack:

self.session.localMediaStream.videoTrack.videoCapture = self.cameraCapture
self.adaptOutputFormat(toWidth: 340, height: 420, fps: 30)

@truemetal, Sorry my mistake. Should be:

import QuickbloxWebRTC
import ReplayKit

class ScreenCapture: QBRTCVideoCapture {
 
    open func startCapture() {
        /*
        Adapt frames to a specific width, height and fps before sending.
        
        @discussion Calling this function will cause frames to be scaled down to the
        requested resolution. Also, frames will be cropped to match the
        requested aspect ratio, and frames will be dropped to match the
        requested fps. The requested aspect ratio is orientation agnostic and
        will be adjusted to maintain the input orientation, so it doesn't
        matter if e.g. 1280x720 or 720x1280 is requested.
        */
        self.adaptOutputFormat(toWidth: 340, height: 420, fps: 30)

        RPScreenRecorder.shared().startCapture(handler: { (smapleBuffer, bufferType, error) in
            let source = CMSampleBufferGetImageBuffer(smapleBuffer)
            let frame = QBRTCVideoFrame(pixelBuffer: source, videoRotation: ._0)
            self.send(frame)
        }) { (err) in
            
        }
    }
}