docs/doc/reference/com/google/android/exoplayer2/upstream/DefaultAllocator.html
Package com.google.android.exoplayer2.upstream
All Implemented Interfaces:Allocator
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classDefaultAllocatorextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[Allocator](Allocator.html "interface in com.google.android.exoplayer2.upstream")
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 of Allocator.
-
Allocator.AllocationNode
Constructors | Constructor | Description |
| --- | --- |
| DefaultAllocator(boolean trimOnReset, int individualAllocationSize) |
Deprecated.
Constructs an instance without creating any Allocations up front.
|
| DefaultAllocator(boolean trimOnReset, int individualAllocationSize, int initialAllocationCount) |
Deprecated.
Constructs an instance with some Allocations created up front.
|
All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| Allocation | allocate() |
Deprecated.
Obtain an Allocation.
|
| int | getIndividualAllocationLength() |
Deprecated.
Returns the length of each individual Allocation.
|
| int | getTotalBytesAllocated() |
Deprecated.
Returns the total number of bytes currently allocated.
|
| void | release(Allocation allocation) |
Deprecated.
Releases an Allocation back to the allocator.
|
| void | release(Allocator.AllocationNode allocationNode) |
Deprecated.
Releases all Allocations in the chain starting at the given Allocator.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 excess Allocations.
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public DefaultAllocator(boolean trimOnReset,
int individualAllocationSize)
Deprecated.
Constructs an instance without creating any Allocations 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 individual Allocation.
-
public DefaultAllocator(boolean trimOnReset,
int individualAllocationSize,
int initialAllocationCount)
Deprecated.
Constructs an instance with some Allocations created up front.
Note: Allocations created up front will never be discarded by trim().
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 individual Allocation.initialAllocationCount - The number of allocations to create up front.
-
public void reset()
Deprecated.
-
public void setTargetBufferSize(int targetBufferSize)
Deprecated.
-
public[Allocation](Allocation.html "class in com.google.android.exoplayer2.upstream")allocate()
Deprecated.
Description copied from interface: Allocator
Obtain an Allocation.
When the caller has finished with the Allocation, it should be returned by calling Allocator.release(Allocation).
Specified by:allocate in interface AllocatorReturns:The Allocation.
-
public void release([Allocation](Allocation.html "class in com.google.android.exoplayer2.upstream")allocation)
Deprecated.
Description copied from interface: Allocator
Releases an Allocation back to the allocator.
Specified by:release in interface AllocatorParameters:allocation - The Allocation being released.
-
public void release(@Nullable[Allocator.AllocationNode](Allocator.AllocationNode.html "interface in com.google.android.exoplayer2.upstream")allocationNode)
Deprecated.
Description copied from interface: Allocator
Releases all Allocations in the chain starting at the given Allocator.AllocationNode.
Implementations must not make memory allocations.
Specified by:release in interface Allocator
-
public void trim()
Deprecated.
Description copied from interface: Allocator
Hints to the allocator that it should make a best effort to release any excess Allocations.
Specified by:trim in interface Allocator
-
public int getTotalBytesAllocated()
Deprecated.
Description copied from interface: Allocator
Returns the total number of bytes currently allocated.
Specified by:getTotalBytesAllocated in interface Allocator
-
public int getIndividualAllocationLength()
Deprecated.
Description copied from interface: Allocator
Returns the length of each individual Allocation.
Specified by:getIndividualAllocationLength in interface Allocator