CapturingAudioSink
@UnstableApi
public class CapturingAudioSink extends ForwardingAudioSink implements Dumper.Dumpable
| java.lang.Object | ||
| ↳ | androidx.media3.exoplayer.audio.ForwardingAudioSink | |
| ↳ | androidx.media3.test.utils.CapturingAudioSink |
An AudioSink forwarding to DefaultAudioSink that captures configuration, discontinuity and buffer events.
Summary
Nested types |
|---|
public final class CapturingAudioSink.InterceptingBufferSink implements TeeAudioProcessor.AudioBufferSink |
public final class CapturingAudioSink.SampleInterceptingBufferSink implements TeeAudioProcessor.AudioBufferSink |
Protected constructors |
|---|
CapturingAudioSink( |
Public methods |
|
|---|---|
void |
configure(AudioSink.AudioSinkConfig audioSinkConfig)Configures (or reconfigures) the sink. |
static CapturingAudioSink |
create()Creates the capturing audio sink. |
static CapturingAudioSink |
|
void |
Dumps the fields of the object using the |
boolean |
handleBuffer(Attempts to process data from a |
void |
Signals to the sink that the next buffer may be discontinuous with the previous buffer. |
Inherited Constants |
||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Inherited methods |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Protected constructors
CapturingAudioSink
protected CapturingAudioSink(
AudioSink sink,
boolean shouldCaptureIndividualBuffers
)
Public methods
configure
public void configure(AudioSink.AudioSinkConfig audioSinkConfig)
Configures (or reconfigures) the sink.
| Parameters | |
|---|---|
AudioSink.AudioSinkConfig audioSinkConfig |
The |
| Throws | |
|---|---|
androidx.media3.exoplayer.audio.AudioSink.ConfigurationException |
If an error occurs configuring the sink. |
handleBuffer
public 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). The position of the ByteBuffer is advanced by the number of bytes that were handled. 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 flush (or to configure that causes the sink to be flushed).
| Parameters | |
|---|---|
ByteBuffer buffer |
The buffer containing audio data. |
long presentationTimeUs |
The presentation timestamp of the buffer in microseconds. |
int 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 | |
|---|---|
boolean |
Whether the buffer was handled fully. |
| Throws | |
|---|---|
androidx.media3.exoplayer.audio.AudioSink.InitializationException |
If an error occurs initializing the sink. |
androidx.media3.exoplayer.audio.AudioSink.WriteException |
If an error occurs writing the audio data. |
handleDiscontinuity
public void handleDiscontinuity()
Signals to the sink that the next buffer may be discontinuous with the previous buffer.
Protected methods
getDelegateAudioSink
protected final AudioSink getDelegateAudioSink()
Returns the wrapped AudioSink.