Google WebRTC, , . https://groups.google.com/forum/?fromgroups=&hl=sv#!topic/discuss-webrtc/8TgRy9YWvVc - .
RTCAVFoundationVideoSource, captureSession, , AVCaptureSession.
Google ( , ?), - .
- :
for output in sourceAVFoundation.captureSession.outputs {
if let videoOutput = output as? AVCaptureVideoDataOutput {
self.videoOutput = videoOutput
NSLog("+++ FOUND A VIDEO OUTPUT: \(videoOutput) -> \(videoOutput.sampleBufferDelegate)")
externalVideoBufferDelegate = videoOutput.sampleBufferDelegate
videoOutput.setSampleBufferDelegate(self, queue: videoBufferDelegateQueue)
}
}
, videoBufferDelegate (.. WebRTC ), .
AVCaptureVideoDataOutputSampleBufferDelegate () , - :
func captureOutput(captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, fromConnection connection: AVCaptureConnection!) {
externalVideoBufferDelegate?.captureOutput!(captureOutput, didOutputSampleBuffer: sampleBuffer, fromConnection: connection)
dispatch_async(videoQueue) {
if self.assetWriterVideoInput.readyForMoreMediaData {
self.assetWriterVideoInput.appendSampleBuffer(sampleBuffer)
}
}
}
, , - externalVideoBufferDelegate, - WebRTC .