Android: AudioSource microphone causes unsupported parameter, VerifyAndSetParameter errors

This question was also asked in Problems with the source of audio files of the MediaRecorder class - setAudioSource () is an unsupported parameter , however this author accepted the answer, which says that this happens only on the emulator, while (for me) it is not.

The problem occurs on my device - Galaxy S i9000. The device has a microphone and recording with a microphone works regardless of this error.

The following code reproduces this error (called inside a service):

int sampleRate = AudioTrack.getNativeOutputSampleRate(AudioManager.STREAM_SYSTEM);
int channelMode = AudioFormat.CHANNEL_IN_MONO;
int encodingMode = AudioFormat.ENCODING_PCM_16BIT; //only 16bit encoding is supported
int bufferSize = AudioRecord.getMinBufferSize(sampleRate, channelMode, encodingMode);
recorder = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, channelMode, encodingMode, bufferSize);

Setting the sampling rate to a lower value, such as 8000, does not solve the problem. Setting channelMode to stereo does not solve the problem.

When executing this code inside my service, when the microphone is available for use, the following errors will be returned:

01-28 14:50:14.860: ERROR/audio_input(2358): unsupported parameter: x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value
01-28 14:50:14.860: ERROR/audio_input(2358): VerifyAndSetParameter failed
01-28 14:50:15.246: ERROR/PVOMXEncNode(2358): PVMFOMXEncNode-Audio_AMRNB::DoPrepare(): Got Component OMX.SEC.amrenc handle 
01-28 14:50:15.258: ERROR/audio_input(2358): unsupported parameter: x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value
01-28 14:50:15.258: ERROR/audio_input(2358): VerifyAndSetParameter failed
01-28 14:50:15.328: ERROR/audio_input(2358): unsupported parameter: x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value
01-28 14:50:15.328: ERROR/audio_input(2358): VerifyAndSetParameter failed
01-28 14:50:15.356: ERROR/PVOMXEncNode(2358): PVMFOMXEncNode-Audio_AMRNB::DoPrepare(): Got Component OMX.SEC.amrenc handle 
01-28 14:50:15.359: ERROR/audio_input(2358): unsupported parameter: x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value
01-28 14:50:15.359: ERROR/audio_input(2358): VerifyAndSetParameter failed
01-28 14:50:15.367: ERROR/AudioHardwareALSA(2358): AudioStreamInALSA - input   - format = 1, channels = 16, rate = 44100
01-28 14:50:15.367: ERROR/AudioHardwareALSA(2358): AudioStreamInALSA - default - format = 1, channels = 16, rate = 44100
01-28 14:50:15.457: ERROR/AudioFlinger(2358): readInputParameters mInputBytes 8320, mFrameSize 2 mSampleRate 44100 mChannelCount(1)
01-28 14:50:15.457: ERROR/(2358): AFCCreateReSampler: avAFCInfo->bUsed[0] inSampleRate[44100] outSampleRate[44100] nChannel[1] outbitDepth[16]

Does anyone have a solution to this problem?

+3
source share
2 answers

I had the same problem as you. In my case, it turned out that the phone’s SD card is mounted on my PC as a USB drive when I connect my Android phone to my machine via USB. (which makes the application unable to access the file on the phone’s SD card)

It worked fine after disconnecting the USB drive on my Xperia 10.

+1
source

First put this in the manifest file:

<uses-permission android:name="android.permission.RECORD_AUDIO" />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Then you must uninstall your application and reinstall it in order to put this action in action.

+2
source

Source: https://habr.com/ru/post/1788495/


All Articles