SimformSolutionsPvtLtd / audio_waveforms

Use this plugin to generate waveforms while recording audio in any file formats supported by given encoders or from audio files. We can use gestures to scroll through the waveforms or seek to any position while playing audio and also style waveforms
https://pub.dev/packages/audio_waveforms
MIT License
280 stars 146 forks source link

ANR triggered when calling stopRecording method in AudioRecorder on Android #332

Open duchl0202 opened 2 months ago

duchl0202 commented 2 months ago

Hello,

I'm experiencing an ANR (Application Not Responding) issue when stopping audio recording using the AudioRecorder.stopRecording() method from the audio_waveforms plugin. This issue doesn't crash the app but causes it to freeze while waiting for a binder transaction. Below is the stack trace of the issue:

      main (native):tid=1 systid=4120 

00 pc 0x9ae90 libc.so (__ioctl + 8)

01 pc 0x6932f libc.so (ioctl + 26)

02 pc 0x39a13 libbinder.so (android::IPCThreadState::talkWithDriver(bool) + 238)

03 pc 0x3a655 libbinder.so (android::IPCThreadState::waitForResponse(android::Parcel, int) + 32)

04 pc 0x3a42b libbinder.so (android::IPCThreadState::transact(int, unsigned int, android::Parcel const&, android::Parcel*, unsigned int) + 122)

05 pc 0x35267 libbinder.so (android::BpBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int) + 98)

06 pc 0x34b9f libmedia.so (android::BpMediaRecorder::stop() + 126)

07 pc 0x3b7df libmedia.so (android::MediaRecorder::stop() + 58)

08 pc 0x4c56b libmedia_jni.so (android_media_MediaRecorder_stop(_JNIEnv, _jobject) + 106)

   at android.media.MediaRecorder.stop(Native method)
   at com.simform.audio_waveforms.AudioRecorder.stopRecording(AudioRecorder.java)
   at com.simform.audio_waveforms.AudioWaveformsPlugin.onMethodCall(AudioWaveformsPlugin.java)
   at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java)
   at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java)
   at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0(DartMessenger.java)
   at android.os.Handler.handleCallback(Handler.java:938)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loop(Looper.java:223)
   at android.app.ActivityThread.main(ActivityThread.java:7815)
   at java.lang.reflect.Method.invoke(Native method)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1094)

Steps to Reproduce:

Start audio recording using the AudioRecorder.startRecording() method. Stop the recording using the AudioRecorder.stopRecording() method. Observe that the app freezes and eventually triggers an ANR.

Additional Information:

Flutter Version: 3.19.1 Plugin Version: 1.0.5 Android Version: 11 Device: Vivo V20 SE

himanshuGandhiSimform commented 3 days ago

Hello, @duchl0202 if possible, can you please share the code where you are doing this? and please also share how many numbers of files you are extracting at the same time. Thank you