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.AudioProcessorChainwhen 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 interfaceTeeAudioProcessor.AudioBufferSinkA sink for audio buffers handled by the audio processor.static classTeeAudioProcessor.WavFileAudioBufferSinkA 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.AudioFormatonConfigure(AudioProcessor.AudioFormat inputAudioFormat)Called when the processor is configured for a new input format.protected voidonFlush()Called when the processor is flushed, directly or as part of resetting.protected voidonQueueEndOfStream()Called when the end-of-stream is queued to the processor.protected voidonReset()Called when the processor is reset.voidqueueInput(ByteBuffer inputBuffer)Queues audio data between the position and limit of the inputbufferfor 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:BaseAudioProcessorCalled when the processor is configured for a new input format.- Overrides:
onConfigurein classBaseAudioProcessor
-
queueInput
public void queueInput(ByteBuffer inputBuffer)
Description copied from interface:AudioProcessorQueues audio data between the position and limit of the inputbufferfor processing.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 byAudioProcessor.getOutput().- Parameters:
inputBuffer- The input buffer to process.
-
onFlush
protected void onFlush()
Description copied from class:BaseAudioProcessorCalled when the processor is flushed, directly or as part of resetting.- Overrides:
onFlushin classBaseAudioProcessor
-
onQueueEndOfStream
protected void onQueueEndOfStream()
Description copied from class:BaseAudioProcessorCalled when the end-of-stream is queued to the processor.- Overrides:
onQueueEndOfStreamin classBaseAudioProcessor
-
onReset
protected void onReset()
Description copied from class:BaseAudioProcessorCalled when the processor is reset.- Overrides:
onResetin classBaseAudioProcessor
-
-