-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Failed to stop the muxer (ref #139) #159
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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! |
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