Skip to content
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 #3

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ internal class Writer(
override fun step(state: State.Ok<WriterData>, fresh: Boolean): State<Unit> {
val (buffer, timestamp, flags) = state.value
val eos = state is State.Eos
info.set(
buffer.position(),
buffer.remaining(),
timestamp,
if (eos) {
flags and MediaCodec.BUFFER_FLAG_END_OF_STREAM
} else flags
)
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)
state.value.release()
return if (eos) State.Eos(Unit) else State.Ok(Unit)
Expand Down