Hi guys,
I released my game on Android using Godot 2.1.4 and I'm getting a lot of crash from different device about this issue:
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)
pid: 0, tid: 0 >>> it.megasoft78.fallingword <<<
backtrace:
#00 pc 0000000000033f20 /data/app/it.megasoft78.fallingword-1/lib/arm/libgodot_android.so (_ZN17AudioDriverOpenSL9set_pauseEb+24)
#01 pc 000000000003e2dc /data/app/it.megasoft78.fallingword-1/lib/arm/libgodot_android.so (Java_org_godotengine_godot_GodotLib_focusin+64)
#02 pc 000000000062cb7d /data/app/it.megasoft78.fallingword-1/oat/arm/base.odex
Here's the list of some devices:
I tried with all the devices I have but I'm not able to reproduce it.
Could you please help me?
looks like there's something wrong here.
https://github.com/godotengine/godot/blob/2.1/platform/android/audio_driver_opensl.cpp#L376-L387
maybe combination of...
connecting/disconnecting of earphone jack and...
go back and front of game?
@volzhs What do you mean for go back and front game?
I did try with connecting/disconnecting the earnphone on my device but it doesn't crash. I also tried to do it when sound was playing but no crash.
I don't think is that anyway because it's happening too often. I don't think there are so many people playing with earphone jack all the time.
Any other ideas?
This seems to be the calling method:
void OS_Android::main_loop_focusin() {
if (main_loop)
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
audio_driver_android.set_pause(false);
}
It's called onResume by Android:
https://github.com/godotengine/godot/blob/bbd8f2c1b42fbf800ae4703c3c68c4faef114331/platform/android/java/src/org/godotengine/godot/Godot.java
@Override
protected void onResume() {
// Other code...
mView.onResume();
mView.queueEvent(new Runnable() {
@Override
public void run() {
GodotLib.focusin();
}
});
// Other code...
I don't have a clue either, but I guessed the condition from the code.
I tried all the possible combinations. It's not that or at least it doesn't happen on my devices. :(
sad to hear that... I wish we could have a reproducing steps...
Is it possible that the instance of playItf is null or not initialized because it was paused?
(*playItf)->SetPlayState(playItf, SL_PLAYSTATE_PAUSED);
I'm suspicious about that but I can't confirm until reproducing it.
active is supposed to be true if playItf is initialized. Meaning if we are calling SetPlayState, then playItf can't be null. Right now I'm reading this OpenSL documentation and trying to figure out what is happening here.
Hi,
I'm not an expert but at page 560 of that document is saying
/* Pause the music - only do so if it is playing */
Maybe it's that?

@megasoft78 Awesome, I was on the same _possible_ solution for this problem:
As I said I'm not an expert on this things.
Are you a Godot developer? Do you think checking if it's playing will solve the problem?
Do I need to check if playItf is null as well?
Could you post the code for that?
@megasoft78 I'm a godot contributor, not a core maintainer. I'm not an expert, but I will compile it, and test it. I will test it on:
Once done, I will remove the WIP tag on the merge request.
Feel free to perform more tests on your side :100:
EDIT
I don't think we need to check if playItf is null because it is a global reference, so to be deleted we have to stop the main loop, and we would not have an issue on focusin.
Hi @xsellier,
Thank you very much.
Unfortunatelly I'm not able to reproduce it on my devices.
I got this error from Google Play Console.
Anyway when you'll have the changes I'll try to compile Godot with your changes and publish on the market. I'm sure if it doesn't work I'll see it in few days. :)
I've tested it on my phones and it works properly.
Tested it on both Samsung S4 and there is no regression.
_EDIT_
I've just published (internally) a fresh new version of my android game including this fix
@xsellier Could you post the fix so I can update my game and see if it solve the problem?
@megasoft78 Its been merged yesterday on branch 2.1 by @akien-mga