Closed dkbg closed 4 years ago
Thanks for your report. I am sorry to hear, that the app crashes on your phone. Unfortunately I cannot reproduce the error here which means it is harder to track down. Let me know if you are willing to support me here.
I would especially be interested in the log-messages. You basically get them by enabling the developer options on your phone (Find the build number in "Settings > About Phone > Build Number" and tap on this number seven times, then you find the developer options under "Settings > System > Advanced > Developer Options", and there is the option "Take bug report" which is normally directly at the top). For the "bug report" your would choose the default option. For me I then get a notification, showing some progress bar. If tapping on the notification it asks me some details (none really needed), and when done you can share the result.
But before going into more details here and how to share this file (this shouldn't really be made public), let me know if you are willing to take the efforts. Otherwise I will see when I find some time and if I can spot the bug without more hints. There is also version 1.6.1 coming up, which fixes an issue, but I fear this won't solve your problem.
So I did some investigating and found some things in the logcat generated by the bug report function. This section (lines 84-103 in the attached file, I started the app twice so there are actually 2 duplicate stack traces in the file) looks particularly important, seems there's an array being indexed with too high a value in the de.moekadu.metronome.AudioEncoderKt.audioToPCM
method:
05-11 11:13:09.215 10263 11519 11519 E AndroidRuntime: java.lang.RuntimeException: Unable to create service de.moekadu.metronome.PlayerService: java.lang.ArrayIndexOutOfBoundsException: length=13584; index=13584
See the attached file for the logcat section I was looking at. Let me know if you need more information!
Thanks a lot!!! This is great work. It means that I am allocating not enough memory when decoding the audio files. This is unexpected and I never would have found that without your hints. However, I still have to find out, why audio decoding behaves differently on your phone since.
Would you be willing to install small tests on your phone to get more information? I would upload an apk files, which you simple would have install on your phone.
However, it might take me some days to get it ready ...
I would be willing to install a test APK, sure.
Seems like you're doing pretty low-level decoding work in the app, isn't there some Android API function to do the work you're doing? Please forgive my ignorance, I only have surface-level knowledge so I probably just don't understand what's being done!
It's not really low level decoding, it's just using a given decoder and storing the result. Seems pretty simple ;-). I don't know why this results in more sound samples on your phone than on my phone. A silly mistake? A rounding error? Hopefully we will find it soon.
Ok, here we go: https://github.com/thetwom/DecoderTest/releases/tag/v1.0.0 There you find an apk which loads all the sounds and prints some info to the screen. Would be great if you could post the output (or a screenshot, if not everything fits on the screen, make sure you scrolled up ...). Hopefully, this does not crash. If it does, let me know and I will add more checks ...
Just in case, you are interested ... this is my output
Okay, I've installed it and...unfortunately it crashes immediately on launch! ("DecoderTest keeps stopping" popup when I try to launch again)
This seems to be the cause:
java.lang.RuntimeException: Unable to start activity ComponentInfo{de.moekadu.decodertest/de.moekadu.decodertest.MainActivity}: java.lang.RuntimeException: AudioEncoder.decode: failed to get input buffer index
Thank for the quick response. I didn't expect this. I drafted a new version: https://github.com/thetwom/DecoderTest/releases/tag/v2.0 which hopefully should fail anymore.
Here's my output.
perfect, thanks, this explains the reason. The duration given by your output seems to be resolved in milliseconds instead of microseconds. Based on these numbers I do not correctly compute the correct frame number. I guess that the underlying reason is that your phone uses another decoder.
Now, that we know the reason I can easily fix this. Thanks a lot for this investigation. Without your support, I guess, I couldn't have solved this ... . I will upload a new version in the next days.
Can you try, if this version works for you? https://github.com/thetwom/toc2/releases/tag/v1.6.2-beta
I've tried the new version, unfortunately it still crashes. It launches, shows a totally blank white screen for several seconds, then quits suddenly.
According to the logcat, this is the exception:
java.lang.RuntimeException: Unable to create service de.moekadu.metronome.PlayerService: java.lang.RuntimeException: AudioEncoder.decode: failed to get input buffer index
...
Caused by: java.lang.RuntimeException: AudioEncoder.decode: failed to get input buffer index
...
AndroidRuntime: at de.moekadu.metronome.AudioDecoderKt.audioToPCM(AudioDecoder.kt:68)
One thing I should also mention is that the debug app does work, but it takes several seconds (probably ~10) for the output text to appear, after initially just showing a blank white screen.
OK, to bad. It is another problem, though. So thanks again for posting the logcat, this makes the process much easier. The problem that it takes the other app so long and the occuring error message are the same and I hope we can find the reason soon. I would post adapted test when I find some time.
I have the same problem, the app crashes immediately after opening it. I tried the 1.6.2-beta version too, and it has the same problem (although it takes longer before it crashes).
Xiaomi Mi 9T MIUI Global 11.0.5 Android 10
Hi, thanks for letting me know. Will try to find a solution soon. Situation seems to be pretty clear, so it shouldnt be to difficult to solve the issue :-) May be you can also try the DecoderTest posted above and post the result. This would give me a wider picture...
No problem! Here is the result from the DecoderTest:
Perfect, thanks.
Any of you guys could run this new test, report the output and if startup is now faster? https://github.com/thetwom/DecoderTest/releases/tag/v3.0
Now it loads almost immediately Here's the output:
The new version loads immediately. Here's my output:
Great! Looks like the problem is fixed. Everything seems good with this latest version.
Great to hear. Thanks again for your help investigating.
First of all, I really like the interface decisions you've made with this app! Very functional and intuitive.
Version 1.6.0 (installed via F-Droid) crashes immediately after launching. The first attempt appears to initialise the app, then it disappears. Subsequent attempts give the "Metronome keeps stopping" popup.
1.5.1 works fine.
I'm running stock firmware on a Motorola Moto G7 Play.