Skip to content

Commit

Permalink
OpenSL ES: Return ErrorInvalidFormat instead of ErrorInternal for inv…
Browse files Browse the repository at this point in the history
…alid format (#1634)
  • Loading branch information
robertwu1 authored Oct 19, 2022
1 parent 2ccbcca commit 9724ec6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/opensles/AudioStreamOpenSLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ Result AudioStreamOpenSLES::open() {

LOGI("AudioStreamOpenSLES::open() chans=%d, rate=%d", mChannelCount, mSampleRate);

// OpenSL ES only supports I16 and Float
if (mFormat != AudioFormat::I16 && mFormat != AudioFormat::Float) {
LOGW("%s() Android's OpenSL ES implementation only supports I16 and Float. Format: %d",
__func__, mFormat);
return Result::ErrorInvalidFormat;
}

SLresult result = EngineOpenSLES::getInstance().open();
if (SL_RESULT_SUCCESS != result) {
return Result::ErrorInternal;
Expand Down

0 comments on commit 9724ec6

Please sign in to comment.