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 anyAllocation
s up front.DefaultAllocator(boolean trimOnReset, int individualAllocationSize, int initialAllocationCount)
Deprecated.Constructs an instance with someAllocation
s created up front.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Allocation
allocate()
Deprecated.Obtain anAllocation
.int
getIndividualAllocationLength()
Deprecated.Returns the length of each individualAllocation
.int
getTotalBytesAllocated()
Deprecated.Returns the total number of bytes currently allocated.void
release(Allocation allocation)
Deprecated.Releases anAllocation
back to the allocator.void
release(Allocator.AllocationNode allocationNode)
Deprecated.Releases allAllocations
in the chain starting at the givenAllocator.AllocationNode
.void
reset()
Deprecated.void
setTargetBufferSize(int targetBufferSize)
Deprecated.void
trim()
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 anyAllocation
s 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 someAllocation
s created up front.Note:
Allocation
s 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:Allocator
Obtain anAllocation
.When the caller has finished with the
Allocation
, it should be returned by callingAllocator.release(Allocation)
.- Specified by:
allocate
in interfaceAllocator
- Returns:
- The
Allocation
.
-
release
public void release(Allocation allocation)
Deprecated.Description copied from interface:Allocator
Releases anAllocation
back to the allocator.- Specified by:
release
in interfaceAllocator
- Parameters:
allocation
- TheAllocation
being released.
-
release
public void release(@Nullable Allocator.AllocationNode allocationNode)
Deprecated.Description copied from interface:Allocator
Releases allAllocations
in the chain starting at the givenAllocator.AllocationNode
.Implementations must not make memory allocations.
-
trim
public void trim()
Deprecated.Description copied from interface:Allocator
Hints to the allocator that it should make a best effort to release any excessAllocations
.
-
getTotalBytesAllocated
public int getTotalBytesAllocated()
Deprecated.Description copied from interface:Allocator
Returns the total number of bytes currently allocated.- Specified by:
getTotalBytesAllocated
in interfaceAllocator
-
getIndividualAllocationLength
public int getIndividualAllocationLength()
Deprecated.Description copied from interface:Allocator
Returns the length of each individualAllocation
.- Specified by:
getIndividualAllocationLength
in interfaceAllocator
-
-