Fix Failed to stop the muxer (ref #139)#159
Conversation
|
@natario1 |
|
Stacktrace: |
| if (eos) { | ||
| info.set(0, 0, 0, flags and MediaCodec.BUFFER_FLAG_END_OF_STREAM) | ||
| } else { | ||
| info.set( | ||
| buffer.position(), | ||
| buffer.remaining(), | ||
| timestamp, | ||
| flags | ||
| ) | ||
| } | ||
| sink.writeTrack(track, buffer, info) |
There was a problem hiding this comment.
The last buffer might have data in theory, is it possible to send it in a separate call?
if (eos) {
if (buffer.hasRemaining()) {
info.set(buffer.position(), buffer.remaining(), timestamp, flags)
sink.writeTrack(track, buffer, info)
}
info.set(0, 0, 0, flags and MediaCodec.BUFFER_FLAG_END_OF_STREAM)
} else {
info.set(buffer.position(), buffer.remaining(), timestamp, flags)
}
sink.writeTrack(track, buffer, info)
Would this fix your crash?
There was a problem hiding this comment.
@natario1 Thanks for your review.
I tried your codes. But Crashed.
W/DefaultDataSink: Failed to release the muxer.
java.lang.IllegalStateException: Failed to stop the muxer
at android.media.MediaMuxer.nativeStop(Native Method)
at android.media.MediaMuxer.stop(MediaMuxer.java:466)
at android.media.MediaMuxer.release(MediaMuxer.java:706)
at com.otaliastudios.transcoder.sink.DefaultDataSink.release(DefaultDataSink.java:224)
at com.otaliastudios.transcoder.internal.transcode.DefaultTranscodeEngine.cleanup(DefaultTranscodeEngine.kt:141)
at com.otaliastudios.transcoder.internal.transcode.TranscodeEngine$Companion.transcode(TranscodeEngine.kt:63)
at com.otaliastudios.transcoder.internal.transcode.TranscodeEngine.transcode(Unknown Source:2)
at com.otaliastudios.transcoder.Transcoder$1.call(Transcoder.java:102)
at com.otaliastudios.transcoder.Transcoder$1.call(Transcoder.java:99)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
|
Any update on this issue? |
|
Please review and merge the changes, the library doesn't work in a lot of devices |
|
I'm not sure what the correct solution is. I don't have a crashing device, but it would be nice to know the API level and the values of |
|
@natario1 I am getting this error on Android 7.1, But i don't see this issue on android 12/13. Also it doesn't shows up for all vieos. |
|
any updates on this issue? |
|
In the meantime whoever wants this fix use: |
|
@UrielFrankel thanks for providing a fork. Do you think it's possible that you can create a new PR with a fix and get it merged? I did the same a few weeks ago: https://github.com/natario1/Transcoder/pull/182 and then released a new version: https://github.com/natario1/Transcoder/pull/183 This way the complex code that we have here is unified and everyone benefits from the fixes. |
|
@vanniktech this is not my fork, it is @jumperson code from above. |
|
Any update on this? |
d683aab to
f85b30d
Compare
|
Thanks! |
…p the muxer" error, which will cause VideoCompress.compressVideo return null when includeAudio = true. (jonataslaw#300) Ref: 1.deepmedia/Transcoder#159 - Updates `com.otaliastudios:transcoder` to version `0.11.2` in `android/build.gradle`. - Updates `com.android.application` Gradle plugin to version `8.1.0` in `example/android/settings.gradle`. - Updates Gradle distribution to version `8.3` in `example/android/gradle/wrapper/gradle-wrapper.properties`.
I think
info.set(0, 0, 0, flags and MediaCodec.BUFFER_FLAG_END_OF_STREAM)is fine forEOS.Do you think it is correct ?
ref: #139