Skip to content

Commit

Permalink
Updated to eliminate use of main dispatch queue. Thanks Jake Marsh
Browse files Browse the repository at this point in the history
  • Loading branch information
Erica Sadun authored and Erica Sadun committed Jul 23, 2010
1 parent a1793c7 commit 238ba47
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2,048 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
/build
5 changes: 4 additions & 1 deletion CameraImageHelper.m
Expand Up @@ -45,9 +45,12 @@ - (void) initialize
return;
}

// Update thanks to Jake Marsh who points out not to use the main queue
dispatch_queue_t queue = dispatch_queue_create("com.myapp.tasks.grabcameraframes", NULL);
AVCaptureVideoDataOutput *captureOutput = [[[AVCaptureVideoDataOutput alloc] init] autorelease];
captureOutput.alwaysDiscardsLateVideoFrames = YES;
[captureOutput setSampleBufferDelegate:self queue:dispatch_get_main_queue()];
[captureOutput setSampleBufferDelegate:self queue:queue];
// dispatch_release(queue); // Will not work when uncommented -- apparently reference count is altered by setSampleBufferDelegate:queue:

NSDictionary *settings = [NSDictionary dictionaryWithObject:[NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA] forKey:(NSString *)kCVPixelBufferPixelFormatTypeKey];
[captureOutput setVideoSettings:settings];
Expand Down

0 comments on commit 238ba47

Please sign in to comment.