Android/openslES: check for non NULL variable, some intialization.

use the previous naming
This commit is contained in:
Sylvain Becker 2019-01-14 14:36:13 +01:00
parent 7b1cc441dd
commit 647b1f6a6d

View file

@ -56,12 +56,12 @@ static SLObjectItf outputMixObject = NULL;
/* static const SLEnvironmentalReverbSettings reverbSettings = SL_I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR; */ /* static const SLEnvironmentalReverbSettings reverbSettings = SL_I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR; */
/* buffer queue player interfaces */ /* buffer queue player interfaces */
static SLObjectItf bqPlayerObject = NULL; static SLObjectItf bqPlayerObject = NULL;
static SLPlayItf bqPlayerItf; static SLPlayItf bqPlayerPlay = NULL;
static SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue; static SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue = NULL;
/*static SLEffectSendItf bqPlayerEffectSend; */ /*static SLEffectSendItf bqPlayerEffectSend = NULL; */
static SLMuteSoloItf bqPlayerMuteSolo; static SLMuteSoloItf bqPlayerMuteSolo = NULL;
static SLVolumeItf bqPlayerVolume; static SLVolumeItf bqPlayerVolume = NULL;
#if 0 #if 0
/* recorder interfaces TODO */ /* recorder interfaces TODO */
@ -353,7 +353,7 @@ openslES_CreatePCMPlayer(_THIS)
} }
/* get the play interface */ /* get the play interface */
result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_PLAY, &bqPlayerItf); result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_PLAY, &bqPlayerPlay);
if (SL_RESULT_SUCCESS != result) { if (SL_RESULT_SUCCESS != result) {
LOGE("SL_IID_PLAY interface get failed"); LOGE("SL_IID_PLAY interface get failed");
goto failed; goto failed;
@ -418,7 +418,7 @@ openslES_CreatePCMPlayer(_THIS)
} }
/* set the player's state to playing */ /* set the player's state to playing */
result = (*bqPlayerItf)->SetPlayState(bqPlayerItf, SL_PLAYSTATE_PLAYING); result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING);
if (SL_RESULT_SUCCESS != result) { if (SL_RESULT_SUCCESS != result) {
LOGE("Play set state failed"); LOGE("Play set state failed");
goto failed; goto failed;
@ -440,9 +440,11 @@ openslES_DestroyPCMPlayer(_THIS)
SLresult result; SLresult result;
/* set the player's state to 'stopped' */ /* set the player's state to 'stopped' */
result = (*bqPlayerItf)->SetPlayState(bqPlayerItf, SL_PLAYSTATE_STOPPED); if (bqPlayerPlay != NULL) {
if (SL_RESULT_SUCCESS != result) { result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_STOPPED);
SDL_SetError("Stopped set state failed"); if (SL_RESULT_SUCCESS != result) {
SDL_SetError("Stopped set state failed");
}
} }
/* destroy buffer queue audio player object, and invalidate all associated interfaces */ /* destroy buffer queue audio player object, and invalidate all associated interfaces */
@ -451,7 +453,7 @@ openslES_DestroyPCMPlayer(_THIS)
(*bqPlayerObject)->Destroy(bqPlayerObject); (*bqPlayerObject)->Destroy(bqPlayerObject);
bqPlayerObject = NULL; bqPlayerObject = NULL;
bqPlayerItf = NULL; bqPlayerPlay = NULL;
bqPlayerBufferQueue = NULL; bqPlayerBufferQueue = NULL;
/* bqPlayerEffectSend = NULL; */ /* bqPlayerEffectSend = NULL; */
bqPlayerMuteSolo = NULL; bqPlayerMuteSolo = NULL;
@ -603,7 +605,7 @@ void openslES_ResumeDevices()
SLresult result; SLresult result;
/* set the player's state to 'playing' */ /* set the player's state to 'playing' */
result = (*bqPlayerItf)->SetPlayState(bqPlayerItf, SL_PLAYSTATE_PLAYING); result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING);
if (SL_RESULT_SUCCESS != result) { if (SL_RESULT_SUCCESS != result) {
SDL_SetError("Play set state failed"); SDL_SetError("Play set state failed");
} }
@ -614,7 +616,7 @@ void openslES_PauseDevices()
SLresult result; SLresult result;
/* set the player's state to 'paused' */ /* set the player's state to 'paused' */
result = (*bqPlayerItf)->SetPlayState(bqPlayerItf, SL_PLAYSTATE_PAUSED); result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PAUSED);
if (SL_RESULT_SUCCESS != result) { if (SL_RESULT_SUCCESS != result) {
SDL_SetError("Playe set state failed"); SDL_SetError("Playe set state failed");
} }