当前位置: 动力学知识库 > 问答 > 编程问答 >

ios - How to process a GPUImageVideoCamera as CMSampleBufferRef for QuickBlox SDK

问题描述:

I am currently using the VideoChat functionality of Quickblox SDK. Following the Custom Capture Session tutorial, I am able to create a custom video chat session between two users. However, I would like to apply filters to the stream before sending/forwarding the stream to quickblox.

Using an AVCaptureSession I create a serial queue to handle the processing of the frames with the following code:

dispatch_queue_t callbackQueue= dispatch_queue_create("cameraQueue", NULL);

[videoCaptureOutput setSampleBufferDelegate:self queue:callbackQueue];

Which then calls the function:

- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {

[self.videoChat processVideoChatCaptureVideoSample:sampleBuffer];

}

Where 'self.videoChat' is of type QBVideoChat.

I would like to take the output of 'GPUImageVideoCamera' and pass it through a filter, and finally forward the processed video to quickblox.

So far I can get the filter working by adding a target to the 'GPUImageVideoCamera', then adding a 'GPUImageView' as the target to the processed video as so:

[_liveVideo addTarget:myFilter];

[myFilter addTarget:_ImageView];

[_liveVideo startCameraCapture];

So, in conclusion, I cannot seem to figure out how to get the output from 'myFilter' forwarded to QuickBlox videoChat and was hoping someone can point me in the right direction. I hope this question was descriptive enough, and thanks in advance.

EDIT

Okay so when I asked the above question, for some reason when I set the GPUImageVideoCamera delegate to self, it wasn't working. However I gutted my code, down to the basics and now have the delegate firing on every frame. However, inside the function

-(void) WillOutputSampleBuffer (CMSampleBufferRef)sampleBuffer

I call

[self.videoChat processVideoChatCaptureVideoSample:sampleBuffer];

but my opponent still sees a blank screen. I am positive that the GPUImageVideoCamera is working because I am able to initialize a GPUImage and add it as a target to the camera and add the GPUImage as a sublayer to my viewController. Any and all advice would be greatly appreciated. Thanks.

分享给朋友:
您可能感兴趣的文章:
随机阅读: