AudioUnit:mediaserverd报告的错误 - “错误”是什么'获取物理格式的客户端格式“

时间:2015-09-18 17:59:01

标签: ios ios9 audiounit

我有一个使用AudioUnit的VOIP应用程序。在iOS 9上,我看到一条错误消息,说明如下。我在iOS 8中没有看到这个:

  

mediaserverd [43]:13:16:38.880错误:[0x1f72d000]> va>   500:错误'什么'获取物理格式的客户端格式[   16/44100/2; flags:0xc; bytes / packet:4;帧/包:1;   bytes / frame:4; ]

有谁知道这意味着什么?音频似乎工作正常,但我仍然有点厌烦,如果可以,我想解决它。我的AudioUnit设置代码如下。帮助赞赏。感谢。

CheckError(NewAUGraph(&audioState.graph), "NewAUGraph failed");

AUNode rioNode;    
AudioComponentDescription desc;

desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_VoiceProcessingIO;
desc.componentFlags = 0;        // Documentation states "Set this value to zero"
desc.componentFlagsMask = 0;    // Documentation states "Set this value to zero"
desc.componentManufacturer = kAudioUnitManufacturer_Apple;

CheckError(AUGraphAddNode(audioState.graph, &desc, &rioNode), "AUGraphAddNode failed for RIO");
CheckError(AUGraphOpen(audioState.graph),"Failed to open graph");
CheckError(AUGraphNodeInfo(audioState.graph, rioNode, NULL, &audioState.rio),"Failed to get rio node info");

UInt32 flag = 1;
CheckError(AudioUnitSetProperty(audioState.rio,
                                kAudioOutputUnitProperty_EnableIO,
                                kAudioUnitScope_Input,
                                1,
                                &flag,
                                sizeof(flag)), "Enable IO Failed");

AudioStreamBasicDescription audioFormat;
size_t bytesPerSample = sizeof(SInt16);
audioFormat.mSampleRate         = 8000;
audioFormat.mFormatID           = kAudioFormatLinearPCM;
audioFormat.mFormatFlags        = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
audioFormat.mFramesPerPacket    = 1;
audioFormat.mChannelsPerFrame   = 1;
audioFormat.mBitsPerChannel     = 8 * (UInt32)bytesPerSample;
audioFormat.mBytesPerPacket     = (UInt32)bytesPerSample;
audioFormat.mBytesPerFrame      = (UInt32)bytesPerSample;

CheckError(AudioUnitSetProperty(audioState.rio,
                                kAudioUnitProperty_StreamFormat,
                                kAudioUnitScope_Output,
                                INPUT_BUS,
                                &audioFormat,
                                sizeof(audioFormat)), "Could not set RIO input stream format");

CheckError(AudioUnitSetProperty(audioState.rio,
                                kAudioUnitProperty_StreamFormat,
                                kAudioUnitScope_Input,
                                OUTPUT_BUS,
                                &audioFormat,
                                sizeof(audioFormat)), "Could not set RIO output stream format");


AURenderCallbackStruct callbackStruct;

// Set input callback
callbackStruct.inputProc = &recordingCallback;
callbackStruct.inputProcRefCon = &audioState;
CheckError(AudioUnitSetProperty(audioState.rio,
                                kAudioOutputUnitProperty_SetInputCallback,
                                kAudioUnitScope_Global,
                                INPUT_BUS,
                                &callbackStruct,
                                sizeof(callbackStruct)), "Could not set callback for recording");

// Set output callback
callbackStruct.inputProc = &playbackCallback;
callbackStruct.inputProcRefCon = &audioState;
CheckError(AudioUnitSetProperty(audioState.rio,
                                kAudioUnitProperty_SetRenderCallback,
                                kAudioUnitScope_Global,
                                OUTPUT_BUS,
                                &callbackStruct,
                                sizeof(callbackStruct)), "Could not set callback for playback");

0 个答案:

没有答案