mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 19:38:14 +00:00
Android: audio change audio assert when try to open concurrent device to a real error
This commit is contained in:
@@ -75,8 +75,17 @@ static int aaudio_OpenDevice(_THIS, const char *devname)
|
|||||||
aaudio_result_t res;
|
aaudio_result_t res;
|
||||||
LOGI(__func__);
|
LOGI(__func__);
|
||||||
|
|
||||||
SDL_assert((captureDevice == NULL) || !iscapture);
|
if (iscapture) {
|
||||||
SDL_assert((audioDevice == NULL) || iscapture);
|
if (captureDevice) {
|
||||||
|
return SDL_SetError("An audio capture device is already opened");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!iscapture) {
|
||||||
|
if (audioDevice) {
|
||||||
|
return SDL_SetError("An audio playback device is already opened");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (iscapture) {
|
if (iscapture) {
|
||||||
if (!Android_JNI_RequestPermission("android.permission.RECORD_AUDIO")) {
|
if (!Android_JNI_RequestPermission("android.permission.RECORD_AUDIO")) {
|
||||||
|
@@ -40,8 +40,17 @@ static int ANDROIDAUDIO_OpenDevice(_THIS, const char *devname)
|
|||||||
SDL_AudioFormat test_format;
|
SDL_AudioFormat test_format;
|
||||||
SDL_bool iscapture = this->iscapture;
|
SDL_bool iscapture = this->iscapture;
|
||||||
|
|
||||||
SDL_assert((captureDevice == NULL) || !iscapture);
|
if (iscapture) {
|
||||||
SDL_assert((audioDevice == NULL) || iscapture);
|
if (captureDevice) {
|
||||||
|
return SDL_SetError("An audio capture device is already opened");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!iscapture) {
|
||||||
|
if (audioDevice) {
|
||||||
|
return SDL_SetError("An audio playback device is already opened");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (iscapture) {
|
if (iscapture) {
|
||||||
captureDevice = this;
|
captureDevice = this;
|
||||||
|
Reference in New Issue
Block a user