ios - Method captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection only called a few times -
i'm capturing audio external bluetooth microphone. can't record anything.
this method called 1 time, @ beginning of current avcapturesession.
- (void)captureoutput:(avcaptureoutput *)captureoutput didoutputsamplebuffer:(cmsamplebufferref)samplebuffer fromconnection:(avcaptureconnection *)connection
after never called method process audio.
for instantiate capture session this:
self.capturesession.usesapplicationaudiosession = true; self.capturesession.automaticallyconfiguresapplicationaudiosession = true; [[avaudiosession sharedinstance] setcategory:avaudiosessioncategoryplayandrecord withoptions:avaudiosessioncategoryoptionallowbluetooth error:nil]; /* audio */ avcapturedevice *audiodevice = [avcapturedevice defaultdevicewithmediatype:avmediatypeaudio]; audioin = [[avcapturedeviceinput alloc] initwithdevice:audiodevice error:nil]; if ( [_capturesession canaddinput:audioin] ) { [_capturesession addinput:audioin]; } [audioin release]; audioout = [[avcaptureaudiodataoutput alloc] init]; // put audio on own queue ensure our video processing doesn't cause drop audio dispatch_queue_t audiocapturequeue = dispatch_queue_create( "com.apple.sample.capturepipeline.audio", dispatch_queue_serial ); [audioout setsamplebufferdelegate:self queue:audiocapturequeue]; [audiocapturequeue release]; if ( [self.capturesession canaddoutput:audioout] ) { [self.capturesession addoutput:audioout]; } _audioconnection = [audioout connectionwithmediatype:avmediatypeaudio]; [audioout release];
if use bluetooth device working, not one. thought device faulty, working in apps record audio.
is strange problem. knows happening?
thanks!
Comments
Post a Comment