Commit 8a318a08 authored by Erwan Croze's avatar Erwan Croze 👋🏻

Add opensles crappy flag for devices

parent 6f81005e
......@@ -32,6 +32,7 @@
#define DEVICE_HAS_CRAPPY_ANDROID_FASTRECORD (1<<5) /*set when the AUDIO_INPUT_FLAG_FAST flag of android AudioRecord doesn't work*/
#define DEVICE_HAS_UNSTANDARD_LIBMEDIA (1<<6) /*set when the libmedia backend shall not be used because of proprietary modifications made into it by the manufacturer*/
#define DEVICE_HAS_CRAPPY_OPENGL (1<<7) /*set when the opengl is crappy and our opengl surfaceview will crash */
#define DEVICE_HAS_CRAPPY_OPENSLES (1<<8) /*set when the opensles latency is crappy*/
struct SoundDeviceAudioHacks {
const char *mic_equalizer;
......
......@@ -248,11 +248,16 @@ static SLuint32 convertSamplerate(int samplerate)
}
static void android_snd_card_detect(MSSndCardManager *m) {
SoundDeviceDescription* d = NULL;
MSDevicesInfo *devices = NULL;
if (initOpenSLES() == 0) { // Try to dlopen libOpenSLES
ms_message("libOpenSLES correctly loaded, creating OpenSLES MS soundcard");
MSSndCard *card = android_snd_card_new(m);
ms_snd_card_manager_add_card(m, card);
devices = ms_factory_get_devices_info(m->factory);
d = ms_devices_info_get_sound_device_description(devices);
if (d->flags & DEVICE_HAS_CRAPPY_OPENSLES)
return;
MSSndCard *card = android_snd_card_new(m);
ms_snd_card_manager_add_card(m, card);
} else {
ms_warning("Failed to dlopen libOpenSLES, OpenSLES MS soundcard unavailable");
}
......@@ -693,26 +698,26 @@ static SLresult opensles_sink_init(OpenSLESOutputContext *octx) {
NULL
};
const SLuint32 nbInterface = 2;
const SLInterfaceID ids[] = { SLW_IID_VOLUME, SLW_IID_ANDROIDSIMPLEBUFFERQUEUE };
const SLboolean req[] = { SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE };
const SLuint32 nbInterface = 3;
const SLInterfaceID ids[] = { SLW_IID_VOLUME, SLW_IID_ANDROIDSIMPLEBUFFERQUEUE, SLW_IID_ANDROIDCONFIGURATION};
const SLboolean req[] = { SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE};
result = (*octx->opensles_context->engineEngine)->CreateAudioPlayer(octx->opensles_context->engineEngine, &(octx->playerObject), &audio_src, &audio_sink, nbInterface, ids, req);
if (result != SL_RESULT_SUCCESS) {
ms_error("OpenSLES Error %u while creating ouput audio player", result);
return result;
}
/*result = (*octx->playerObject)->GetInterface(octx->playerObject, SLW_IID_ANDROIDCONFIGURATION, &octx->playerConfig);
result = (*octx->playerObject)->GetInterface(octx->playerObject, SLW_IID_ANDROIDCONFIGURATION, &octx->playerConfig);
if (result != SL_RESULT_SUCCESS) {
ms_error("OpenSLES Error %u while getting android configuration interface", result);
return result;
}*/
}
/*result = (*octx->playerConfig)->SetConfiguration(octx->playerConfig, SL_ANDROID_KEY_STREAM_TYPE, &octx->streamType, sizeof(SLint32));
result = (*octx->playerConfig)->SetConfiguration(octx->playerConfig, SL_ANDROID_KEY_STREAM_TYPE, &octx->streamType, sizeof(SLint32));
if (result != SL_RESULT_SUCCESS) {
ms_error("OpenSLES Error %u while setting stream type configuration", result);
return result;
}*/
}
result = (*octx->playerObject)->Realize(octx->playerObject, SL_BOOLEAN_FALSE);
if (result != SL_RESULT_SUCCESS) {
......
......@@ -57,8 +57,9 @@ static SoundDeviceDescription devices[]={
{ "HTC", "HTC One_M8", "msm8974", 0, 120 },
{ "LGE", "LS670", "", 0, 170 },
{ "LGE", "Nexus 5", "msm8974", 0, 0 , 16000 },
{ "LGE", "LG-H815", "msm8992", DEVICE_HAS_BUILTIN_AEC, 0 },
{ "LGE", "LG-H735", "msm8916", DEVICE_HAS_BUILTIN_OPENSLES_AEC, 0, 16000},
{ "LGE", "LG-H815", "msm8992", DEVICE_HAS_BUILTIN_AEC, 0 },
{ "LGE", "LG-H735", "msm8916", DEVICE_HAS_BUILTIN_OPENSLES_AEC, 0, 16000},
{ "LGE", "LG-H850", "msm8996", DEVICE_HAS_BUILTIN_OPENSLES_AEC, 0}, /* LG5 */
{ "motorola", "DROID RAZR", "", 0, 400 },
{ "motorola", "MB860", "", 0, 200 },
{ "motorola", "XT907", "", 0, 500 },
......@@ -91,7 +92,8 @@ static SoundDeviceDescription devices[]={
{ "samsung", "GT-I9305", "", DEVICE_HAS_BUILTIN_AEC | DEVICE_HAS_UNSTANDARD_LIBMEDIA | DEVICE_HAS_BUILTIN_OPENSLES_AEC, 0 }, /*Galaxy S3*/
{ "samsung", "SAMSUNG-SGH-I337", "", DEVICE_HAS_BUILTIN_AEC | DEVICE_HAS_BUILTIN_OPENSLES_AEC, 0 }, /* Galaxy S4 ? */
{ "samsung", "GT-I9195", "", DEVICE_HAS_BUILTIN_AEC | DEVICE_HAS_BUILTIN_OPENSLES_AEC, 0 }, /* Galaxy S4 mini*/
{ "samsung", "SM-G920F", "exynos5", DEVICE_HAS_BUILTIN_OPENSLES_AEC, 0 }, /* Galaxy S6*/
{ "samsung", "SM-G920F", "exynos5", DEVICE_HAS_CRAPPY_OPENSLES, 0 }, /* Galaxy S6*/
{ "samsung", "SM-G930F", "exynos5", DEVICE_HAS_CRAPPY_OPENSLES, 0 }, /* Galaxy S7*/
{ "samsung", "GT-N7000", "", DEVICE_HAS_BUILTIN_AEC, 0 }, /*Galaxy Note*/
{ "samsung", "GT-N7100", "exynos4", DEVICE_HAS_BUILTIN_AEC, 0 }, /*Galaxy Note 2 */
{ "samsung", "GT-N7105", "", DEVICE_HAS_BUILTIN_AEC|DEVICE_HAS_UNSTANDARD_LIBMEDIA, 0 }, /*Galaxy Note 2 t0lte*/
......@@ -316,6 +318,7 @@ SoundDeviceDescription* ms_devices_info_get_sound_device_description(MSDevicesIn
if (d->flags & DEVICE_HAS_CRAPPY_ANDROID_FASTRECORD) ms_warning("Fasttrack record mode is crappy on this device, not using it.");
if (d->flags & DEVICE_HAS_UNSTANDARD_LIBMEDIA) ms_warning("This device has unstandart libmedia.");
if (d->flags & DEVICE_HAS_CRAPPY_OPENGL) ms_warning("OpenGL is crappy, not using it.");
if (d->flags & DEVICE_HAS_CRAPPY_OPENSLES) ms_warning("OpenSles is crappy, not using it.");
ms_message("Sound device information for [%s/%s/%s] is: builtin=[%s], delay=[%i] ms",
manufacturer, model, platform, (d->flags & DEVICE_HAS_BUILTIN_AEC) ? "yes" : "no", d->delay);
return d;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment