public interface LoadControl
Modifier and Type | Method and Description |
---|---|
Allocator |
getAllocator()
Gets the
Allocator that loaders should use to obtain memory allocations into which
data can be loaded. |
void |
register(Object loader,
int bufferSizeContribution)
Registers a loader.
|
void |
trimAllocator()
Hints to the control that it should consider trimming any unused memory being held in order
to satisfy allocation requests.
|
void |
unregister(Object loader)
Unregisters a loader.
|
boolean |
update(Object loader,
long playbackPositionUs,
long nextLoadPositionUs,
boolean loading)
Invoked by a loader to update the control with its current state.
|
void register(Object loader, int bufferSizeContribution)
loader
- The loader being registered.bufferSizeContribution
- For instances whose Allocator
maintains a pool of memory
for the purpose of satisfying allocation requests, this is a hint indicating the loader's
desired contribution to the size of the pool, in bytes.void unregister(Object loader)
loader
- The loader being unregistered.Allocator getAllocator()
Allocator
that loaders should use to obtain memory allocations into which
data can be loaded.Allocator
to use.void trimAllocator()
This method is typically invoked by a recently unregistered loader, once it has released all
of its allocations back to the Allocator
.
boolean update(Object loader, long playbackPositionUs, long nextLoadPositionUs, boolean loading)
This method must be called by a registered loader whenever its state changes. This is true even if the registered loader does not itself wish to start its next load (since the state of the loader will still affect whether other registered loaders are allowed to proceed).
loader
- The loader invoking the update.playbackPositionUs
- The loader's playback position.nextLoadPositionUs
- The loader's next load position. -1 if finished, failed, or if the
next load position is not yet known.loading
- Whether the loader is currently loading data.