fix: prevent "codec is released already" crash on Android#481
fix: prevent "codec is released already" crash on Android#481tobias-ottenweller-knowunity wants to merge 1 commit into
Conversation
- Add AtomicBoolean flag to ensure stop() executes only once - Check isStopped flag in MediaCodec callbacks before processing - Null out decoder/extractor references before releasing - Wrap release operations in try-catch for safety Fixes SimformSolutionsPvtLtd#477, SimformSolutionsPvtLtd#478
|
Tested, it fixes PlatformException "codec is released already" exception |
|
tested and it solves the issue. |
|
I hope this can be merged asap, this error is making the plugin unreliable. |
Closing in favor of #495Thanks @tobias-ottenweller-knowunity, and thanks to everyone who tested this. This PR pinned down the real cause of the Root cause (confirmed here)
Because We're folding the Android codec fixes into #495. It builds on what you did here, with one more addition-It closes a race this PR's guard can't reachThe The remaining gap is concurrency. The guard only protects re-entry into
If To reproduce: await controller.preparePlayer(path: longFile, shouldExtractWaveform: true);
// dispose while extraction is still running, before EOF
controller.dispose();The atomic does not serialize the callback against the release. Since #495 is a superset of this change, I am going to close this in favor of it. The diagnosis and field validation here were what made it possible to get it right, credit to you and the testers. |
Description
Checklist
fix:,feat:,docs:etc).[ ]I have updated/added tests for ALL new/updated/fixed functionality.[ ]I have updated/added relevant documentation indocsand added dartdoc comments with///.[ ]I have updated/added relevant examples inexamplesordocs.Breaking Change?
Related Issues
Fixes #477
as #478 crashed for me, this is another attempt resolving the underlying issue