mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Use ByteBuffer.remaining() instead of ByteBuffer.limit() in BoxUtil
PiperOrigin-RevId: 610414628
This commit is contained in:
parent
e98858424a
commit
63a8fff69e
@ -51,7 +51,7 @@ import java.util.List;
|
|||||||
public static ByteBuffer wrapBoxesIntoBox(String boxType, List<ByteBuffer> boxes) {
|
public static ByteBuffer wrapBoxesIntoBox(String boxType, List<ByteBuffer> boxes) {
|
||||||
int totalSize = BOX_TYPE_BYTES + BOX_SIZE_BYTES;
|
int totalSize = BOX_TYPE_BYTES + BOX_SIZE_BYTES;
|
||||||
for (int i = 0; i < boxes.size(); i++) {
|
for (int i = 0; i < boxes.size(); i++) {
|
||||||
totalSize += boxes.get(i).limit();
|
totalSize += boxes.get(i).remaining();
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteBuffer result = ByteBuffer.allocate(totalSize);
|
ByteBuffer result = ByteBuffer.allocate(totalSize);
|
||||||
@ -72,7 +72,7 @@ import java.util.List;
|
|||||||
public static ByteBuffer concatenateBuffers(ByteBuffer... buffers) {
|
public static ByteBuffer concatenateBuffers(ByteBuffer... buffers) {
|
||||||
int totalSize = 0;
|
int totalSize = 0;
|
||||||
for (ByteBuffer buffer : buffers) {
|
for (ByteBuffer buffer : buffers) {
|
||||||
totalSize += buffer.limit();
|
totalSize += buffer.remaining();
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteBuffer result = ByteBuffer.allocate(totalSize);
|
ByteBuffer result = ByteBuffer.allocate(totalSize);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user