[Android Software/Hacking General [Developers Only]] fransemail:
I am trying to configure a mini PC (Beelink BT3) with Android x86 7.1-r2 to test various video conferencing software. I have attached a Microsoft LifeCam Studio and modified some configuration files to use it as main audio input device (configuration details below). I have repeated the test with other webcams with the same result.

A simple test with ALSA utilities succeeded ("alsa_aplay -C -t wav -D plughw:1,0 -f S16_LE ./test.wav"). Applications like Google search, Trueconf or Hangout use correctly the USB input. Other applications like Easy Voice Recorder or Whatsapp do not.

From an analysis of the log files, it looks like that they fail to initialize the audio recording and, in detail, to retreive the input buffer size. For instance, Easy Voice Recorders, reports the following:

08-30 18:46:01.902 1410 5789 W AudioFlinger: getInputBufferSize failed with minimum buffer size sampleRate 8000, format 0x1, channelMask 0x10

08-30 18:46:01.902 5205 5794 E AudioSystem: AudioSystem::getInputBufferSize failed sampleRate 8000 format 0x1 channelMask 10

08-30 18:46:01.902 5205 5794 E AudioRecord: AudioSystem could not query the input buffer size for sampleRate 8000, format 0x1, channelMask 0x10; status -22

Similar error reported by Whatsapp. Any idea about how to solve this issue?

/prod/alsa/cards

0 [IntelHdmiLpeAud]: IntelHdmiLpeAudiIntelHdmiLpeAudio - IntelHdmiLpeAudio

1 [StudioTM ]: USB-Audio - Microsoft® LifeCam Studio(TM)
Microsoft Microsoft® LifeCam Studio(TM) at usb-0000:00:14.0-1, high speed

/etc/init.sh

--- /etc/init.sh.original
+++ /etc/init.sh
@@ -42,9 +42,11 @@
;;
esac

-	if grep -qi "IntelHDMI" /proc/asound/card0/id; then
-	[ -d /proc/asound/card1 ] || set_property ro.hardware.audio.primary hdmi
-	fi
+#	if grep -qi "IntelHDMI" /proc/asound/card0/id; then
+#	[ -d /proc/asound/card1 ] || set_property ro.hardware.audio.primary hdmi
+#	fi
+
+ set_property ro.hardware.audio.primary hdmi
}

/etc/asound.conf

pcm.!default {
type asym
playback.pcm "hw:0,0"
capture.pcm "plughw:1,0"
}

/etc/audio_policy.conf

global_configuration {
attached_output_devices AUDIO_DEVICE_OUT_SPEAKER
default_output_device AUDIO_DEVICE_OUT_SPEAKER
attached_input_devices AUDIO_DEVICE_IN_USB_DEVICE
}

audio_hw_modules {
primary {
outputs {
primary {
sampling_rates 48000
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_AUX_DIGITAL
flags AUDIO_OUTPUT_FLAG_PRIMARY
}
}
}
a2dp {
outputs {
a2dp {
sampling_rates 44100
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_ALL_A2DP
}
}
}
usb {
outputs {
usb_accessory {
sampling_rates 44100
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_USB_ACCESSORY
}
usb_device {
sampling_rates 44100
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_USB_DEVICE
}
}
inputs {
usb_device {
sampling_rates 8000
channel_masks AUDIO_CHANNEL_IN_MONO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_IN_USB_DEVICE
}
}
}
}