Class DefaultAllocator
- java.lang.Object
-
- com.google.android.exoplayer2.upstream.DefaultAllocator
-
- All Implemented Interfaces:
Allocator
@Deprecated public final class DefaultAllocator extends Object implements Allocator
Deprecated.com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.Default implementation ofAllocator.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.upstream.Allocator
Allocator.AllocationNode
-
-
Constructor Summary
Constructors Constructor Description DefaultAllocator(boolean trimOnReset, int individualAllocationSize)Deprecated.Constructs an instance without creating anyAllocations up front.DefaultAllocator(boolean trimOnReset, int individualAllocationSize, int initialAllocationCount)Deprecated.Constructs an instance with someAllocations created up front.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Allocationallocate()Deprecated.Obtain anAllocation.intgetIndividualAllocationLength()Deprecated.Returns the length of each individualAllocation.intgetTotalBytesAllocated()Deprecated.Returns the total number of bytes currently allocated.voidrelease(Allocation allocation)Deprecated.Releases anAllocationback to the allocator.voidrelease(Allocator.AllocationNode allocationNode)Deprecated.Releases allAllocationsin the chain starting at the givenAllocator.AllocationNode.voidreset()Deprecated.voidsetTargetBufferSize(int targetBufferSize)Deprecated.voidtrim()Deprecated.Hints to the allocator that it should make a best effort to release any excessAllocations.
-
-
-
Constructor Detail
-
DefaultAllocator
public DefaultAllocator(boolean trimOnReset, int individualAllocationSize)Deprecated.Constructs an instance without creating anyAllocations up front.- Parameters:
trimOnReset- Whether memory is freed when the allocator is reset. Should be true unless the allocator will be re-used by multiple player instances.individualAllocationSize- The length of each individualAllocation.
-
DefaultAllocator
public DefaultAllocator(boolean trimOnReset, int individualAllocationSize, int initialAllocationCount)Deprecated.Constructs an instance with someAllocations created up front.Note:
Allocations created up front will never be discarded bytrim().- Parameters:
trimOnReset- Whether memory is freed when the allocator is reset. Should be true unless the allocator will be re-used by multiple player instances.individualAllocationSize- The length of each individualAllocation.initialAllocationCount- The number of allocations to create up front.
-
-
Method Detail
-
reset
public void reset()
Deprecated.
-
setTargetBufferSize
public void setTargetBufferSize(int targetBufferSize)
Deprecated.
-
allocate
public Allocation allocate()
Deprecated.Description copied from interface:AllocatorObtain anAllocation.When the caller has finished with the
Allocation, it should be returned by callingAllocator.release(Allocation).- Specified by:
allocatein interfaceAllocator- Returns:
- The
Allocation.
-
release
public void release(Allocation allocation)
Deprecated.Description copied from interface:AllocatorReleases anAllocationback to the allocator.- Specified by:
releasein interfaceAllocator- Parameters:
allocation- TheAllocationbeing released.
-
release
public void release(@Nullable Allocator.AllocationNode allocationNode)Deprecated.Description copied from interface:AllocatorReleases allAllocationsin the chain starting at the givenAllocator.AllocationNode.Implementations must not make memory allocations.
-
trim
public void trim()
Deprecated.Description copied from interface:AllocatorHints to the allocator that it should make a best effort to release any excessAllocations.
-
getTotalBytesAllocated
public int getTotalBytesAllocated()
Deprecated.Description copied from interface:AllocatorReturns the total number of bytes currently allocated.- Specified by:
getTotalBytesAllocatedin interfaceAllocator
-
getIndividualAllocationLength
public int getIndividualAllocationLength()
Deprecated.Description copied from interface:AllocatorReturns the length of each individualAllocation.- Specified by:
getIndividualAllocationLengthin interfaceAllocator
-
-