Skip to content

Commit

Permalink
oboe: return correct InputPreset when modified
Browse files Browse the repository at this point in the history
The InputPreset can be coerced from VoicePerformance to
VoiceRecognition. But getInputPreset() returned the wrong value.
Fixed for FilterAudioStream and OpenSL ES.

Fixes #1090
  • Loading branch information
philburk committed Nov 24, 2020
1 parent 7bc2eab commit 888826d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/common/FilterAudioStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class FilterAudioStream : public AudioStream, AudioStreamCallback {
// Copy parameters that may not match builder.
mBufferCapacityInFrames = mChildStream->getBufferCapacityInFrames();
mPerformanceMode = mChildStream->getPerformanceMode();
mInputPreset = mChildStream->getInputPreset();
}

virtual ~FilterAudioStream() = default;
Expand Down
4 changes: 4 additions & 0 deletions src/opensles/AudioInputStreamOpenSLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ Result AudioInputStreamOpenSLES::open() {
LOGW("%s() GetInterface(SL_IID_ANDROIDCONFIGURATION) failed with %s",
__func__, getSLErrStr(result));
} else {
if (getInputPreset() == InputPreset::VoicePerformance) {
LOGD("OpenSL ES does not support InputPreset::VoicePerformance. Use VoiceRecognition.");
mInputPreset = InputPreset::VoiceRecognition;
}
SLuint32 presetValue = OpenSLES_convertInputPreset(getInputPreset());
result = (*configItf)->SetConfiguration(configItf,
SL_ANDROID_KEY_RECORDING_PRESET,
Expand Down

0 comments on commit 888826d

Please sign in to comment.