public final class TeeAudioProcessor extends BaseAudioProcessor
This audio processor can be inserted into the audio processor chain to access audio data
before/after particular processing steps have been applied. For example, to get audio output
after playback speed adjustment and silence skipping have been applied it is necessary to pass a
creating the audio sink, and include this audio processor after all other audio processors.
|Modifier and Type||Class and Description|
A sink for audio buffers handled by the audio processor.
A sink for audio buffers that writes output audio as .wav files with a given path prefix.
channelCount, encoding, sampleRateHz
|Constructor and Description|
Creates a new tee audio processor, sending incoming data to the given
|Modifier and Type||Method and Description|
Configures the processor to process input audio with the specified format.
Called when the processor is flushed, directly or as part of resetting.
Queues audio data between the position and limit of the input
flush, getOutput, getOutputChannelCount, getOutputEncoding, getOutputSampleRateHz, hasPendingOutput, isActive, isEnded, onQueueEndOfStream, onReset, queueEndOfStream, replaceOutputBuffer, reset, setInputFormat
public TeeAudioProcessor(TeeAudioProcessor.AudioBufferSink audioBufferSink)
audioBufferSink- The audio buffer sink that will receive input queued to this audio processor.
public boolean configure(int sampleRateHz, int channelCount, @C.PcmEncoding int encoding)
AudioProcessor.isActive()to determine whether the audio processor is active.
If the audio processor is active after configuration, call
AudioProcessor.getOutputEncoding() to get its new output format.
If this method returns
true, it is necessary to
AudioProcessor.flush() the processor
before queueing more data, but you can (optionally) first drain output in the previous
configuration by calling
AudioProcessor.getOutput(). If this method
false, it is safe to queue new input immediately.
sampleRateHz- The sample rate of input audio in Hz.
channelCount- The number of interleaved channels in input audio.
encoding- The encoding of input audio.
flushedbefore queueing more input.
public void queueInput(ByteBuffer inputBuffer)
buffermust be a direct byte buffer with native byte order. Its contents are treated as read-only. Its position will be advanced by the number of bytes consumed (which may be zero). The caller retains ownership of the provided buffer. Calling this method invalidates any previous buffer returned by
inputBuffer- The input buffer to process.