Back to Exoplayer

DefaultAllocator (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/upstream/DefaultAllocator.html

latest7.9 KB
Original Source

Package com.google.android.exoplayer2.upstream

Class DefaultAllocator

  • java.lang.Object

    • com.google.android.exoplayer2.upstream.DefaultAllocator
  • 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.

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 any Allocations up front. | | DefaultAllocator​(boolean trimOnReset, int individualAllocationSize, int initialAllocationCount) | Deprecated.

Constructs an instance with some Allocations created up front. |

Method Summary

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. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

- 

DefaultAllocator

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.

- 

DefaultAllocator

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.

Method Detail

- 

reset

public void reset()

Deprecated.

- 

setTargetBufferSize

public void setTargetBufferSize​(int targetBufferSize)

Deprecated.

- 

allocate

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.

- 

release

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.

- 

release

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

- 

trim

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

- 

getTotalBytesAllocated

public int getTotalBytesAllocated()

Deprecated.

Description copied from interface: Allocator

Returns the total number of bytes currently allocated. Specified by:getTotalBytesAllocated in interface Allocator

- 

getIndividualAllocationLength

public int getIndividualAllocationLength()

Deprecated.

Description copied from interface: Allocator

Returns the length of each individual Allocation. Specified by:getIndividualAllocationLength in interface Allocator