close
Flushes every encoder, writes the trailer, and frees the muxer.
The flush matters: encoders buffer (x264's lookahead holds tens of frames), so closing without draining them would silently truncate the end of the output. The flush is best-effort (if an encoder fails here, a trailer is still written for the data already muxed). It does nothing for encoders already drained by VideoEncoder.drive or AudioEncoder.drive.
A close waits for an encode or a copy-stream write that already started on another thread, and a second close waits for the first to finish. Once a close starts, a new encode or copy write fails with IllegalStateException. A close from inside this sink's own MediaByteSink call fails with IllegalStateException too, which fails that write.
Throws
when the trailer fails. The file on disk is then broken, for example an mp4 whose moov atom was never written.
Flushes every encoder, writes the trailer, and frees the muxer.
The flush matters: encoders buffer (x264's lookahead holds tens of frames), so closing without draining them would silently truncate the end of the output. The flush is best-effort (if an encoder fails here, a trailer is still written for the data already muxed). It does nothing for encoders already drained by VideoEncoder.drive or AudioEncoder.drive.
A close waits for an encode or a copy-stream write that already started on another thread, and a second close waits for the first to finish. Once a close starts, a new encode or copy write fails with IllegalStateException. A close from inside this sink's own MediaByteSink call fails with IllegalStateException too, which fails that write.
Throws
when the trailer fails. The file on disk is then broken, for example an mp4 whose moov atom was never written.
Flushes every encoder, writes the trailer, and frees the muxer.
The flush matters: encoders buffer (x264's lookahead holds tens of frames), so closing without draining them would silently truncate the end of the output. The flush is best-effort (if an encoder fails here, a trailer is still written for the data already muxed). It does nothing for encoders already drained by VideoEncoder.drive or AudioEncoder.drive.
A close waits for an encode or a copy-stream write that already started on another thread, and a second close waits for the first to finish. Once a close starts, a new encode or copy write fails with IllegalStateException. A close from inside this sink's own MediaByteSink call fails with IllegalStateException too, which fails that write.
Throws
when the trailer fails. The file on disk is then broken, for example an mp4 whose moov atom was never written.
Flushes every encoder, writes the trailer, and frees the muxer.
The flush matters: encoders buffer (x264's lookahead holds tens of frames), so closing without draining them would silently truncate the end of the output. The flush is best-effort (if an encoder fails here, a trailer is still written for the data already muxed). It does nothing for encoders already drained by VideoEncoder.drive or AudioEncoder.drive.
A close waits for an encode or a copy-stream write that already started on another thread, and a second close waits for the first to finish. Once a close starts, a new encode or copy write fails with IllegalStateException. A close from inside this sink's own MediaByteSink call fails with IllegalStateException too, which fails that write.
Throws
when the trailer fails. The file on disk is then broken, for example an mp4 whose moov atom was never written.