-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crash when use aac format #6
Comments
Hey, thanks for this but could you give me a bit more information like a sample app with that bug so I can quickly investigate it |
I am in the process of upgrading to version 3 on my projects, so if I find it I will give it a fix.. but hard to see if I dont get it |
Hey I just wanted to add to this issue thread as we are encountering a similar issue on Android devices (iOS is fine). In our experience, the entire app crashes when the recording is stopped. Here is the exception I'm getting on an Android (SDK level 33) simulator, however it can also be reproduced on a physical Pixel 7 pro.
|
Ok, so when you press stop it just crashes? or gives an error and then crashes? |
Yes I have created a demo that replicates the issue it's based on the example provided in this repo but upgraded to work on the latest version of flutter (with a few hacks). When the recording uses the WAV codec it works as expected, but when the recording is stopped with AAC codec selected it hard crashes the app. I got that error from the android logcat for the emulator. I think there might be some sort of race condition happening? Its weird because sometimes it crashes on the first attempt, however sometimes it take 2, 3, or 4 recordings for it to crash. Example 1: Example 2: |
Does this only happen on the emulator? or does it happen on the device as well? |
I was able to replicate the issue both in the emulator and on a physical device (Pixel 7 Pro with Android 14). Also, I was poking around in the source code to see if I could find the source of the issue but it's been a while since I've done Android development. My suspicion is that there might be a race condition occurring when stopping the recording specifically when using the AAC format.
^ This suspicion comes from the fact that WAV has no issues recording and this issue is only for AAC files-- which require the use of mediaCodec I wasn't able to narrow it down and provide a fix in a reasonable amount of time but I just thought I would leave my finding here in case it helps with debugging! 😊 |
I've updated the version to latest. Let see if you get the same issue on the latest version... |
Hmm yeah I updated our application and we're still getting the same issue with version 1.1.0 |
ok, thanks can you use wav for now while this issue occurs? I will need to test the aac, I've never used it... |
This commit enhances the stability of the audio recording feature by improving error handling mechanisms. It ensures that resources are properly cleaned up in case of failures, preventing potential resource leaks and application crashes. Resolves loonix#6
D/AudioRecord(19201): mAudioRecord->stop()
E/AndroidRuntime(19201): FATAL EXCEPTION: Audio Processing Thread
E/AndroidRuntime(19201): Process: com.alone.host, PID: 19201
E/AndroidRuntime(19201): java.lang.IllegalStateException
E/AndroidRuntime(19201): at android.media.MediaCodec.releaseOutputBuffer(Native Method)
E/AndroidRuntime(19201): at android.media.MediaCodec.releaseOutputBuffer(MediaCodec.java:2871)
E/AndroidRuntime(19201): at com.loonix.another_audio_recorder.AACRecordThread.handleCodecOutput(AACRecordThread.java:226)
E/AndroidRuntime(19201): at com.loonix.another_audio_recorder.AACRecordThread.run(AACRecordThread.java:150)
E/AndroidRuntime(19201): at java.lang.Thread.run(Thread.java:919)
I/Process (19201): Sending signal. PID: 19201 SIG: 9
Lost connection to device.
The text was updated successfully, but these errors were encountered: