mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Add decoder instantiation tracing
This is just for consistency with our other renderers PiperOrigin-RevId: 303317443
This commit is contained in:
parent
25e0d30760
commit
2209947acb
4 changed files with 12 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ import com.google.android.exoplayer2.audio.DefaultAudioSink;
|
||||||
import com.google.android.exoplayer2.drm.ExoMediaCrypto;
|
import com.google.android.exoplayer2.drm.ExoMediaCrypto;
|
||||||
import com.google.android.exoplayer2.util.Assertions;
|
import com.google.android.exoplayer2.util.Assertions;
|
||||||
import com.google.android.exoplayer2.util.MimeTypes;
|
import com.google.android.exoplayer2.util.MimeTypes;
|
||||||
|
import com.google.android.exoplayer2.util.TraceUtil;
|
||||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||||
|
|
||||||
/** Decodes and renders audio using FFmpeg. */
|
/** Decodes and renders audio using FFmpeg. */
|
||||||
|
|
@ -119,11 +120,13 @@ public final class FfmpegAudioRenderer extends DecoderAudioRenderer {
|
||||||
@Override
|
@Override
|
||||||
protected FfmpegAudioDecoder createDecoder(Format format, @Nullable ExoMediaCrypto mediaCrypto)
|
protected FfmpegAudioDecoder createDecoder(Format format, @Nullable ExoMediaCrypto mediaCrypto)
|
||||||
throws FfmpegDecoderException {
|
throws FfmpegDecoderException {
|
||||||
|
TraceUtil.beginSection("createFfmpegAudioDecoder");
|
||||||
int initialInputBufferSize =
|
int initialInputBufferSize =
|
||||||
format.maxInputSize != Format.NO_VALUE ? format.maxInputSize : DEFAULT_INPUT_BUFFER_SIZE;
|
format.maxInputSize != Format.NO_VALUE ? format.maxInputSize : DEFAULT_INPUT_BUFFER_SIZE;
|
||||||
decoder =
|
decoder =
|
||||||
new FfmpegAudioDecoder(
|
new FfmpegAudioDecoder(
|
||||||
NUM_BUFFERS, NUM_BUFFERS, initialInputBufferSize, format, shouldUseFloatOutput(format));
|
NUM_BUFFERS, NUM_BUFFERS, initialInputBufferSize, format, shouldUseFloatOutput(format));
|
||||||
|
TraceUtil.endSection();
|
||||||
return decoder;
|
return decoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import com.google.android.exoplayer2.Format;
|
||||||
import com.google.android.exoplayer2.RendererCapabilities;
|
import com.google.android.exoplayer2.RendererCapabilities;
|
||||||
import com.google.android.exoplayer2.decoder.Decoder;
|
import com.google.android.exoplayer2.decoder.Decoder;
|
||||||
import com.google.android.exoplayer2.drm.ExoMediaCrypto;
|
import com.google.android.exoplayer2.drm.ExoMediaCrypto;
|
||||||
|
import com.google.android.exoplayer2.util.TraceUtil;
|
||||||
import com.google.android.exoplayer2.video.DecoderVideoRenderer;
|
import com.google.android.exoplayer2.video.DecoderVideoRenderer;
|
||||||
import com.google.android.exoplayer2.video.VideoDecoderInputBuffer;
|
import com.google.android.exoplayer2.video.VideoDecoderInputBuffer;
|
||||||
import com.google.android.exoplayer2.video.VideoDecoderOutputBuffer;
|
import com.google.android.exoplayer2.video.VideoDecoderOutputBuffer;
|
||||||
|
|
@ -90,8 +91,10 @@ public final class FfmpegVideoRenderer extends DecoderVideoRenderer {
|
||||||
protected Decoder<VideoDecoderInputBuffer, VideoDecoderOutputBuffer, FfmpegDecoderException>
|
protected Decoder<VideoDecoderInputBuffer, VideoDecoderOutputBuffer, FfmpegDecoderException>
|
||||||
createDecoder(Format format, @Nullable ExoMediaCrypto mediaCrypto)
|
createDecoder(Format format, @Nullable ExoMediaCrypto mediaCrypto)
|
||||||
throws FfmpegDecoderException {
|
throws FfmpegDecoderException {
|
||||||
|
TraceUtil.beginSection("createFfmpegVideoDecoder");
|
||||||
// TODO: Implement, remove the SuppressWarnings annotation, and update the return type to use
|
// TODO: Implement, remove the SuppressWarnings annotation, and update the return type to use
|
||||||
// the concrete type of the decoder (probably FfmepgVideoDecoder).
|
// the concrete type of the decoder (probably FfmepgVideoDecoder).
|
||||||
|
TraceUtil.endSection();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import com.google.android.exoplayer2.extractor.FlacStreamMetadata;
|
||||||
import com.google.android.exoplayer2.util.Assertions;
|
import com.google.android.exoplayer2.util.Assertions;
|
||||||
import com.google.android.exoplayer2.util.FlacConstants;
|
import com.google.android.exoplayer2.util.FlacConstants;
|
||||||
import com.google.android.exoplayer2.util.MimeTypes;
|
import com.google.android.exoplayer2.util.MimeTypes;
|
||||||
|
import com.google.android.exoplayer2.util.TraceUtil;
|
||||||
import com.google.android.exoplayer2.util.Util;
|
import com.google.android.exoplayer2.util.Util;
|
||||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||||
|
|
||||||
|
|
@ -111,9 +112,11 @@ public final class LibflacAudioRenderer extends DecoderAudioRenderer {
|
||||||
@Override
|
@Override
|
||||||
protected FlacDecoder createDecoder(Format format, @Nullable ExoMediaCrypto mediaCrypto)
|
protected FlacDecoder createDecoder(Format format, @Nullable ExoMediaCrypto mediaCrypto)
|
||||||
throws FlacDecoderException {
|
throws FlacDecoderException {
|
||||||
|
TraceUtil.beginSection("createFlacDecoder");
|
||||||
FlacDecoder decoder =
|
FlacDecoder decoder =
|
||||||
new FlacDecoder(NUM_BUFFERS, NUM_BUFFERS, format.maxInputSize, format.initializationData);
|
new FlacDecoder(NUM_BUFFERS, NUM_BUFFERS, format.maxInputSize, format.initializationData);
|
||||||
streamMetadata = decoder.getStreamMetadata();
|
streamMetadata = decoder.getStreamMetadata();
|
||||||
|
TraceUtil.endSection();
|
||||||
return decoder;
|
return decoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import com.google.android.exoplayer2.audio.AudioRendererEventListener;
|
||||||
import com.google.android.exoplayer2.audio.DecoderAudioRenderer;
|
import com.google.android.exoplayer2.audio.DecoderAudioRenderer;
|
||||||
import com.google.android.exoplayer2.drm.ExoMediaCrypto;
|
import com.google.android.exoplayer2.drm.ExoMediaCrypto;
|
||||||
import com.google.android.exoplayer2.util.MimeTypes;
|
import com.google.android.exoplayer2.util.MimeTypes;
|
||||||
|
import com.google.android.exoplayer2.util.TraceUtil;
|
||||||
|
|
||||||
/** Decodes and renders audio using the native Opus decoder. */
|
/** Decodes and renders audio using the native Opus decoder. */
|
||||||
public class LibopusAudioRenderer extends DecoderAudioRenderer {
|
public class LibopusAudioRenderer extends DecoderAudioRenderer {
|
||||||
|
|
@ -80,6 +81,7 @@ public class LibopusAudioRenderer extends DecoderAudioRenderer {
|
||||||
@Override
|
@Override
|
||||||
protected OpusDecoder createDecoder(Format format, @Nullable ExoMediaCrypto mediaCrypto)
|
protected OpusDecoder createDecoder(Format format, @Nullable ExoMediaCrypto mediaCrypto)
|
||||||
throws OpusDecoderException {
|
throws OpusDecoderException {
|
||||||
|
TraceUtil.beginSection("createOpusDecoder");
|
||||||
int initialInputBufferSize =
|
int initialInputBufferSize =
|
||||||
format.maxInputSize != Format.NO_VALUE ? format.maxInputSize : DEFAULT_INPUT_BUFFER_SIZE;
|
format.maxInputSize != Format.NO_VALUE ? format.maxInputSize : DEFAULT_INPUT_BUFFER_SIZE;
|
||||||
OpusDecoder decoder =
|
OpusDecoder decoder =
|
||||||
|
|
@ -91,6 +93,7 @@ public class LibopusAudioRenderer extends DecoderAudioRenderer {
|
||||||
mediaCrypto);
|
mediaCrypto);
|
||||||
channelCount = decoder.getChannelCount();
|
channelCount = decoder.getChannelCount();
|
||||||
sampleRate = decoder.getSampleRate();
|
sampleRate = decoder.getSampleRate();
|
||||||
|
TraceUtil.endSection();
|
||||||
return decoder;
|
return decoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue