Skip to content

Commit

Permalink
set max frames per second
Browse files Browse the repository at this point in the history
  • Loading branch information
mprat committed Apr 10, 2013
1 parent cdb1447 commit d2b2819
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Binary file not shown.
22 changes: 10 additions & 12 deletions Rephoto/CameraViewController.mm
Expand Up @@ -143,23 +143,21 @@ -(void) initCamera{
[videooutput setSampleBufferDelegate:self queue:queue];
// dispatch_release(queue);



self.captureSession = [[AVCaptureSession alloc] init];
[self.captureSession addInput:devInput];
[self.captureSession addOutput:videooutput];

// what is this for, actually?
// double max_fps = 30;
// for(int i = 0; i < [[output connections] count]; i++) {
// AVCaptureConnection *conn = [[output connections] objectAtIndex:i];
// if (conn.supportsVideoMinFrameDuration) {
// conn.videoMinFrameDuration = CMTimeMake(1, max_fps);
// }
// if (conn.supportsVideoMaxFrameDuration) {
// conn.videoMaxFrameDuration = CMTimeMake(1, max_fps);
// }
// }
double max_fps = 30;
for(int i = 0; i < [[videooutput connections] count]; i++) {
AVCaptureConnection *conn = [[videooutput connections] objectAtIndex:i];
if (conn.supportsVideoMinFrameDuration) {
conn.videoMinFrameDuration = CMTimeMake(1, max_fps);
}
if (conn.supportsVideoMaxFrameDuration) {
conn.videoMaxFrameDuration = CMTimeMake(1, max_fps);
}
}

[self.captureSession setSessionPreset: AVCaptureSessionPresetMedium];

Expand Down

0 comments on commit d2b2819

Please sign in to comment.