diff --git a/library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultAllocator.java b/library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultAllocator.java index d9bd5873f0..06ca83dd93 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultAllocator.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultAllocator.java @@ -118,8 +118,18 @@ public final class DefaultAllocator implements Allocator { } for (Allocation allocation : allocations) { // Weak sanity check that the allocation probably originated from this pool. - Assertions.checkArgument(allocation.data == initialAllocationBlock - || allocation.data.length == individualAllocationSize); + if (allocation.data != initialAllocationBlock + && allocation.data.length != individualAllocationSize) { + throw new IllegalArgumentException( + "Unexpected allocation: " + + System.identityHashCode(allocation.data) + + ", " + + System.identityHashCode(initialAllocationBlock) + + ", " + + allocation.data.length + + ", " + + individualAllocationSize); + } availableAllocations[availableCount++] = allocation; } allocatedCount -= allocations.length;