modifying recording preset value to allow headset in

The current SL_ANDROID_RECORDING_PRESET_CAMCORDER value forced to use the internal mic.
By using SL_ANDROID_RECORDING_PRESET_VOICE_RECOGNITION, instead, the pulseaudio module will follow the general behavior of the operating system ( if external headset is plugged in, audio source will be the headset, otherwise it will be the internal mic. ) 
(The value names are not really indicative, this behavior has been found out by trial  and error following OpenSLES_AndroidConfiguration.h)
This commit is contained in:
dickreckard 2020-04-20 13:27:32 +02:00 committed by Leonid Pliushch
parent 1367754399
commit 43dcd2cb3b
1 changed files with 2 additions and 2 deletions

View File

@ -215,7 +215,7 @@ static int pa_init_sles_record(struct userdata *u, pa_sample_spec *ss) {
CHK((*u->EngineItf)->CreateAudioRecorder(u->EngineItf, &u->RecorderObject, &recSource, &recDest,
2, iidArray, required));
CHK((*u->engineObject)->GetInterface(u->RecorderObject, SL_IID_ANDROIDCONFIGURATION, (void*)&configItf));
SLuint32 presetValue = SL_ANDROID_RECORDING_PRESET_CAMCORDER;
SLuint32 presetValue = SL_ANDROID_RECORDING_PRESET_VOICE_RECOGNITION;
CHK((*configItf)->SetConfiguration(configItf, SL_ANDROID_KEY_RECORDING_PRESET,
&presetValue, sizeof(SLuint32)));
@ -223,7 +223,7 @@ static int pa_init_sles_record(struct userdata *u, pa_sample_spec *ss) {
SLuint32 presetSize = 2*sizeof(SLuint32); // intentionally too big
CHK((*configItf)->GetConfiguration(configItf, SL_ANDROID_KEY_RECORDING_PRESET,
&presetSize, (void*)&presetValue));
if (presetValue != SL_ANDROID_RECORDING_PRESET_CAMCORDER) {
if (presetValue != SL_ANDROID_RECORDING_PRESET_VOICE_RECOGNITION) {
fprintf(stderr, "Error retrieved recording preset\n");
}