Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input stream fails to open on Android <10 when VoicePerformance preset is specified #1009

Closed
dturner opened this issue Sep 14, 2020 · 4 comments · Fixed by #1050
Closed

Input stream fails to open on Android <10 when VoicePerformance preset is specified #1009

dturner opened this issue Sep 14, 2020 · 4 comments · Fixed by #1050
Assignees
Labels
bug input_preset Bugs related to input presets
Milestone

Comments

@dturner
Copy link
Collaborator

dturner commented Sep 14, 2020

Android version(s): Android 9
Android device(s): Samsung Galaxy S9
Oboe version: 1.4.3
App name used for testing: LiveEffect
(Please try to reproduce the issue using the OboeTester or an Oboe sample.)

Short description
When you attempt to open an input stream using the VoicePerformance preset on Android 9 or below the stream will fail to open because the VoicePerformance preset is only available on Android 10 and above.

Steps to reproduce
On an Android 9 or below device load an app which will open an input stream in the following way. I modified the LiveEffect app for this.

builder->setInputPreset(oboe::VoicePerformance)
builder->openStream(...)

Expected behavior
This is up for debate but I'd expect a suitable substitute for VoicePerformance (maybe VoiceRecognition) to be selected and the stream to open successfully.

Actual behavior
The stream fails to open

@dturner
Copy link
Collaborator Author

dturner commented Sep 17, 2020

@rpattabi Any thoughts on this? Would you prefer to leave the behaviour as-is or have Oboe choose a suitable replacement for VoicePerformance on API <10 so that the stream opens successfully?

My feeling is for the latter but I don't want to break your (or anyone else's) code.

@dturner dturner removed their assignment Sep 17, 2020
@dturner dturner self-assigned this Sep 17, 2020
@rpattabi
Copy link
Contributor

You're right. For this specific question and for our app's specific requirements, we would prefer oboe not to fail but choose a preset as fallback. However, this may not be desired behavior for all the users. So we propose the following mechanism for input presets in general:

  • When user didn't provide any input preset, oboe shall choose one. This is already done by Oboe. Oboe uses VoiceRecognition as the default. As per what is mentioned in android cdd, it seems like good preset for most purposes (not just for voice recognition).
  • When user specifies a preset, and there is a device specific issue with that preset, the desired behavior of Oboe should be not to fail but to use a fallback preset. Again VoiceRecognition is the reasonable one. Even if VoiceRecognition itself is problematic on the device, then Generic and so on. There should be a clear warning in the logcat (or error?) about this when a fallback preset is chosen.
  • [feature request] User may have specific preference for presets, even for the fallback. AudioStreamBuilder API needs to allow the user to specify this preference. For example, setInputPreset(InputPreset desired, InputPreset fallback = VoiceRecognition). If there is a possibility of even the fallback preset to fail, API could consider taking additional fallbacks like setInputPreset(desired, fallback1, fallback2, ...). Alternatively, setInputPreset() could take a lambda that returns the preset. This way user can write their own fallback logic to choose the preset.
  • [feature request] Not all the users might desire the fallback behavior proposed above. They might prefer an error returned so that they can handle it better themselves. Oboe API can allow the user choose error over fallback behavior.

Hope this is clear. Thanks for asking.

@philburk philburk assigned philburk and unassigned dturner Oct 16, 2020
@philburk philburk added this to the v1.5 milestone Oct 16, 2020
@philburk
Copy link
Collaborator

I can add the fallback to VoiceRecognition for V1.5. That is a small change.

The feature request for an array of presets in order of preference is a nice idea will have to wait.

@philburk
Copy link
Collaborator

I reproduced this on an S10e running P.
I fixed the code and now it uses VoiceRecognition.
I also tested on S master and VoicePerformance is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug input_preset Bugs related to input presets
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants