Skip to content

Instantly share code, notes, and snippets.

@reinhrst
Created March 15, 2012 00:14
Show Gist options
  • Save reinhrst/2040625 to your computer and use it in GitHub Desktop.
Save reinhrst/2040625 to your computer and use it in GitHub Desktop.
Mar 15 00:54:47 unknown mediaserverd[43] <Error>: 00:54:47.702 <0x2745000> AURemoteIO::ChangeHardwareFormats: error -10875 using AVCaptureAudioDataOutput

OK, so I am new to IPhone development, but I guess this is an error I won't be making any more!

In iOS 5.1, this code should have printed a lot of "Yeah, we've got something"'s... But in stead, all I got was Mar 15 00:54:47 unknown mediaserverd[43] <Error>: 00:54:47.702 <0x2745000> AURemoteIO::ChangeHardwareFormats: error -10875

- (void)viewDidLoad
{
  [super viewDidLoad];

  AVCaptureDevice *audioCaptureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
  AVCaptureSession *captureSession = [[AVCaptureSession alloc] init];
  AVCaptureDeviceInput *audioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioCaptureDevice error:nil];
  [captureSession addInput:audioInput];
  AVCaptureAudioDataOutput *audioOutput = [[AVCaptureAudioDataOutput alloc] init];
  [audioOutput setSampleBufferDelegate:self queue:dispatch_get_main_queue()];
  [captureSession addOutput:audioOutput];
  [captureSession startRunning];
}


- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {
    NSLog(@"Yeah, we got something!");
}

Turns out somehow garbage collection (or whatever you want to call it: auto ref count, etc) messed things up... Specifying the variables as instance vars in stead of local vars, fixed things!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment