react-native-compressor: Crash of video compression on Samsung J5

We are currently facing an error with the compression on a Samsung J5 device. It runs into an IllegalStateException in the VideoSlimmer.convertVideo() call.

We get the following stacktrace:

    android.media.MediaCodec.native_stop MediaCodec.java
    android.media.MediaCodec.stop MediaCodec.java:2251
    com.zolad.videoslimmer.VideoSlimEncoder.releaseCoder VideoSlimEncoder.java:613
    com.zolad.videoslimmer.VideoSlimEncoder.convertVideo VideoSlimEncoder.java:391
    com.zolad.videoslimmer.VideoSlimTask.doInBackground VideoSlimTask.java:30
    com.zolad.videoslimmer.VideoSlimTask.doInBackground VideoSlimTask.java:11
    android.os.AsyncTask$3.call AsyncTask.java:394
    java.util.concurrent.FutureTask.run FutureTask.java:266
    android.os.AsyncTask$SerialExecutor$1.run AsyncTask.java:305
    java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java:1167
    java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java:641
    java.lang.Thread.run Thread.java:923

We found out, that in the com.zolad.videoslimmer package the releaseCoder() method has no proper exception handling if an encoder is already released. This results in the exception bubbling up into the react-native-compressor package.

Is there any chance that we can fix this in this library?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 15 (10 by maintainers)

Most upvoted comments

Ok i have fixed the issue and created my own VideoSlimmer package. As long as the VideoSlimmer package is not maintained, I would propose to use my package here: https://github.com/daschaa/VideoSlimmer/packages/1163123

I can add you as maintainer if you want to. Then you don’t have to add the code to your native codebase. Would be cool if we could collaborate there. My plan is to refactor the package completely and add proper testing to it. What do you think @nomi9995 ? 🙌🏼

@NiklasLehnfeld I was copied code directly in this package but then I reverted. now i am using this package https://github.com/nomi9995/VideoCompressor

Sorry, I am a bit confused. Were you actually using the library? I don’t see the dependency in the build.gradle in the last few commits. 🤔

And it was also not used anywhere in the commit you reverted, was it?

@nomi9995 Did you check the license of the mentioned library? That is GPL 3. I am not a lawyer, but I think that would mean that you also have to change your license to GPL 3. And unfortunately I am currently not 100% sure, but I think that would mean that you would lose us as users.

Correct me if I am wrong.

I can not tell you exactly the reproducible step because i just saw this issue often in our crash reports. I think the problem lays in the third-party-dependency rather than in this library. I can only reference to the stacktrace given above.