diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/Allocator.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/Allocator.java index 59cc85a6bb..3f06e795c1 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/Allocator.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/Allocator.java @@ -50,13 +50,6 @@ public interface Allocator { */ void release(Allocation allocation); - /** - * Releases an array of {@link Allocation Allocations} back to the allocator. - * - * @param allocations The array of {@link Allocation}s being released. - */ - void release(Allocation[] allocations); - /** * Releases all {@link Allocation Allocations} in the chain starting at the given {@link * AllocationNode}. diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/DefaultAllocator.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/DefaultAllocator.java index 83bbac44fe..af42d8b71d 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/DefaultAllocator.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/upstream/DefaultAllocator.java @@ -33,7 +33,6 @@ public final class DefaultAllocator implements Allocator { private final boolean trimOnReset; private final int individualAllocationSize; @Nullable private final byte[] initialAllocationBlock; - private final Allocation[] singleAllocationReleaseHolder; private int targetBufferSize; private int allocatedCount; @@ -78,7 +77,6 @@ public final class DefaultAllocator implements Allocator { } else { initialAllocationBlock = null; } - singleAllocationReleaseHolder = new Allocation[1]; } public synchronized void reset() { @@ -116,16 +114,8 @@ public final class DefaultAllocator implements Allocator { @Override public synchronized void release(Allocation allocation) { - singleAllocationReleaseHolder[0] = allocation; - release(singleAllocationReleaseHolder); - } - - @Override - public synchronized void release(Allocation[] allocations) { - for (Allocation allocation : allocations) { - availableAllocations[availableCount++] = allocation; - } - allocatedCount -= allocations.length; + availableAllocations[availableCount++] = allocation; + allocatedCount--; // Wake up threads waiting for the allocated size to drop. notifyAll(); }