Browse Source

Android/openslES: fix Pause/ResumeDevices when openslES is not used

Sylvain Becker 6 years ago
parent
commit
1b24b2eca5
1 changed files with 12 additions and 12 deletions
  1. 12 12
      src/audio/openslES/SDL_openslES.c

+ 12 - 12
src/audio/openslES/SDL_openslES.c

@@ -602,23 +602,23 @@ AudioBootStrap openslES_bootstrap = {
 
 void openslES_ResumeDevices()
 {
-    SLresult result;
-
-    /* set the player's state to 'playing' */
-    result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING);
-    if (SL_RESULT_SUCCESS != result) {
-        SDL_SetError("Play set state failed");
+    if (bqPlayerPlay != NULL) {
+        /* set the player's state to 'playing' */
+        SLresult result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING);
+        if (SL_RESULT_SUCCESS != result) {
+            SDL_SetError("openslES_ResumeDevices failed");
+        }
     }
 }
 
 void openslES_PauseDevices()
 {
-    SLresult result;
-
-    /* set the player's state to 'paused' */
-    result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PAUSED);
-    if (SL_RESULT_SUCCESS != result) {
-        SDL_SetError("Playe set state failed");
+    if (bqPlayerPlay != NULL) {
+        /* set the player's state to 'paused' */
+        SLresult result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PAUSED);
+        if (SL_RESULT_SUCCESS != result) {
+            SDL_SetError("openslES_PauseDevices failed");
+        }
     }
 }