由于明显不兼容的设置而导致录制wav时出错,升级到10.9后出现问题

时间:2013-11-06 15:44:39

标签: objective-c cocoa

我正在使用AVCaptureSession录制音频,一切正常,直到10.9。 我设置了这些设置:

[newAudioSettings setValue:[NSNumber numberWithInt:kAudioFormatLinearPCM]     forKey:AVFormatIDKey];    
[newAudioSettings setValue:[NSNumber numberWithBool:NO]  forKey:AVLinearPCMIsBigEndianKey];
[newAudioSettings setValue:[NSNumber numberWithInt:16] forKey:AVLinearPCMBitDepthKey];
[newAudioSettings setValue:[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsFloatKey];

并调用(会话在调用之前启动,当然)

[audioFileOutput startRecordingToOutputFileURL:<File URL> outputFileType:AVFileTypeWAVE recordingDelegate:<delegate>];

这曾经很好用,但现在录音立即停止,而didFinishRecordingToOutputFileAtURL的错误是:

Error Domain=AVFoundationErrorDomain Code=-11805 "Cannot Record" UserInfo=0x6180000ee580 {NSLocalizedFailureReason=The combination of audio file type and audio format in audioSettings is not supported, NSLocalizedDescription=Cannot Record, NSLocalizedRecoverySuggestion=Try recording again., AVErrorRecordingSuccessfullyFinishedKey=false}

查看错误代码(-11805),它指出不能写入任何数据。看来wav格式和那些设置之间存在一些不兼容性,但我看不出这是怎么回事。

有什么想法吗?

0 个答案:

没有答案