mirror of
https://github.com/samsonjs/media.git
synced 2026-03-25 09:25:53 +00:00
Remove unnecessary FileChannel from Mp4Muxer
As per the documentation, closing a `FileOutputStream` automatically closes the associated `FileChannel`. PiperOrigin-RevId: 646152280
This commit is contained in:
parent
327f728010
commit
babc9c69c6
1 changed files with 1 additions and 13 deletions
|
|
@ -39,7 +39,6 @@ import java.lang.annotation.Retention;
|
|||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
|
||||
/**
|
||||
* A muxer for creating an MP4 container file.
|
||||
|
|
@ -181,7 +180,6 @@ public final class Mp4Muxer implements Muxer {
|
|||
private static final String TAG = "Mp4Muxer";
|
||||
|
||||
private final FileOutputStream fileOutputStream;
|
||||
private final FileChannel fileChannel;
|
||||
private final MetadataCollector metadataCollector;
|
||||
private final Mp4Writer mp4Writer;
|
||||
|
||||
|
|
@ -192,13 +190,12 @@ public final class Mp4Muxer implements Muxer {
|
|||
boolean sampleCopyEnabled,
|
||||
boolean attemptStreamableOutputEnabled) {
|
||||
this.fileOutputStream = fileOutputStream;
|
||||
this.fileChannel = fileOutputStream.getChannel();
|
||||
metadataCollector = new MetadataCollector();
|
||||
Mp4MoovStructure moovStructure =
|
||||
new Mp4MoovStructure(metadataCollector, lastFrameDurationBehavior);
|
||||
mp4Writer =
|
||||
new Mp4Writer(
|
||||
fileChannel,
|
||||
fileOutputStream.getChannel(),
|
||||
moovStructure,
|
||||
annexBToAvccConverter,
|
||||
sampleCopyEnabled,
|
||||
|
|
@ -302,15 +299,6 @@ public final class Mp4Muxer implements Muxer {
|
|||
} catch (IOException e) {
|
||||
exception = new MuxerException("Failed to finish writing samples", e);
|
||||
}
|
||||
try {
|
||||
fileChannel.close();
|
||||
} catch (IOException e) {
|
||||
if (exception == null) {
|
||||
exception = new MuxerException("Failed to close output channel", e);
|
||||
} else {
|
||||
Log.e(TAG, "Failed to close output channel", e);
|
||||
}
|
||||
}
|
||||
try {
|
||||
fileOutputStream.close();
|
||||
} catch (IOException e) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue