SoundPool issue - bad performance on a specific device/API level - android

OK, this one is a bit odd.
My app is an OpenGL ES 2.0 game and uses MediaPlayer to play the background music (not on a service as I want the music to stop when the app is send into the background) and SoundPool to play the (various, short) sound effects.
It's been tested on aprox 18 devices and a wide range of OS versions with no problems. However I recently ran it on a Hudl2 tablet with Lollipop installed and the performance was pretty bad (very choppy).
If I use my games settings to turn off the sound, it runs fine (strangely, if I leave the sound on and turn off the music, it also runs fine).
However, there are a lot of questions here relating to SoundPool causing lag, so I'm going with SoundPool being the likely cause.
Things I've tried are:
Playing a muted sound in my gameloop
Using MP3's instead of .OGG's
Reducing the number of simultaneous streams
Playing the sounds from the UI Thread (normally I call 'play' from the GL Thread)
Checking for API Level and using SoundPool.Builder when it detects API 21+ and the older constructor method when it finds an API of <21
Turning off USB Debugging and disconnecting from my dev computer
Removing my AdViews (in case they were causing the problem - clutching at straws here)
Disabling Hardware Acceleration in my manifest (more clutching at straws)
Unfortunately, nothing that I've listed makes any difference.
After much research, I found some people saying that soundPool should be run on a new thread, however, I already tried it on the UI thread and it made no difference at all.
The only other thing I can think of is that this is some kind of compatibility issues between the Hudl2 and Lollipop.
Does anyone have any other ideas as to what may be causing this lag on one specific device, with this specific OS Version (Lollipop)), or has anyone come across anything remotely similar? And if so are there any more suggestions?
Edit
I forgot to mention that I ran it on the same device (Hudl 2) with KitKat installed and it was perfectly fine. And on my Nexus 10 with Lollipop again, it's perfectly fine.

Related

Android game GPU compatibility issue

