mirror of
https://github.com/androidx/media.git
synced 2025-05-08 08:00:49 +08:00
Remove last SampleQueue.release allocation
By making AllocationNode fields non-final PiperOrigin-RevId: 422403816
This commit is contained in:
parent
ace1988a35
commit
f9170b89c4
@ -66,7 +66,7 @@ import java.util.Arrays;
|
|||||||
/** Clears all sample data. */
|
/** Clears all sample data. */
|
||||||
public void reset() {
|
public void reset() {
|
||||||
clearAllocationNodes(firstAllocationNode);
|
clearAllocationNodes(firstAllocationNode);
|
||||||
firstAllocationNode = new AllocationNode(0, allocationLength);
|
firstAllocationNode.reset(/* startPosition= */ 0, allocationLength);
|
||||||
readAllocationNode = firstAllocationNode;
|
readAllocationNode = firstAllocationNode;
|
||||||
writeAllocationNode = firstAllocationNode;
|
writeAllocationNode = firstAllocationNode;
|
||||||
totalBytesWritten = 0;
|
totalBytesWritten = 0;
|
||||||
@ -462,9 +462,9 @@ import java.util.Arrays;
|
|||||||
private static final class AllocationNode implements Allocator.AllocationNode {
|
private static final class AllocationNode implements Allocator.AllocationNode {
|
||||||
|
|
||||||
/** The absolute position of the start of the data (inclusive). */
|
/** The absolute position of the start of the data (inclusive). */
|
||||||
public final long startPosition;
|
public long startPosition;
|
||||||
/** The absolute position of the end of the data (exclusive). */
|
/** The absolute position of the end of the data (exclusive). */
|
||||||
public final long endPosition;
|
public long endPosition;
|
||||||
/**
|
/**
|
||||||
* The {@link Allocation}, or {@code null} if the node is not {@link #initialize initialized}.
|
* The {@link Allocation}, or {@code null} if the node is not {@link #initialize initialized}.
|
||||||
*/
|
*/
|
||||||
@ -481,6 +481,17 @@ import java.util.Arrays;
|
|||||||
* initialized.
|
* initialized.
|
||||||
*/
|
*/
|
||||||
public AllocationNode(long startPosition, int allocationLength) {
|
public AllocationNode(long startPosition, int allocationLength) {
|
||||||
|
reset(startPosition, allocationLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the {@link #startPosition} and the {@link Allocation} length.
|
||||||
|
*
|
||||||
|
* <p>Must only be called for uninitialized instances, where {@link #allocation} is {@code
|
||||||
|
* null}.
|
||||||
|
*/
|
||||||
|
public void reset(long startPosition, int allocationLength) {
|
||||||
|
Assertions.checkState(allocation == null);
|
||||||
this.startPosition = startPosition;
|
this.startPosition = startPosition;
|
||||||
this.endPosition = startPosition + allocationLength;
|
this.endPosition = startPosition + allocationLength;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user