docs/doc/reference/com/google/android/exoplayer2/testutil/CapturingAudioSink.html
Package com.google.android.exoplayer2.testutil
All Implemented Interfaces:AudioSink, Dumper.Dumpable
public final classCapturingAudioSinkextends[ForwardingAudioSink](../audio/ForwardingAudioSink.html "class in com.google.android.exoplayer2.audio")implements[Dumper.Dumpable](Dumper.Dumpable.html "interface in com.google.android.exoplayer2.testutil")
A ForwardingAudioSink that captures configuration, discontinuity and buffer events.
-
AudioSink.ConfigurationException, AudioSink.InitializationException, AudioSink.Listener, AudioSink.SinkFormatSupport, AudioSink.UnexpectedDiscontinuityException, AudioSink.WriteException
-
CURRENT_POSITION_NOT_SET, SINK_FORMAT_SUPPORTED_DIRECTLY, SINK_FORMAT_SUPPORTED_WITH_TRANSCODING, SINK_FORMAT_UNSUPPORTED
Constructors | Constructor | Description |
| --- | --- |
| CapturingAudioSink(AudioSink sink) | |
All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| void | configure(Format inputFormat, int specifiedBufferSize, int[] outputChannels) |
Configures (or reconfigures) the sink.
|
| void | dump(Dumper dumper) |
Dumps the fields of the object using the dumper.
|
| void | flush() |
Flushes the sink, after which it is ready to receive buffers from a new playback position.
|
| boolean | handleBuffer(ByteBuffer buffer, long presentationTimeUs, int encodedAccessUnitCount) |
Attempts to process data from a ByteBuffer, starting from its current position and ending at its limit (exclusive).
|
| void | handleDiscontinuity() |
Signals to the sink that the next buffer may be discontinuous with the previous buffer.
|
| void | reset() |
Resets the sink, releasing any resources that it currently holds.
|
-
disableTunneling, enableTunnelingV21, experimentalFlushWithoutAudioTrackRelease, getAudioAttributes, getCurrentPositionUs, getFormatSupport, getPlaybackParameters, getSkipSilenceEnabled, hasPendingData, isEnded, pause, play, playToEndOfStream, setAudioAttributes, setAudioSessionId, setAuxEffectInfo, setListener, setOutputStreamOffsetUs, setPlaybackParameters, setPlayerId, setPreferredDevice, setSkipSilenceEnabled, setVolume, supportsFormat
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
release
-
public CapturingAudioSink([AudioSink](../audio/AudioSink.html "interface in com.google.android.exoplayer2.audio")sink)
-
public void configure([Format](../Format.html "class in com.google.android.exoplayer2")inputFormat,
int specifiedBufferSize,
@Nullable
int[] outputChannels)
throws[AudioSink.ConfigurationException](../audio/AudioSink.ConfigurationException.html "class in com.google.android.exoplayer2.audio")
Description copied from interface: AudioSink
Configures (or reconfigures) the sink.
Specified by:configure in interface AudioSinkOverrides:configure in class ForwardingAudioSinkParameters:inputFormat - The format of audio data provided in the input buffers.specifiedBufferSize - A specific size for the playback buffer in bytes, or 0 to infer a suitable buffer size.outputChannels - A mapping from input to output channels that is applied to this sink's input as a preprocessing step, if handling PCM input. Specify null to leave the input unchanged. Otherwise, the element at index i specifies index of the input channel to map to output channel i when preprocessing input buffers. After the map is applied the audio data will have outputChannels.length channels.Throws:AudioSink.ConfigurationException - If an error occurs configuring the sink.
-
public void handleDiscontinuity()
Description copied from interface: AudioSink
Signals to the sink that the next buffer may be discontinuous with the previous buffer.
Specified by:handleDiscontinuity in interface AudioSinkOverrides:handleDiscontinuity in class ForwardingAudioSink
-
public boolean handleBuffer([ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html "class or interface in java.nio")buffer,
long presentationTimeUs,
int encodedAccessUnitCount)
throws[AudioSink.InitializationException](../audio/AudioSink.InitializationException.html "class in com.google.android.exoplayer2.audio"),[AudioSink.WriteException](../audio/AudioSink.WriteException.html "class in com.google.android.exoplayer2.audio")
Description copied from interface: AudioSink
Attempts to process data from a ByteBuffer, starting from its current position and ending at its limit (exclusive). The position of the ByteBuffer is advanced by the number of bytes that were handled. AudioSink.Listener.onPositionDiscontinuity() will be called if presentationTimeUs is discontinuous with the last buffer handled since the last reset.
Returns whether the data was handled in full. If the data was not handled in full then the same ByteBuffer must be provided to subsequent calls until it has been fully consumed, except in the case of an intervening call to AudioSink.flush() (or to AudioSink.configure(Format, int, int[]) that causes the sink to be flushed).
Specified by:handleBuffer in interface AudioSinkOverrides:handleBuffer in class ForwardingAudioSinkParameters:buffer - The buffer containing audio data.presentationTimeUs - The presentation timestamp of the buffer in microseconds.encodedAccessUnitCount - The number of encoded access units in the buffer, or 1 if the buffer contains PCM audio. This allows batching multiple encoded access units in one buffer.Returns:Whether the buffer was handled fully.Throws:AudioSink.InitializationException - If an error occurs initializing the sink.AudioSink.WriteException - If an error occurs writing the audio data.
-
public void flush()
Description copied from interface: AudioSink
Flushes the sink, after which it is ready to receive buffers from a new playback position.
The audio session may remain active until AudioSink.reset() is called.
Specified by:flush in interface AudioSinkOverrides:flush in class ForwardingAudioSink
-
public void reset()
Description copied from interface: AudioSink
Resets the sink, releasing any resources that it currently holds.
Specified by:reset in interface AudioSinkOverrides:reset in class ForwardingAudioSink
-
public void dump([Dumper](Dumper.html "class in com.google.android.exoplayer2.testutil")dumper)
Description copied from interface: Dumper.Dumpable
Dumps the fields of the object using the dumper.
Specified by:dump in interface Dumper.DumpableParameters:dumper - The Dumper to be used to dump fields.