my first android game it's almost done, and I'm on the way to publish it on the play store.
Today I tested it on some friends phone and it worked on all except for a samung a5. On this phone the meshes flicker, apper and disapper and look deformed. This when playing game where I use a lot of frame buffer, in the main menu where there is a simpler animation everything look right.
The game is developed with libGdx and use some custom shader. I've tested it on 8 other different device without no issue (excepect for low frame rate on samsung galaxy tab s4).
I ask yours advise:
1) what should I start to check to find the problem with a5?
2) do you think I should delay the publication until the bug it's solved ora I should publish it excluding A5 ( or maybe all devices with similar GPU) from compatibility list?
My big problem is that at the moment I don't have the device with me (it's the personal phone of a friend of mine...) and probably I will have it for only a limited amount of time, so I want to be preparated to avoid to lock the device for too much time to my friend.
Thanks to all!
First, I'd make sure you don't have any OpenGL errors - add calls to glGetError and validate frame buffers and shader programs, you can do this without the device and adding extra asserts like this is always worthwhile (assuming you don't already have them). Next, try using the tools provided by the GPU manufacturer. In your case the snapdragon profiler. To minimize the time you'll be using your friends device, get the tools installed ahead of time and if you have access to another Qualcomm device, then use that to familiarize yourself with the software. With luck the cause of problem might become immediately obvious. If not, then it's just a binary search of disabling parts of your code until you narrow it down to a particular shader/draw call, then examine/tweak that to figure out what bit is going wrong.
That's a tough call. If it's a driver bug, then it might only occur on particular revisions. Some A5 devices might work if they're on different versions of Android from your friends device. That said, the A5 is relatively recent and Samsung/Qualcomm drivers tend to be pretty solid IME, so it's more likely an error in your code that happens to only be exposed on certain devices. Personally I would delay release unless your release strategy is timing sensitive, from the limited data you have, your game doesn't work on >10% of devices.

Adreno 420 driver bug on Android 5.1

Just wanted to share an experience I had to see if anyone came across such issue, if they found the cause and more importantly how they fixed it.
The problem is pretty simple: while debugging native code on a Nexus 6, which as the Adreno 420 GPU, eglSwapBuffer could crash under certain circumstances when using Android 5.1 (5.0 worked perfectly).
Since I could not repro it I am unable to tell you what went wrong. According to the documentation, elgSwapBuffer calls internally glFlush; and so if I call glFlush before calling eglSwapBuffer all of a sudden it works perfectly.
My guess is that the driver does not flush properly thus crashing when swaping the buffers.
Any comments on this?
Cheers,
D
I'm having the same problem and I can reproduce it. It happens obviously because it runs out of stack memory due to deep nested loops in the rendering process.
Android Lollipop 5.1: Fatal signal 11 (SIGSEGV), code 2, fault addr 0x9e985ff8 in tid 4093 (RenderThread) / when using lot of nine patch graphics
I've already reported it to the google issue tracker:
https://code.google.com/p/android/issues/detail?id=163100
Update: Meanwhile I found a way to work around this issue. It's definitely not a long time solution, but for the moment, it's just the best available to stop my apps from crashing.
I disabled GPU rendering for particular graphic layers. It slows the drawing down a bit, but not significant.
So the nightmare is over for now, but I still think, this issue must be fixed on the driver itself. It cannot be that something that worked perfect with 5.0.2 and below, immediately stops to work with 5.1.
I have seen some weird behavior on the N6 as well, and while I cannot rule out app bugs, it looks to me like the Adreno driver is to blame.
Specifically, in landscape mode, our GLSurfaceView only renders one half of it's content, but occasionally flickers all of it. And with certain scenes being rendered there is intermittent flickering. In a case of extra weirdness, I have seen one half of the screen completely freeze, stuck on app content, even after returning to the launcher via the home button. It appears kind of like it would if it used multi stream transport and one of the streams was getting lost.

M4A audio stops early on android 5.0 on nexus 5

I'm writing an android audio player and on my nexus 5 running android 5.0 the MedaPlayer stops playing audio tracks around 2 to 5 seconds early. It's not predictable. It can change on the same track. Is there anyone else experiencing this, that found a workaround. I know this is not just my app that's having this issue on this device, because I tested it in Vanilla Music Player and it did the same thing. I've seen a few other people post on things sort of similar, but in most cases I see it has to do with steaming.
According to this answser:
https://stackoverflow.com/a/27827402/1415199
This is a bug in Android.
Ok it looks like the issue is Android 5.0.1's experimental MediaPlayer
called NuPlayer. NuPlayer is being enabled by default on all Android
5.0.1 devices and is only disabled through Developer Options. I've filed a bug against Android here:
https://code.google.com/p/android/issues/detail?id=94069&thanks=94069&ts=1420659450
The link above contains a suggested workaround

Android App Perfomance Issues on JellyBean

I am working on a project where we are creating an Android app that requests data from a server to be displayed on the user's device (not sure how much more background information I can give... will try my best if more is needed). We are supporting from Gingerbread (2.3) and upwards (up to latest JellyBean 4.2).
Now the odd thing is that the app runs very fast and smoothly on phones that are running 2.3.x (these are in general, slightly older devices such as LG Optimus 2X), while if we try and run the app on relatively newer devices (Galaxy s3 etc.) that have JellyBean 4.1+, the app runs so slow that the performance becomes a usability issue. This occurs on screens that pulls data from the servers and displays them.
I have also confirmed this behaviour by running it on the emulator.
So I did some research based on the fact that we get the following in LogCat for only 4.1+:
06-29 23:11:17.796: I/Choreographer(691): Skipped X frames! The application may be doing too much work on its main thread.
So it seems like this thing called Choreographer was added for API lvl 16, and it coordinates timing of animations, inputs and drawings.
I'm wondering if this is causing this issue? Seems unlikely to be a hardware issue, our app doesn't have any animations and we do not have separate implementations for 2.3.x and 4.1+
Thanks
Starting with Ice Cream Sandwich, the default behavior of AsyncTask has changed from a parallelized executor to a serialized one.
As you are executing several network requests in a batch of AsyncTask (as seen in comment), that means your application waits for the previous request response before lauching the next one.
You can change the executor of an AsyncTask using this code:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
myTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
else {
myTask.execute();
}
Source: AsyncTask Threading Regression Confirmed from CommonsWare blog.
I has experienced the same thing on Kindle Fire, Sony Xperia Z and Samsung S4 (all with android 4.2).
The fix is: at App Manifest file remove "android:supportsRtl="true"".
Hope it will save your time. I spend 4 hours on tests and merging before i got it.

android game always freezes only on samsung galaxy s2

our new game seems to be smooth on other phones but on samsung gaxalxy s2 it always freezes and crashes. the application uses gdx lib. the issue seems to be connected with the music.
while the music is turned off from the code the gameplay is smooth, but after turning it on the whole series of crashes and freezes start.
Any solutions or advice on this ?
You can check the game here Fish vs Pirates
Thanks in advance.
The Samsung Galaxy S2 has a known audio bug: http://code.google.com/p/android/issues/detail?id=17623
Supposedly using the MediaPlayer API instead of the SoundPool API is supposed to work-around the issue. There are also reports that this is fixed in the ICS update. (If you're not using the SoundPool API, then you're probably not seeing this particular issue.)

Categories

Resources