Commit ed1eade9 by andrewlewis Committed by Oliver Woodman

Update stale comment in TrimmingAudioProcessor

The part about leaving the pending trim start byte count unmodified
if the processor was just configured is not correct.

PiperOrigin-RevId: 295745371
parent 23e42362
...@@ -155,15 +155,16 @@ import java.nio.ByteBuffer; ...@@ -155,15 +155,16 @@ import java.nio.ByteBuffer;
@Override @Override
protected void onFlush() { protected void onFlush() {
if (reconfigurationPending) { if (reconfigurationPending) {
// This is the initial flush after reconfiguration. Prepare to trim bytes from the start/end.
reconfigurationPending = false; reconfigurationPending = false;
endBuffer = new byte[trimEndFrames * inputAudioFormat.bytesPerFrame]; endBuffer = new byte[trimEndFrames * inputAudioFormat.bytesPerFrame];
pendingTrimStartBytes = trimStartFrames * inputAudioFormat.bytesPerFrame; pendingTrimStartBytes = trimStartFrames * inputAudioFormat.bytesPerFrame;
} else { } else {
// Audio processors are flushed after initial configuration, so we leave the pending trim // This is a flush during playback (after the initial flush). We assume this was caused by a
// start byte count unmodified if the processor was just configured. Otherwise we (possibly // seek to a non-zero position and clear pending start bytes. This assumption may be wrong (we
// incorrectly) assume that this is a seek to a non-zero position. We should instead check the // may be seeking to zero), but playing data that should have been trimmed shouldn't be
// timestamp of the first input buffer queued after flushing to decide whether to trim (see // noticeable after a seek. Ideally we would check the timestamp of the first input buffer
// also [Internal: b/77292509]). // queued after flushing to decide whether to trim (see also [Internal: b/77292509]).
pendingTrimStartBytes = 0; pendingTrimStartBytes = 0;
} }
endBufferSize = 0; endBufferSize = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment