diff --git a/libraries/muxer/src/main/java/androidx/media3/muxer/Mp4Muxer.java b/libraries/muxer/src/main/java/androidx/media3/muxer/Mp4Muxer.java index a3fe966ce7..cedcf15108 100644 --- a/libraries/muxer/src/main/java/androidx/media3/muxer/Mp4Muxer.java +++ b/libraries/muxer/src/main/java/androidx/media3/muxer/Mp4Muxer.java @@ -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) {