AudioSystem: startAudioSource: ensure port handle initialized
In case of failure, port handle reported is not initialized by JNI layer. Any failing call to native AudioSystem::startAudioSource will not set the port handle, but returning an error status. JNI checks for port handle validity rather than error status. This CL ensures JNI checks first status to report an error, otherwise asserts on handle validity. Bug: 186088557 Test: make Signed-off-by: Francois Gaffie <francois.gaffie@renault.com> Change-Id: I4eb8046a1263aeb7d464d35a360a8adb77c4b1a5
This commit is contained in:
committed by
Eric Laurent
parent
011805bf48
commit
81b0519f04
@@ -1930,7 +1930,11 @@ android_media_AudioSystem_startAudioSource(JNIEnv *env, jobject clazz,
|
||||
audio_port_handle_t handle;
|
||||
status_t status = AudioSystem::startAudioSource(&nAudioPortConfig, paa.get(), &handle);
|
||||
ALOGV("AudioSystem::startAudioSource() returned %d handle %d", status, handle);
|
||||
return handle > 0 ? handle : nativeToJavaStatus(status);
|
||||
if (status != NO_ERROR) {
|
||||
return nativeToJavaStatus(status);
|
||||
}
|
||||
ALOG_ASSERT(handle > 0, "%s: invalid handle reported on successful call", __func__);
|
||||
return handle;
|
||||
}
|
||||
|
||||
static jint
|
||||
|
||||
Reference in New Issue
Block a user