You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add your record configuration
RecordConfig get _recordConfig => const RecordConfig(
bitRate: 64000,
sampleRate: 16000,
numChannels: 2,
);
Record and stop the recording.
Exception:
E/AndroidRuntime(32182): FATAL EXCEPTION: MediaCodecEncoder Thread
E/AndroidRuntime(32182): Process: com.weebumessenger.weebu, PID: 32182
E/AndroidRuntime(32182): java.lang.IllegalStateException: codec is released already
E/AndroidRuntime(32182): at android.media.MediaCodec.native_stop(Native Method)
E/AndroidRuntime(32182): at android.media.MediaCodec.stop(MediaCodec.java:2531)
E/AndroidRuntime(32182): at com.llfbandit.record.record.encoder.MediaCodecEncoder.stopAndRelease(MediaCodecEncoder.kt:171)
E/AndroidRuntime(32182): at com.llfbandit.record.record.encoder.MediaCodecEncoder.onError(MediaCodecEncoder.kt:161)
E/AndroidRuntime(32182): at com.llfbandit.record.record.encoder.MediaCodecEncoder.processOutputBuffer(MediaCodecEncoder.kt:155)
E/AndroidRuntime(32182): at com.llfbandit.record.record.encoder.MediaCodecEncoder.access$processOutputBuffer(MediaCodecEncoder.kt:15)
E/AndroidRuntime(32182): at com.llfbandit.record.record.encoder.MediaCodecEncoder$AudioRecorderCodecCallback.onOutputBufferAvailable(MediaCodecEncoder.kt:201)
E/AndroidRuntime(32182): at android.media.MediaCodec$EventHandler.handleCallback(MediaCodec.java:1952)
E/AndroidRuntime(32182): at android.media.MediaCodec$EventHandler.handleMessage(MediaCodec.java:1850)
E/AndroidRuntime(32182): at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(32182): at android.os.Looper.loopOnce(Looper.java:232)
E/AndroidRuntime(32182): at android.os.Looper.loop(Looper.java:317)
E/AndroidRuntime(32182): at android.os.HandlerThread.run(HandlerThread.java:85)
Add any other context about the problem here.
I debugged the bug and found out that for some reason the OnError function is called after stopping playback and discarding the Recorder object on the Flutter side.
E/AndroidRuntime(32182): on com.llfbandit.record.record.encoder.MediaCodecEncoder.onError(MediaCodecEncoder.kt:161)
As a workaround, I added a variable (ThreadSafe) to ensure that stopAndRelease is not called twice. And I also converted the mFinished variable to support multithreading. This solved the problem.
I didn't propose a PR because I have zero experience developing in Kotlin and I'm not sure how multitasking works with this package and in Kotlin in general.
The text was updated successfully, but these errors were encountered:
(record: ^5.1.2)
Android device.
App crashes due to an unhandled excepcion
Add your record configuration
RecordConfig get _recordConfig => const RecordConfig(
bitRate: 64000,
sampleRate: 16000,
numChannels: 2,
);
Record and stop the recording.
Exception:
E/AndroidRuntime(32182): FATAL EXCEPTION: MediaCodecEncoder Thread
E/AndroidRuntime(32182): Process: com.weebumessenger.weebu, PID: 32182
E/AndroidRuntime(32182): java.lang.IllegalStateException: codec is released already
E/AndroidRuntime(32182): at android.media.MediaCodec.native_stop(Native Method)
E/AndroidRuntime(32182): at android.media.MediaCodec.stop(MediaCodec.java:2531)
E/AndroidRuntime(32182): at com.llfbandit.record.record.encoder.MediaCodecEncoder.stopAndRelease(MediaCodecEncoder.kt:171)
E/AndroidRuntime(32182): at com.llfbandit.record.record.encoder.MediaCodecEncoder.onError(MediaCodecEncoder.kt:161)
E/AndroidRuntime(32182): at com.llfbandit.record.record.encoder.MediaCodecEncoder.processOutputBuffer(MediaCodecEncoder.kt:155)
E/AndroidRuntime(32182): at com.llfbandit.record.record.encoder.MediaCodecEncoder.access$processOutputBuffer(MediaCodecEncoder.kt:15)
E/AndroidRuntime(32182): at com.llfbandit.record.record.encoder.MediaCodecEncoder$AudioRecorderCodecCallback.onOutputBufferAvailable(MediaCodecEncoder.kt:201)
E/AndroidRuntime(32182): at android.media.MediaCodec$EventHandler.handleCallback(MediaCodec.java:1952)
E/AndroidRuntime(32182): at android.media.MediaCodec$EventHandler.handleMessage(MediaCodec.java:1850)
E/AndroidRuntime(32182): at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(32182): at android.os.Looper.loopOnce(Looper.java:232)
E/AndroidRuntime(32182): at android.os.Looper.loop(Looper.java:317)
E/AndroidRuntime(32182): at android.os.HandlerThread.run(HandlerThread.java:85)
Add any other context about the problem here.
I debugged the bug and found out that for some reason the OnError function is called after stopping playback and discarding the Recorder object on the Flutter side.
E/AndroidRuntime(32182): on com.llfbandit.record.record.encoder.MediaCodecEncoder.onError(MediaCodecEncoder.kt:161)
As a workaround, I added a variable (ThreadSafe) to ensure that stopAndRelease is not called twice. And I also converted the mFinished variable to support multithreading. This solved the problem.
I didn't propose a PR because I have zero experience developing in Kotlin and I'm not sure how multitasking works with this package and in Kotlin in general.
The text was updated successfully, but these errors were encountered: