Ios 方法captureOutput:(AVCaptureOutput*)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)SampleBufferFromConnection只调用了几次
我正在从外部蓝牙麦克风捕获音频。但我什么都录不下来 此方法仅在当前AvCaptureSession开始时调用一次Ios 方法captureOutput:(AVCaptureOutput*)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)SampleBufferFromConnection只调用了几次,ios,bluetooth,avfoundation,audio-recording,ios-bluetooth,Ios,Bluetooth,Avfoundation,Audio Recording,Ios Bluetooth,我正在从外部蓝牙麦克风捕获音频。但我什么都录不下来 此方法仅在当前AvCaptureSession开始时调用一次 - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection 之后,我再也没有被调用这个方法来处理音频 为了实例化捕获会话,我执行
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection
之后,我再也没有被调用这个方法来处理音频
为了实例化捕获会话,我执行以下操作:
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 its own queue to ensure that our video processing doesn't cause us to 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];
如果我使用另一个蓝牙设备,它会一直工作,但不会与此设备一起工作。
我原以为这台设备可能有故障,但实际上正在另一个应用程序中录制音频
这个问题真的很奇怪。有人知道会发生什么吗
谢谢 您可以尝试使用CoreAudio或AVAudioEngine重新实现您的代码。我是否仍可以对视频使用相同的代码?因为我正在用音频录制视频。