Skip to content
Snippets Groups Projects
Commit 929923e6 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

opensl: gracefully fallback from AEC errors

Change-Id: I2a59248df58ad5e019d3ded0b97e4db95c5520cb
parent 3b14731d
Branches
No related tags found
No related merge requests found
...@@ -131,8 +131,9 @@ AudioRecorder::AudioRecorder(jami::AudioFormat sampleFormat, size_t bufSize, SLE ...@@ -131,8 +131,9 @@ AudioRecorder::AudioRecorder(jami::AudioFormat sampleFormat, size_t bufSize, SLE
SL_ANDROID_KEY_PERFORMANCE_MODE, SL_ANDROID_KEY_PERFORMANCE_MODE,
&modeSize, &modeSize,
(void*) &modeRetrieved); (void*) &modeRetrieved);
SLASSERT(result); if (result == SL_RESULT_SUCCESS) {
JAMI_WARN("Actual performance mode is %u\n", modeRetrieved); JAMI_WARN("Actual performance mode is %u\n", modeRetrieved);
}
/* Enable AEC if requested */ /* Enable AEC if requested */
if (aec) { if (aec) {
...@@ -144,18 +145,14 @@ AudioRecorder::AudioRecorder(jami::AudioFormat sampleFormat, size_t bufSize, SLE ...@@ -144,18 +145,14 @@ AudioRecorder::AudioRecorder(jami::AudioFormat sampleFormat, size_t bufSize, SLE
JAMI_WARN("AEC is %savailable\n", SL_RESULT_SUCCESS == result ? "" : "not "); JAMI_WARN("AEC is %savailable\n", SL_RESULT_SUCCESS == result ? "" : "not ");
if (SL_RESULT_SUCCESS == result) { if (SL_RESULT_SUCCESS == result) {
SLboolean enabled; SLboolean enabled;
result = (*aecItf)->IsEnabled(aecItf, &enabled); if ((*aecItf)->IsEnabled(aecItf, &enabled) == SL_RESULT_SUCCESS) {
SLASSERT(result); JAMI_WARN("AEC was %s\n", enabled ? "enabled" : "not enabled");
JAMI_WARN("AEC was %s\n", enabled ? "enabled" : "not enabled"); (*aecItf)->SetEnabled(aecItf, true);
if ((*aecItf)->IsEnabled(aecItf, &enabled) == SL_RESULT_SUCCESS) {
result = (*aecItf)->SetEnabled(aecItf, true); JAMI_WARN("AEC is now %s\n", enabled ? "enabled" : "not enabled");
SLASSERT(result); hasNativeAEC_ = enabled;
}
result = (*aecItf)->IsEnabled(aecItf, &enabled); }
SLASSERT(result);
JAMI_WARN("AEC is now %s\n", enabled ? "enabled" : "not enabled");
hasNativeAEC_ = enabled;
} }
} }
/* Enable AGC if requested */ /* Enable AGC if requested */
...@@ -168,16 +165,13 @@ AudioRecorder::AudioRecorder(jami::AudioFormat sampleFormat, size_t bufSize, SLE ...@@ -168,16 +165,13 @@ AudioRecorder::AudioRecorder(jami::AudioFormat sampleFormat, size_t bufSize, SLE
JAMI_WARN("AGC is %savailable\n", SL_RESULT_SUCCESS == result ? "" : "not "); JAMI_WARN("AGC is %savailable\n", SL_RESULT_SUCCESS == result ? "" : "not ");
if (SL_RESULT_SUCCESS == result) { if (SL_RESULT_SUCCESS == result) {
SLboolean enabled; SLboolean enabled;
result = (*agcItf)->IsEnabled(agcItf, &enabled); if ((*agcItf)->IsEnabled(agcItf, &enabled) == SL_RESULT_SUCCESS) {
SLASSERT(result); JAMI_WARN("AGC was %s\n", enabled ? "enabled" : "not enabled");
JAMI_WARN("AGC was %s\n", enabled ? "enabled" : "not enabled"); (*agcItf)->SetEnabled(agcItf, true);
if ((*agcItf)->IsEnabled(agcItf, &enabled) == SL_RESULT_SUCCESS) {
result = (*agcItf)->SetEnabled(agcItf, true); JAMI_WARN("AGC is now %s\n", enabled ? "enabled" : "not enabled");
SLASSERT(result); }
}
result = (*agcItf)->IsEnabled(agcItf, &enabled);
SLASSERT(result);
JAMI_WARN("AGC is now %s\n", enabled ? "enabled" : "not enabled");
} }
} }
/* Enable NS if requested */ /* Enable NS if requested */
...@@ -188,16 +182,13 @@ AudioRecorder::AudioRecorder(jami::AudioFormat sampleFormat, size_t bufSize, SLE ...@@ -188,16 +182,13 @@ AudioRecorder::AudioRecorder(jami::AudioFormat sampleFormat, size_t bufSize, SLE
JAMI_WARN("NS is %savailable\n", SL_RESULT_SUCCESS == result ? "" : "not "); JAMI_WARN("NS is %savailable\n", SL_RESULT_SUCCESS == result ? "" : "not ");
if (SL_RESULT_SUCCESS == result) { if (SL_RESULT_SUCCESS == result) {
SLboolean enabled; SLboolean enabled;
result = (*nsItf)->IsEnabled(nsItf, &enabled); if ((*nsItf)->IsEnabled(nsItf, &enabled) == SL_RESULT_SUCCESS) {
SLASSERT(result); JAMI_WARN("NS was %s\n", enabled ? "enabled" : "not enabled");
JAMI_WARN("NS was %s\n", enabled ? "enabled" : "not enabled"); (*nsItf)->SetEnabled(nsItf, true);
if ((*nsItf)->IsEnabled(nsItf, &enabled) == SL_RESULT_SUCCESS) {
result = (*nsItf)->SetEnabled(nsItf, true); JAMI_WARN("NS is now %s\n", enabled ? "enabled" : "not enabled");
SLASSERT(result); }
}
result = (*nsItf)->IsEnabled(nsItf, &enabled);
SLASSERT(result);
JAMI_WARN("NS is now %s\n", enabled ? "enabled" : "not enabled");
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment