| Summary: | Android "NullPointerException" in "audioWriteShortBuffer" | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Sylvain <sylvain.becker> |
| Component: | audio | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED INVALID | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | gabriel+bugzilla-libsdl |
| Version: | 2.0.3 | ||
| Hardware: | ARM | ||
| OS: | Android (All) | ||
|
Description
Sylvain
2015-04-16 16:50:17 UTC
If you get a chance, let us know the definite line this happens on, because I don't know which thing is NULL that shouldn't be, and under what circumstances. Thanks, --ryan. I have updated my app and finally got precisely the line where it fails. Error is still : java.lang.NullPointerException at org.libsdl.app.SDLActivity.audioWriteShortBuffer(SDLActivity.java:837) at dalvik.system.NativeStart.run(Native Method) Android version: Android 4.0.3 - 4.0.4 Android device: Eee Pad TF101 (TF101) the line is : 837 int result = mAudioTrack.write(buffer, i, buffer.length - i); I'm observing the same problem, unfortunately not on any of my devices, just through the Google Play crash reports. Only happens on Android 5.0 and newer devices. By looking at the code I assume the problem is in SDLActivity.java in the function audioOpen. In the error case it sets mAudioTrack to null and later when audioWriteShortBuffer is called mAudioTrack is null. But just checking for null isn't really a solution because it just hides the problem. One problem I see is that AudioFormat.CHANNEL_CONFIGURATION_STEREO (value 3) is deprecated since API5 and should be CHANNEL_OUT_STEREO (value 12). Or maybe doubling the buffer size helps, Android makes no sense as usual. Will experiment with this if it resolves the issue... Nope that is not the reason. When I force an audio initialisation failure at this location the application just terminates because the SDL Audio subsystem can't be initialized. So no idea at all what's going wrong here. Hey, Are you trying with the latest SDL2 code ? Not yet. I just updated my APK to 2.0.6 and wait now for new crash reports. Just saw that 2.0.7 is out, though. Closing it as I don't see it anymore, maybe something in android ... |