File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -213,8 +213,13 @@ Result AudioStreamAAudio::open() {
213213 }
214214
215215 if (mLibLoader ->builder_setInputPreset != nullptr ) {
216+ aaudio_input_preset_t inputPreset = mInputPreset ;
217+ if (getSdkVersion () <= __ANDROID_API_P__ && inputPreset == InputPreset::VoicePerformance) {
218+ LOGD (" InputPreset::VoicePerformance not supported before Q. Using VoiceRecognition." );
219+ inputPreset = InputPreset::VoiceRecognition; // most similar preset
220+ }
216221 mLibLoader ->builder_setInputPreset (aaudioBuilder,
217- static_cast <aaudio_input_preset_t >(mInputPreset ));
222+ static_cast <aaudio_input_preset_t >(inputPreset ));
218223 }
219224
220225 if (mLibLoader ->builder_setSessionId != nullptr ) {
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ static SLuint32 OpenSLES_convertInputPreset(InputPreset oboePreset) {
3636 openslPreset = SL_ANDROID_RECORDING_PRESET_CAMCORDER;
3737 break ;
3838 case InputPreset::VoiceRecognition:
39+ case InputPreset::VoicePerformance:
3940 openslPreset = SL_ANDROID_RECORDING_PRESET_VOICE_RECOGNITION;
4041 break ;
4142 case InputPreset::VoiceCommunication:
You can’t perform that action at this time.
0 commit comments