Fixed bug #4982 - Failed to open audio_device on OpenSLES / Android 5.x with freq 96khz+
parent
ceb9e9a809
commit
a0cb079a42
|
@ -579,7 +579,7 @@ openslES_CreatePCMPlayer(_THIS)
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
|
|
||||||
return SDL_SetError("Open device failed!");
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -594,8 +594,24 @@ openslES_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||||
LOGI("openslES_OpenDevice() %s for capture", devname);
|
LOGI("openslES_OpenDevice() %s for capture", devname);
|
||||||
return openslES_CreatePCMRecorder(this);
|
return openslES_CreatePCMRecorder(this);
|
||||||
} else {
|
} else {
|
||||||
|
int ret;
|
||||||
LOGI("openslES_OpenDevice() %s for playing", devname);
|
LOGI("openslES_OpenDevice() %s for playing", devname);
|
||||||
return openslES_CreatePCMPlayer(this);
|
ret = openslES_CreatePCMPlayer(this);
|
||||||
|
if (ret < 0) {
|
||||||
|
/* Another attempt to open the device with a lower frequency */
|
||||||
|
if (this->spec.freq > 48000) {
|
||||||
|
openslES_DestroyPCMPlayer(this);
|
||||||
|
this->spec.freq = 48000;
|
||||||
|
ret = openslES_CreatePCMPlayer(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == 0) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return SDL_SetError("Open device failed!");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue