From 63a8fff69e176518c51cadc38c2c9fa35386f38c Mon Sep 17 00:00:00 2001 From: sheenachhabra Date: Mon, 26 Feb 2024 08:22:10 -0800 Subject: [PATCH] Use ByteBuffer.remaining() instead of ByteBuffer.limit() in BoxUtil PiperOrigin-RevId: 610414628 --- .../muxer/src/main/java/androidx/media3/muxer/BoxUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/muxer/src/main/java/androidx/media3/muxer/BoxUtils.java b/libraries/muxer/src/main/java/androidx/media3/muxer/BoxUtils.java index b906357fbd..c51bd93dd5 100644 --- a/libraries/muxer/src/main/java/androidx/media3/muxer/BoxUtils.java +++ b/libraries/muxer/src/main/java/androidx/media3/muxer/BoxUtils.java @@ -51,7 +51,7 @@ import java.util.List; public static ByteBuffer wrapBoxesIntoBox(String boxType, List boxes) { int totalSize = BOX_TYPE_BYTES + BOX_SIZE_BYTES; for (int i = 0; i < boxes.size(); i++) { - totalSize += boxes.get(i).limit(); + totalSize += boxes.get(i).remaining(); } ByteBuffer result = ByteBuffer.allocate(totalSize); @@ -72,7 +72,7 @@ import java.util.List; public static ByteBuffer concatenateBuffers(ByteBuffer... buffers) { int totalSize = 0; for (ByteBuffer buffer : buffers) { - totalSize += buffer.limit(); + totalSize += buffer.remaining(); } ByteBuffer result = ByteBuffer.allocate(totalSize);