Add thread-safe information & annotations to necessary fields.
This change is a small incremental step towards better thread-safety. PiperOrigin-RevId: 598852158
This commit is contained in:
parent
0513a28169
commit
e41b23d2f4
@ -91,7 +91,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
private boolean decodeVideo;
|
private boolean decodeVideo;
|
||||||
private int sequenceLoopCount;
|
private int sequenceLoopCount;
|
||||||
private int processedInputsSize;
|
private int processedInputsSize;
|
||||||
private boolean released;
|
|
||||||
|
// Accessed when switching asset loader.
|
||||||
|
private volatile boolean released;
|
||||||
|
|
||||||
private volatile long currentAssetDurationUs;
|
private volatile long currentAssetDurationUs;
|
||||||
private volatile long maxSequenceDurationUs;
|
private volatile long maxSequenceDurationUs;
|
||||||
|
@ -128,16 +128,34 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
private final AssetLoaderInputTracker assetLoaderInputTracker;
|
private final AssetLoaderInputTracker assetLoaderInputTracker;
|
||||||
|
|
||||||
private final List<SampleExporter> sampleExporters;
|
private final List<SampleExporter> sampleExporters;
|
||||||
private final Object setMaxSequenceDurationUsLock;
|
|
||||||
private final MuxerWrapper muxerWrapper;
|
private final MuxerWrapper muxerWrapper;
|
||||||
private final ConditionVariable transformerConditionVariable;
|
private final ConditionVariable transformerConditionVariable;
|
||||||
|
private final Object setMaxSequenceDurationUsLock;
|
||||||
|
|
||||||
private boolean isDrainingExporters;
|
private boolean isDrainingExporters;
|
||||||
|
|
||||||
|
@GuardedBy("setMaxSequenceDurationUsLock")
|
||||||
private long currentMaxSequenceDurationUs;
|
private long currentMaxSequenceDurationUs;
|
||||||
|
|
||||||
|
@GuardedBy("setMaxSequenceDurationUsLock")
|
||||||
private int nonLoopingSequencesWithNonFinalDuration;
|
private int nonLoopingSequencesWithNonFinalDuration;
|
||||||
private @Transformer.ProgressState int progressState;
|
|
||||||
private @MonotonicNonNull RuntimeException cancelException;
|
private @MonotonicNonNull RuntimeException cancelException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current {@link Transformer.ProgressState}.
|
||||||
|
*
|
||||||
|
* <p>Modified on the internal thread. Accessed on the application thread (in {@link
|
||||||
|
* #getProgress}).
|
||||||
|
*/
|
||||||
|
private volatile @Transformer.ProgressState int progressState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The boolean tracking if this component has been released.
|
||||||
|
*
|
||||||
|
* <p>Modified on the internal thread. Accessed on the application thread (in {@link #getProgress}
|
||||||
|
* and {@link #cancel()}).
|
||||||
|
*/
|
||||||
private volatile boolean released;
|
private volatile boolean released;
|
||||||
|
|
||||||
public TransformerInternal(
|
public TransformerInternal(
|
||||||
@ -196,8 +214,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
}
|
}
|
||||||
compositionHasLoopingSequence =
|
compositionHasLoopingSequence =
|
||||||
nonLoopingSequencesWithNonFinalDuration != composition.sequences.size();
|
nonLoopingSequencesWithNonFinalDuration != composition.sequences.size();
|
||||||
sampleExporters = new ArrayList<>();
|
|
||||||
setMaxSequenceDurationUsLock = new Object();
|
setMaxSequenceDurationUsLock = new Object();
|
||||||
|
sampleExporters = new ArrayList<>();
|
||||||
transformerConditionVariable = new ConditionVariable();
|
transformerConditionVariable = new ConditionVariable();
|
||||||
// It's safe to use "this" because we don't send a message before exiting the constructor.
|
// It's safe to use "this" because we don't send a message before exiting the constructor.
|
||||||
@SuppressWarnings("nullness:methodref.receiver.bound")
|
@SuppressWarnings("nullness:methodref.receiver.bound")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user