Class TeeAudioProcessor
- java.lang.Object
-
- com.google.android.exoplayer2.audio.BaseAudioProcessor
-
- com.google.android.exoplayer2.audio.TeeAudioProcessor
-
- All Implemented Interfaces:
AudioProcessor
public final class TeeAudioProcessor extends BaseAudioProcessor
Audio processor that outputs its input unmodified and also outputs its input to a given sink. This is intended to be used for diagnostics and debugging.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 custom
DefaultAudioSink.AudioProcessorChain
when creating the audio sink, and include this audio processor after all other audio processors.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
TeeAudioProcessor.AudioBufferSink
A sink for audio buffers handled by the audio processor.static class
TeeAudioProcessor.WavFileAudioBufferSink
A sink for audio buffers that writes output audio as .wav files with a given path prefix.-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.audio.AudioProcessor
AudioProcessor.AudioFormat, AudioProcessor.UnhandledAudioFormatException
-
-
Field Summary
-
Fields inherited from class com.google.android.exoplayer2.audio.BaseAudioProcessor
inputAudioFormat, outputAudioFormat
-
Fields inherited from interface com.google.android.exoplayer2.audio.AudioProcessor
EMPTY_BUFFER
-
-
Constructor Summary
Constructors Constructor Description TeeAudioProcessor(TeeAudioProcessor.AudioBufferSink audioBufferSink)
Creates a new tee audio processor, sending incoming data to the givenTeeAudioProcessor.AudioBufferSink
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AudioProcessor.AudioFormat
onConfigure(AudioProcessor.AudioFormat inputAudioFormat)
Called when the processor is configured for a new input format.protected void
onFlush()
Called when the processor is flushed, directly or as part of resetting.protected void
onQueueEndOfStream()
Called when the end-of-stream is queued to the processor.protected void
onReset()
Called when the processor is reset.void
queueInput(ByteBuffer inputBuffer)
Queues audio data between the position and limit of theinputBuffer
for processing.-
Methods inherited from class com.google.android.exoplayer2.audio.BaseAudioProcessor
configure, flush, getOutput, hasPendingOutput, isActive, isEnded, queueEndOfStream, replaceOutputBuffer, reset
-
-
-
-
Constructor Detail
-
TeeAudioProcessor
public TeeAudioProcessor(TeeAudioProcessor.AudioBufferSink audioBufferSink)
Creates a new tee audio processor, sending incoming data to the givenTeeAudioProcessor.AudioBufferSink
.- Parameters:
audioBufferSink
- The audio buffer sink that will receive input queued to this audio processor.
-
-
Method Detail
-
onConfigure
public AudioProcessor.AudioFormat onConfigure(AudioProcessor.AudioFormat inputAudioFormat)
Description copied from class:BaseAudioProcessor
Called when the processor is configured for a new input format.- Overrides:
onConfigure
in classBaseAudioProcessor
-
queueInput
public void queueInput(ByteBuffer inputBuffer)
Description copied from interface:AudioProcessor
Queues audio data between the position and limit of theinputBuffer
for processing. After calling this method, processed output may be available viaAudioProcessor.getOutput()
. CallingqueueInput(ByteBuffer)
again invalidates any pending output.- Parameters:
inputBuffer
- The input buffer to process. It must 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.
-
onFlush
protected void onFlush()
Description copied from class:BaseAudioProcessor
Called when the processor is flushed, directly or as part of resetting.- Overrides:
onFlush
in classBaseAudioProcessor
-
onQueueEndOfStream
protected void onQueueEndOfStream()
Description copied from class:BaseAudioProcessor
Called when the end-of-stream is queued to the processor.- Overrides:
onQueueEndOfStream
in classBaseAudioProcessor
-
onReset
protected void onReset()
Description copied from class:BaseAudioProcessor
Called when the processor is reset.- Overrides:
onReset
in classBaseAudioProcessor
-
-