-
Notifications
You must be signed in to change notification settings - Fork 207
Description
When calling preparePlayer() with shouldExtractWaveform: true on a large audio file (e.g. longer than 10 minutes), if the page is disposed quickly after initialization, a crash occurs in the native layer:
java.lang.IllegalStateException
at android.media.MediaCodec.native_queueInputBuffer(Native Method)
at android.media.MediaCodec.queueInputBuffer(MediaCodec.java:2735)
at com.simform.audio_waveforms.WaveformExtractor$startDecode$1$1.onInputBufferAvailable(WaveformExtractor.kt:72)
It seems the MediaCodec decoder is still running in the background and trying to queue/release buffers after the controller is disposed, which leads to native crashes.
Call preparePlayer(path: ..., shouldExtractWaveform: true) on a relatively large .m4a or .ogg file.
Quickly navigate away or dispose the page (calling dispose() on PlayerController).
After a short delay, the app crashes with IllegalStateException.
Device: e.g. Pixel 6 / Redmi K40
OS: Android 12 / 13
audio_waveforms version: 1.3.0
Flutter version: [your version] (e.g. 3.22.1)
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.