Change AudioGraph #release to #reset, resetting internal state.
PiperOrigin-RevId: 589113634
This commit is contained in:
parent
c5c8e988e8
commit
1471528176
@ -124,13 +124,17 @@ import java.util.Objects;
|
|||||||
return currentOutput;
|
return currentOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Releases underlying resources, including clearing the inputs. */
|
/** Resets the graph to an unconfigured state, releasing any underlying resources. */
|
||||||
public void release() {
|
public void reset() {
|
||||||
for (int i = 0; i < inputs.size(); i++) {
|
for (int i = 0; i < inputs.size(); i++) {
|
||||||
inputs.valueAt(i).release();
|
inputs.valueAt(i).release();
|
||||||
}
|
}
|
||||||
inputs.clear();
|
inputs.clear();
|
||||||
mixer.reset();
|
mixer.reset();
|
||||||
|
|
||||||
|
finishedInputs = 0;
|
||||||
|
currentOutput = EMPTY_BUFFER;
|
||||||
|
outputAudioFormat = AudioFormat.NOT_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns whether the input has ended and all queued data has been output. */
|
/** Returns whether the input has ended and all queued data has been output. */
|
||||||
|
@ -151,7 +151,9 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Releases any underlying resources. */
|
||||||
public void release() {
|
public void release() {
|
||||||
|
// TODO(b/303029174): Impl flush(), reset() & decide if a separate release() is still needed.
|
||||||
audioProcessingPipeline.reset();
|
audioProcessingPipeline.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ import org.checkerframework.dataflow.qual.Pure;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void release() {
|
public void release() {
|
||||||
audioGraph.release();
|
audioGraph.reset();
|
||||||
encoder.release();
|
encoder.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user