Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8606629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:08:35+00:00 2026-06-12T03:08:35+00:00

I am trying to better understand the AVFoundation framework along with the various Core

  • 0

I am trying to better understand the AVFoundation framework along with the various Core xxxx frameworks so I decided to try a simple video capture and see if I can output as images to the UI. I looked at the rosyWriter code as well as documentation but with no answer. So:

I have the standard capture session code to add input and output. The following is relevant to the question:

//moving the buffer processing off the main queue
dispatch_queue_t bufferProcessingQueue=dispatch_queue_create("theBufferQueue", NULL);
[self.theOutput setSampleBufferDelegate:self queue:bufferProcessingQueue];
dispatch_release(bufferProcessingQueue);

And then the delegate:

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

    CVPixelBufferRef pb = CMSampleBufferGetImageBuffer(sampleBuffer);

    CIImage *ciImage = [CIImage imageWithCVPixelBuffer:pb];
    CGImageRef ref = [self.theContext createCGImage:ciImage fromRect:ciImage.extent];

    dispatch_async(dispatch_get_main_queue(), ^{
        self.testBufferImage.image= [UIImage imageWithCGImage:ref scale:1.0 orientation:UIImageOrientationRight];
    });
}

Questions:

1- I am guessing that as I did above, we should always set the delegate to run on a separate queue as I did above and not the main queue. Correct?

2- In conjunction, in the delegate method, any calls that deal with the UI have to be put back to the main queue like I did. Correct?

3- When I run this code, after about 5-10 seconds, I get a “Received memory warning” error and the app shuts. What could cause this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:08:36+00:00Added an answer on June 12, 2026 at 3:08 am

    1) Generally yes you should. You could run it on the main queue, but this can cause issues with UI responsiveness among other things.

    2) Correct.

    3) You are creating a series of CGImageRefs. Where are you releasing them?

    For performance reasons you should probably use OpenGL if you need fine control over the rendering of the video. Otherwise you can use AVCaptureVideoPreviewLayer for an easy way to get a preview.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build a simple MVC framework to better understand certain concepts. The
I'm trying to better understand Silverlights binding mechanism and so have created a simple
I am trying to better understand various platforms to serve ads in my Android
I have a simple jsfiddle where I'm trying to better understand value binding. I
I am trying to better understand basic concepts in OOP. What are static and
I'm trying to better understand the concept of 'autocommit' when working with a Postgres
I am trying to better understand when I should and should not use Iterators.
I'm trying to better understand what the stack trace means. I have a two
I've seen some examples, but trying to better understand how Resource files work, such
I'm trying to understand JQ better. I'm calling an JQ object $(.FamiliesList li li

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.