本文介绍了AVAudioSessionManager availableInputs"端口iPhone麦克风的未知选定数据源“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的控制台日志中已经注意到这个错误了一段时间。虽然它不会影响我的应用程序的执行,但我发现它真的很烦人。因此,我开始追踪这个错误的来源。事实证明,当我调用availableInputs时

I've noticed this error in my console log for a while. Though it does not affect the execution of my application, I find it really annoying. Thus, I started to trace where this error came from. It turns out when I call availableInputs

NSArray *inputs = [[AVAudioSession sharedInstance] availableInputs];

它会给我一条日志信息:

It will give me the log message:

ERROR:     [0x3d61318c] AVAudioSessionPortImpl.mm:50: ValidateRequiredFields: Unknown selected data source for Port iPhone Microphone (type: MicrophoneBuiltIn)

我试图打印输入..

Printing description of inputs:
<__NSArrayI 0x188c4610>(
<AVAudioSessionPortDescription: 0x188c4580, type = MicrophoneBuiltIn; name = iPhone Microphone; UID = Built-In Microphone; selectedDataSource = (null)>,
<AVAudioSessionPortDescription: 0x18835d90, type = BluetoothHFP; name = Valore-BTi22; UID = 00:23:01:10:38:77-tsco; selectedDataSource = (null)>

所以selectedDataSource是(null)。我不知道怎么办才能使它不为空?iPhone麦克风是一个内置的输入...我想它已经由Apple设定了?

So selectedDataSource is (null). I don't know what should I do to make it not null? iPhone Microphone is a built-in input... I suppose it's set by Apple already?

推荐答案

这个问题em似乎不仅仅发生在我身上......我将在这里分享我的理解..

This problem seems not just happen to me... I will just share my understanding here..

我的情况是......我正在使用pjsip库,它有一个较低的音频资源的电平控制。我注意到,在我调用 [[AVAudioSession sharedInstance] availableInputs]之前声音设备已关闭;

My situation is.. I'm using pjsip library, which has a lower level control of audio resources. I've noticed that, the sound device has been closed before I call [[AVAudioSession sharedInstance] availableInputs];

因此,(我猜) AVAudioSession ,作为更高级别的控件,无法为其输入找到相应的音频数据源 - 如错误所示......

Thus, (I guess) AVAudioSession, as a higher level control, couldn't find corresponding audio data source for its input - as the error indicated...

要进一步调查此问题,最好检查代码中修改音频源的地方..并确保在调用 AVAudioSession

To further investigate the problem, you'd better check somewhere in your code that modify the audio source.. and make sure the audio source is activated before you call AVAudioSession

我现在只能走这么远...对音频控制的深入理解和更好的解释总是受到赞赏!!

I can only go this far for now... Deeper understanding and better explanation of audio control is always appreciated!!

这篇关于AVAudioSessionManager availableInputs&quot;端口iPhone麦克风的未知选定数据源“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 02:14