Commit bc891273 by claincly Committed by Ian Baker

Rename MediaCodecAdapterWrapper to Codec.

Move static factories into a separate class and make it implement an interface
that will let tests customize encoder/decoder creation.

PiperOrigin-RevId: 417610825
parent 7d83c979
...@@ -44,8 +44,9 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -44,8 +44,9 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
private final Format inputFormat; private final Format inputFormat;
private final Transformation transformation; private final Transformation transformation;
private final Codec.EncoderFactory encoderFactory;
private final MediaCodecAdapterWrapper decoder; private final Codec decoder;
private final DecoderInputBuffer decoderInputBuffer; private final DecoderInputBuffer decoderInputBuffer;
private final SonicAudioProcessor sonicAudioProcessor; private final SonicAudioProcessor sonicAudioProcessor;
...@@ -55,7 +56,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -55,7 +56,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
private final DecoderInputBuffer encoderOutputBuffer; private final DecoderInputBuffer encoderOutputBuffer;
private @MonotonicNonNull AudioFormat encoderInputAudioFormat; private @MonotonicNonNull AudioFormat encoderInputAudioFormat;
private @MonotonicNonNull MediaCodecAdapterWrapper encoder; private @MonotonicNonNull Codec encoder;
private long nextEncoderInputBufferTimeUs; private long nextEncoderInputBufferTimeUs;
private long encoderBufferDurationRemainder; private long encoderBufferDurationRemainder;
...@@ -63,10 +64,15 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -63,10 +64,15 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
private boolean drainingSonicForSpeedChange; private boolean drainingSonicForSpeedChange;
private float currentSpeed; private float currentSpeed;
public AudioSamplePipeline(Format inputFormat, Transformation transformation) public AudioSamplePipeline(
Format inputFormat,
Transformation transformation,
Codec.EncoderFactory encoderFactory,
Codec.DecoderFactory decoderFactory)
throws TransformationException { throws TransformationException {
this.inputFormat = inputFormat; this.inputFormat = inputFormat;
this.transformation = transformation; this.transformation = transformation;
this.encoderFactory = encoderFactory;
decoderInputBuffer = decoderInputBuffer =
new DecoderInputBuffer(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DISABLED); new DecoderInputBuffer(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DISABLED);
encoderInputBuffer = encoderInputBuffer =
...@@ -77,7 +83,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -77,7 +83,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
sonicOutputBuffer = AudioProcessor.EMPTY_BUFFER; sonicOutputBuffer = AudioProcessor.EMPTY_BUFFER;
speedProvider = new SegmentSpeedProvider(inputFormat); speedProvider = new SegmentSpeedProvider(inputFormat);
currentSpeed = speedProvider.getSpeed(0); currentSpeed = speedProvider.getSpeed(0);
this.decoder = MediaCodecAdapterWrapper.createForAudioDecoding(inputFormat); this.decoder = decoderFactory.createForAudioDecoding(inputFormat);
} }
@Override @Override
...@@ -301,7 +307,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -301,7 +307,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
} }
} }
encoder = encoder =
MediaCodecAdapterWrapper.createForAudioEncoding( encoderFactory.createForAudioEncoding(
new Format.Builder() new Format.Builder()
.setSampleMimeType( .setSampleMimeType(
transformation.audioMimeType == null transformation.audioMimeType == null
......
...@@ -16,15 +16,11 @@ ...@@ -16,15 +16,11 @@
package com.google.android.exoplayer2.transformer; package com.google.android.exoplayer2.transformer;
import static com.google.android.exoplayer2.util.Assertions.checkArgument;
import static com.google.android.exoplayer2.util.Assertions.checkNotNull; import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
import static com.google.android.exoplayer2.util.Assertions.checkState; import static com.google.android.exoplayer2.util.Assertions.checkState;
import static com.google.android.exoplayer2.util.Util.SDK_INT;
import android.annotation.SuppressLint;
import android.media.MediaCodec; import android.media.MediaCodec;
import android.media.MediaCodec.BufferInfo; import android.media.MediaCodec.BufferInfo;
import android.media.MediaCodecInfo.CodecCapabilities;
import android.media.MediaFormat; import android.media.MediaFormat;
import android.view.Surface; import android.view.Surface;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
...@@ -32,15 +28,9 @@ import com.google.android.exoplayer2.C; ...@@ -32,15 +28,9 @@ import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer; import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
import com.google.android.exoplayer2.mediacodec.MediaCodecAdapter; import com.google.android.exoplayer2.mediacodec.MediaCodecAdapter;
import com.google.android.exoplayer2.mediacodec.MediaCodecAdapter.Configuration;
import com.google.android.exoplayer2.mediacodec.MediaCodecInfo;
import com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter;
import com.google.android.exoplayer2.util.MediaFormatUtil;
import com.google.android.exoplayer2.util.MimeTypes; import com.google.android.exoplayer2.util.MimeTypes;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.EnsuresNonNullIf; import org.checkerframework.checker.nullness.qual.EnsuresNonNullIf;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...@@ -51,14 +41,72 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -51,14 +41,72 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* through {@link MediaCodecAdapter}. This is done by simplifying the calls needed to queue and * through {@link MediaCodecAdapter}. This is done by simplifying the calls needed to queue and
* dequeue buffers, removing the need to track buffer indices and codec events. * dequeue buffers, removing the need to track buffer indices and codec events.
*/ */
/* package */ final class MediaCodecAdapterWrapper { public final class Codec {
/** A factory for {@link Codec decoder} instances. */
public interface DecoderFactory {
/** A default {@code DecoderFactory} implementation. */
DecoderFactory DEFAULT = new DefaultCodecFactory();
/**
* Returns a {@link Codec} for audio decoding.
*
* @param format The {@link Format} (of the input data) used to determine the underlying {@link
* MediaCodec} and its configuration values.
* @return A configured and started decoder wrapper.
* @throws TransformationException If the underlying codec cannot be created.
*/
Codec createForAudioDecoding(Format format) throws TransformationException;
/**
* Returns a {@link Codec} for video decoding.
*
* @param format The {@link Format} (of the input data) used to determine the underlying {@link
* MediaCodec} and its configuration values.
* @param surface The {@link Surface} to which the decoder output is rendered.
* @return A configured and started decoder wrapper.
* @throws TransformationException If the underlying codec cannot be created.
*/
Codec createForVideoDecoding(Format format, Surface surface) throws TransformationException;
}
/** A factory for {@link Codec encoder} instances. */
public interface EncoderFactory {
/** A default {@code EncoderFactory} implementation. */
EncoderFactory DEFAULT = new DefaultCodecFactory();
/**
* Returns a {@link Codec} for audio encoding.
*
* @param format The {@link Format} (of the output data) used to determine the underlying {@link
* MediaCodec} and its configuration values.
* @return A configured and started encoder wrapper.
* @throws TransformationException If the underlying codec cannot be created.
*/
Codec createForAudioEncoding(Format format) throws TransformationException;
/**
* Returns a {@link Codec} for video encoding.
*
* @param format The {@link Format} (of the output data) used to determine the underlying {@link
* MediaCodec} and its configuration values. {@link Format#sampleMimeType}, {@link
* Format#width} and {@link Format#height} must be set to those of the desired output video
* format. {@link Format#rotationDegrees} should be 0. The video should always be in
* landscape orientation.
* @return A configured and started encoder wrapper.
* @throws TransformationException If the underlying codec cannot be created.
*/
Codec createForVideoEncoding(Format format) throws TransformationException;
}
// MediaCodec decoders always output 16 bit PCM, unless configured to output PCM float. // MediaCodec decoders always output 16 bit PCM, unless configured to output PCM float.
// https://developer.android.com/reference/android/media/MediaCodec#raw-audio-buffers. // https://developer.android.com/reference/android/media/MediaCodec#raw-audio-buffers.
private static final int MEDIA_CODEC_PCM_ENCODING = C.ENCODING_PCM_16BIT; private static final int MEDIA_CODEC_PCM_ENCODING = C.ENCODING_PCM_16BIT;
private final BufferInfo outputBufferInfo; private final BufferInfo outputBufferInfo;
private final MediaCodecAdapter codec; private final MediaCodecAdapter mediaCodecAdapter;
private @MonotonicNonNull Format outputFormat; private @MonotonicNonNull Format outputFormat;
@Nullable private ByteBuffer outputBuffer; @Nullable private ByteBuffer outputBuffer;
...@@ -68,182 +116,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -68,182 +116,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private boolean inputStreamEnded; private boolean inputStreamEnded;
private boolean outputStreamEnded; private boolean outputStreamEnded;
private static class Factory extends SynchronousMediaCodecAdapter.Factory { /** Creates a {@code Codec} from a configured and started {@link MediaCodecAdapter}. */
@Override public Codec(MediaCodecAdapter mediaCodecAdapter) {
protected MediaCodec createCodec(Configuration configuration) throws IOException { this.mediaCodecAdapter = mediaCodecAdapter;
String sampleMimeType =
checkNotNull(configuration.mediaFormat.getString(MediaFormat.KEY_MIME));
boolean isDecoder = (configuration.flags & MediaCodec.CONFIGURE_FLAG_ENCODE) == 0;
return isDecoder
? MediaCodec.createDecoderByType(checkNotNull(sampleMimeType))
: MediaCodec.createEncoderByType(checkNotNull(sampleMimeType));
}
}
private static MediaCodecInfo createPlaceholderMediaCodecInfo() {
return MediaCodecInfo.newInstance(
/* name= */ "name-placeholder",
/* mimeType= */ "mime-type-placeholder",
/* codecMimeType= */ "mime-type-placeholder",
/* capabilities= */ null,
/* hardwareAccelerated= */ false,
/* softwareOnly= */ false,
/* vendor= */ false,
/* forceDisableAdaptive= */ false,
/* forceSecure= */ false);
}
/**
* Returns a {@link MediaCodecAdapterWrapper} for a configured and started {@link
* MediaCodecAdapter} audio decoder.
*
* @param format The {@link Format} (of the input data) used to determine the underlying {@link
* MediaCodec} and its configuration values.
* @return A configured and started decoder wrapper.
* @throws TransformationException If the underlying codec cannot be created.
*/
public static MediaCodecAdapterWrapper createForAudioDecoding(Format format)
throws TransformationException {
MediaFormat mediaFormat =
MediaFormat.createAudioFormat(
checkNotNull(format.sampleMimeType), format.sampleRate, format.channelCount);
MediaFormatUtil.maybeSetInteger(
mediaFormat, MediaFormat.KEY_MAX_INPUT_SIZE, format.maxInputSize);
MediaFormatUtil.setCsdBuffers(mediaFormat, format.initializationData);
MediaCodecAdapter adapter;
try {
adapter =
new Factory()
.createAdapter(
MediaCodecAdapter.Configuration.createForAudioDecoding(
createPlaceholderMediaCodecInfo(), mediaFormat, format, /* crypto= */ null));
} catch (Exception e) {
throw createTransformationException(e, format, /* isVideo= */ false, /* isDecoder= */ true);
}
return new MediaCodecAdapterWrapper(adapter);
}
/**
* Returns a {@link MediaCodecAdapterWrapper} for a configured and started {@link
* MediaCodecAdapter} video decoder.
*
* @param format The {@link Format} (of the input data) used to determine the underlying {@link
* MediaCodec} and its configuration values.
* @param surface The {@link Surface} to which the decoder output is rendered.
* @return A configured and started decoder wrapper.
* @throws TransformationException If the underlying codec cannot be created.
*/
@SuppressLint("InlinedApi")
public static MediaCodecAdapterWrapper createForVideoDecoding(Format format, Surface surface)
throws TransformationException {
MediaFormat mediaFormat =
MediaFormat.createVideoFormat(
checkNotNull(format.sampleMimeType), format.width, format.height);
MediaFormatUtil.maybeSetInteger(mediaFormat, MediaFormat.KEY_ROTATION, format.rotationDegrees);
MediaFormatUtil.maybeSetInteger(
mediaFormat, MediaFormat.KEY_MAX_INPUT_SIZE, format.maxInputSize);
MediaFormatUtil.setCsdBuffers(mediaFormat, format.initializationData);
if (SDK_INT >= 29) {
// On API levels over 29, Transformer decodes as many frames as possible in one render
// cycle. This key ensures no frame dropping when the decoder's output surface is full.
mediaFormat.setInteger(MediaFormat.KEY_ALLOW_FRAME_DROP, 0);
}
MediaCodecAdapter adapter;
try {
adapter =
new Factory()
.createAdapter(
MediaCodecAdapter.Configuration.createForVideoDecoding(
createPlaceholderMediaCodecInfo(),
mediaFormat,
format,
surface,
/* crypto= */ null));
} catch (Exception e) {
throw createTransformationException(e, format, /* isVideo= */ true, /* isDecoder= */ true);
}
return new MediaCodecAdapterWrapper(adapter);
}
/**
* Returns a {@link MediaCodecAdapterWrapper} for a configured and started {@link
* MediaCodecAdapter} audio encoder.
*
* @param format The {@link Format} (of the output data) used to determine the underlying {@link
* MediaCodec} and its configuration values.
* @return A configured and started encoder wrapper.
* @throws TransformationException If the underlying codec cannot be created.
*/
public static MediaCodecAdapterWrapper createForAudioEncoding(Format format)
throws TransformationException {
MediaFormat mediaFormat =
MediaFormat.createAudioFormat(
checkNotNull(format.sampleMimeType), format.sampleRate, format.channelCount);
mediaFormat.setInteger(MediaFormat.KEY_BIT_RATE, format.bitrate);
MediaCodecAdapter adapter;
try {
adapter =
new Factory()
.createAdapter(
MediaCodecAdapter.Configuration.createForAudioEncoding(
createPlaceholderMediaCodecInfo(), mediaFormat, format));
} catch (Exception e) {
throw createTransformationException(e, format, /* isVideo= */ false, /* isDecoder= */ false);
}
return new MediaCodecAdapterWrapper(adapter);
}
/**
* Returns a {@link MediaCodecAdapterWrapper} for a configured and started {@link
* MediaCodecAdapter} video encoder.
*
* @param format The {@link Format} (of the output data) used to determine the underlying {@link
* MediaCodec} and its configuration values. {@link Format#sampleMimeType}, {@link
* Format#width} and {@link Format#height} must be set to those of the desired output video
* format. {@link Format#rotationDegrees} should be 0. The video should always be in landscape
* orientation.
* @param additionalEncoderConfig A map of {@link MediaFormat}'s integer settings, where the keys
* are from {@code MediaFormat.KEY_*} constants. Its values will override those in {@code
* format}.
* @return A configured and started encoder wrapper.
* @throws TransformationException If the underlying codec cannot be created.
*/
public static MediaCodecAdapterWrapper createForVideoEncoding(
Format format, Map<String, Integer> additionalEncoderConfig) throws TransformationException {
checkArgument(format.width != Format.NO_VALUE);
checkArgument(format.height != Format.NO_VALUE);
checkArgument(format.height < format.width);
checkArgument(format.rotationDegrees == 0);
MediaFormat mediaFormat =
MediaFormat.createVideoFormat(
checkNotNull(format.sampleMimeType), format.width, format.height);
mediaFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, CodecCapabilities.COLOR_FormatSurface);
mediaFormat.setInteger(MediaFormat.KEY_FRAME_RATE, 30);
mediaFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 1);
mediaFormat.setInteger(MediaFormat.KEY_BIT_RATE, 413_000);
for (Map.Entry<String, Integer> encoderSetting : additionalEncoderConfig.entrySet()) {
mediaFormat.setInteger(encoderSetting.getKey(), encoderSetting.getValue());
}
MediaCodecAdapter adapter;
try {
adapter =
new Factory()
.createAdapter(
MediaCodecAdapter.Configuration.createForVideoEncoding(
createPlaceholderMediaCodecInfo(), mediaFormat, format));
} catch (Exception e) {
throw createTransformationException(e, format, /* isVideo= */ true, /* isDecoder= */ false);
}
return new MediaCodecAdapterWrapper(adapter);
}
private MediaCodecAdapterWrapper(MediaCodecAdapter codec) {
this.codec = codec;
outputBufferInfo = new BufferInfo(); outputBufferInfo = new BufferInfo();
inputBufferIndex = C.INDEX_UNSET; inputBufferIndex = C.INDEX_UNSET;
outputBufferIndex = C.INDEX_UNSET; outputBufferIndex = C.INDEX_UNSET;
...@@ -252,7 +127,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -252,7 +127,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/** Returns the input {@link Surface}, or null if the input is not a surface. */ /** Returns the input {@link Surface}, or null if the input is not a surface. */
@Nullable @Nullable
public Surface getInputSurface() { public Surface getInputSurface() {
return codec.getInputSurface(); return mediaCodecAdapter.getInputSurface();
} }
/** /**
...@@ -267,11 +142,11 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -267,11 +142,11 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
return false; return false;
} }
if (inputBufferIndex < 0) { if (inputBufferIndex < 0) {
inputBufferIndex = codec.dequeueInputBufferIndex(); inputBufferIndex = mediaCodecAdapter.dequeueInputBufferIndex();
if (inputBufferIndex < 0) { if (inputBufferIndex < 0) {
return false; return false;
} }
inputBuffer.data = codec.getInputBuffer(inputBufferIndex); inputBuffer.data = mediaCodecAdapter.getInputBuffer(inputBufferIndex);
inputBuffer.clear(); inputBuffer.clear();
} }
checkNotNull(inputBuffer.data); checkNotNull(inputBuffer.data);
...@@ -297,13 +172,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -297,13 +172,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
inputStreamEnded = true; inputStreamEnded = true;
flags = MediaCodec.BUFFER_FLAG_END_OF_STREAM; flags = MediaCodec.BUFFER_FLAG_END_OF_STREAM;
} }
codec.queueInputBuffer(inputBufferIndex, offset, size, inputBuffer.timeUs, flags); mediaCodecAdapter.queueInputBuffer(inputBufferIndex, offset, size, inputBuffer.timeUs, flags);
inputBufferIndex = C.INDEX_UNSET; inputBufferIndex = C.INDEX_UNSET;
inputBuffer.data = null; inputBuffer.data = null;
} }
public void signalEndOfInputStream() { public void signalEndOfInputStream() {
codec.signalEndOfInputStream(); mediaCodecAdapter.signalEndOfInputStream();
} }
/** Returns the current output format, if available. */ /** Returns the current output format, if available. */
...@@ -347,7 +222,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -347,7 +222,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
*/ */
public void releaseOutputBuffer(boolean render) { public void releaseOutputBuffer(boolean render) {
outputBuffer = null; outputBuffer = null;
codec.releaseOutputBuffer(outputBufferIndex, render); mediaCodecAdapter.releaseOutputBuffer(outputBufferIndex, render);
outputBufferIndex = C.INDEX_UNSET; outputBufferIndex = C.INDEX_UNSET;
} }
...@@ -359,7 +234,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -359,7 +234,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/** Releases the underlying codec. */ /** Releases the underlying codec. */
public void release() { public void release() {
outputBuffer = null; outputBuffer = null;
codec.release(); mediaCodecAdapter.release();
} }
/** /**
...@@ -372,7 +247,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -372,7 +247,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
return false; return false;
} }
outputBuffer = checkNotNull(codec.getOutputBuffer(outputBufferIndex)); outputBuffer = checkNotNull(mediaCodecAdapter.getOutputBuffer(outputBufferIndex));
outputBuffer.position(outputBufferInfo.offset); outputBuffer.position(outputBufferInfo.offset);
outputBuffer.limit(outputBufferInfo.offset + outputBufferInfo.size); outputBuffer.limit(outputBufferInfo.offset + outputBufferInfo.size);
return true; return true;
...@@ -390,10 +265,10 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -390,10 +265,10 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
return false; return false;
} }
outputBufferIndex = codec.dequeueOutputBufferIndex(outputBufferInfo); outputBufferIndex = mediaCodecAdapter.dequeueOutputBufferIndex(outputBufferInfo);
if (outputBufferIndex < 0) { if (outputBufferIndex < 0) {
if (outputBufferIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) { if (outputBufferIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
outputFormat = getFormat(codec.getOutputFormat()); outputFormat = getFormat(mediaCodecAdapter.getOutputFormat());
} }
return false; return false;
} }
...@@ -444,28 +319,4 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -444,28 +319,4 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
} }
return formatBuilder.build(); return formatBuilder.build();
} }
private static TransformationException createTransformationException(
Exception cause, Format format, boolean isVideo, boolean isDecoder) {
String componentName = (isVideo ? "Video" : "Audio") + (isDecoder ? "Decoder" : "Encoder");
if (cause instanceof IOException) {
return TransformationException.createForCodec(
cause,
componentName,
format,
isDecoder
? TransformationException.ERROR_CODE_DECODER_INIT_FAILED
: TransformationException.ERROR_CODE_ENCODER_INIT_FAILED);
}
if (cause instanceof IllegalArgumentException) {
return TransformationException.createForCodec(
cause,
componentName,
format,
isDecoder
? TransformationException.ERROR_CODE_DECODING_FORMAT_UNSUPPORTED
: TransformationException.ERROR_CODE_ENCODING_FORMAT_UNSUPPORTED);
}
return TransformationException.createForUnexpected(cause);
}
} }
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer2.transformer;
import static com.google.android.exoplayer2.util.Assertions.checkArgument;
import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
import static com.google.android.exoplayer2.util.Util.SDK_INT;
import android.annotation.SuppressLint;
import android.media.MediaCodec;
import android.media.MediaCodecInfo.CodecCapabilities;
import android.media.MediaFormat;
import android.view.Surface;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.mediacodec.MediaCodecAdapter;
import com.google.android.exoplayer2.mediacodec.MediaCodecInfo;
import com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter;
import com.google.android.exoplayer2.util.MediaFormatUtil;
import java.io.IOException;
/** A default {@link Codec.DecoderFactory} and {@link Codec.EncoderFactory}. */
/* package */ final class DefaultCodecFactory
implements Codec.DecoderFactory, Codec.EncoderFactory {
@Override
public Codec createForAudioDecoding(Format format) throws TransformationException {
MediaFormat mediaFormat =
MediaFormat.createAudioFormat(
checkNotNull(format.sampleMimeType), format.sampleRate, format.channelCount);
MediaFormatUtil.maybeSetInteger(
mediaFormat, MediaFormat.KEY_MAX_INPUT_SIZE, format.maxInputSize);
MediaFormatUtil.setCsdBuffers(mediaFormat, format.initializationData);
MediaCodecAdapter adapter;
try {
adapter =
new MediaCodecFactory()
.createAdapter(
MediaCodecAdapter.Configuration.createForAudioDecoding(
createPlaceholderMediaCodecInfo(), mediaFormat, format, /* crypto= */ null));
} catch (Exception e) {
throw createTransformationException(e, format, /* isVideo= */ false, /* isDecoder= */ true);
}
return new Codec(adapter);
}
@Override
@SuppressLint("InlinedApi")
public Codec createForVideoDecoding(Format format, Surface surface)
throws TransformationException {
MediaFormat mediaFormat =
MediaFormat.createVideoFormat(
checkNotNull(format.sampleMimeType), format.width, format.height);
MediaFormatUtil.maybeSetInteger(mediaFormat, MediaFormat.KEY_ROTATION, format.rotationDegrees);
MediaFormatUtil.maybeSetInteger(
mediaFormat, MediaFormat.KEY_MAX_INPUT_SIZE, format.maxInputSize);
MediaFormatUtil.setCsdBuffers(mediaFormat, format.initializationData);
if (SDK_INT >= 29) {
// On API levels over 29, Transformer decodes as many frames as possible in one render
// cycle. This key ensures no frame dropping when the decoder's output surface is full.
mediaFormat.setInteger(MediaFormat.KEY_ALLOW_FRAME_DROP, 0);
}
MediaCodecAdapter adapter;
try {
adapter =
new MediaCodecFactory()
.createAdapter(
MediaCodecAdapter.Configuration.createForVideoDecoding(
createPlaceholderMediaCodecInfo(),
mediaFormat,
format,
surface,
/* crypto= */ null));
} catch (Exception e) {
throw createTransformationException(e, format, /* isVideo= */ true, /* isDecoder= */ true);
}
return new Codec(adapter);
}
@Override
public Codec createForAudioEncoding(Format format) throws TransformationException {
MediaFormat mediaFormat =
MediaFormat.createAudioFormat(
checkNotNull(format.sampleMimeType), format.sampleRate, format.channelCount);
mediaFormat.setInteger(MediaFormat.KEY_BIT_RATE, format.bitrate);
MediaCodecAdapter adapter;
try {
adapter =
new MediaCodecFactory()
.createAdapter(
MediaCodecAdapter.Configuration.createForAudioEncoding(
createPlaceholderMediaCodecInfo(), mediaFormat, format));
} catch (Exception e) {
throw createTransformationException(e, format, /* isVideo= */ false, /* isDecoder= */ false);
}
return new Codec(adapter);
}
@Override
public Codec createForVideoEncoding(Format format) throws TransformationException {
checkArgument(format.width != Format.NO_VALUE);
checkArgument(format.height != Format.NO_VALUE);
// According to interface Javadoc, format.rotationDegrees should be 0. The video should always
// be in landscape orientation.
checkArgument(format.height < format.width);
checkArgument(format.rotationDegrees == 0);
MediaFormat mediaFormat =
MediaFormat.createVideoFormat(
checkNotNull(format.sampleMimeType), format.width, format.height);
mediaFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, CodecCapabilities.COLOR_FormatSurface);
mediaFormat.setInteger(MediaFormat.KEY_FRAME_RATE, 30);
mediaFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 1);
mediaFormat.setInteger(MediaFormat.KEY_BIT_RATE, 413_000);
MediaCodecAdapter adapter;
try {
adapter =
new MediaCodecFactory()
.createAdapter(
MediaCodecAdapter.Configuration.createForVideoEncoding(
createPlaceholderMediaCodecInfo(), mediaFormat, format));
} catch (Exception e) {
throw createTransformationException(e, format, /* isVideo= */ true, /* isDecoder= */ false);
}
return new Codec(adapter);
}
private static final class MediaCodecFactory extends SynchronousMediaCodecAdapter.Factory {
@Override
protected MediaCodec createCodec(MediaCodecAdapter.Configuration configuration)
throws IOException {
String sampleMimeType =
checkNotNull(configuration.mediaFormat.getString(MediaFormat.KEY_MIME));
boolean isDecoder = (configuration.flags & MediaCodec.CONFIGURE_FLAG_ENCODE) == 0;
return isDecoder
? MediaCodec.createDecoderByType(checkNotNull(sampleMimeType))
: MediaCodec.createEncoderByType(checkNotNull(sampleMimeType));
}
}
private static MediaCodecInfo createPlaceholderMediaCodecInfo() {
return MediaCodecInfo.newInstance(
/* name= */ "name-placeholder",
/* mimeType= */ "mime-type-placeholder",
/* codecMimeType= */ "mime-type-placeholder",
/* capabilities= */ null,
/* hardwareAccelerated= */ false,
/* softwareOnly= */ false,
/* vendor= */ false,
/* forceDisableAdaptive= */ false,
/* forceSecure= */ false);
}
private static TransformationException createTransformationException(
Exception cause, Format format, boolean isVideo, boolean isDecoder) {
String componentName = (isVideo ? "Video" : "Audio") + (isDecoder ? "Decoder" : "Encoder");
if (cause instanceof IOException) {
return TransformationException.createForCodec(
cause,
componentName,
format,
isDecoder
? TransformationException.ERROR_CODE_DECODER_INIT_FAILED
: TransformationException.ERROR_CODE_ENCODER_INIT_FAILED);
}
if (cause instanceof IllegalArgumentException) {
return TransformationException.createForCodec(
cause,
componentName,
format,
isDecoder
? TransformationException.ERROR_CODE_DECODING_FORMAT_UNSUPPORTED
: TransformationException.ERROR_CODE_ENCODING_FORMAT_UNSUPPORTED);
}
return TransformationException.createForUnexpected(cause);
}
}
...@@ -107,6 +107,7 @@ public final class Transformer { ...@@ -107,6 +107,7 @@ public final class Transformer {
private DebugViewProvider debugViewProvider; private DebugViewProvider debugViewProvider;
private Looper looper; private Looper looper;
private Clock clock; private Clock clock;
private Codec.EncoderFactory encoderFactory;
/** @deprecated Use {@link #Builder(Context)} instead. */ /** @deprecated Use {@link #Builder(Context)} instead. */
@Deprecated @Deprecated
...@@ -118,6 +119,7 @@ public final class Transformer { ...@@ -118,6 +119,7 @@ public final class Transformer {
listener = new Listener() {}; listener = new Listener() {};
looper = Util.getCurrentOrMainLooper(); looper = Util.getCurrentOrMainLooper();
clock = Clock.DEFAULT; clock = Clock.DEFAULT;
encoderFactory = Codec.EncoderFactory.DEFAULT;
debugViewProvider = DebugViewProvider.NONE; debugViewProvider = DebugViewProvider.NONE;
} }
...@@ -135,6 +137,7 @@ public final class Transformer { ...@@ -135,6 +137,7 @@ public final class Transformer {
listener = new Listener() {}; listener = new Listener() {};
looper = Util.getCurrentOrMainLooper(); looper = Util.getCurrentOrMainLooper();
clock = Clock.DEFAULT; clock = Clock.DEFAULT;
encoderFactory = Codec.EncoderFactory.DEFAULT;
debugViewProvider = DebugViewProvider.NONE; debugViewProvider = DebugViewProvider.NONE;
} }
...@@ -153,6 +156,7 @@ public final class Transformer { ...@@ -153,6 +156,7 @@ public final class Transformer {
this.videoMimeType = transformer.transformation.videoMimeType; this.videoMimeType = transformer.transformation.videoMimeType;
this.listener = transformer.listener; this.listener = transformer.listener;
this.looper = transformer.looper; this.looper = transformer.looper;
this.encoderFactory = transformer.encoderFactory;
this.debugViewProvider = transformer.debugViewProvider; this.debugViewProvider = transformer.debugViewProvider;
this.clock = transformer.clock; this.clock = transformer.clock;
} }
...@@ -361,6 +365,18 @@ public final class Transformer { ...@@ -361,6 +365,18 @@ public final class Transformer {
} }
/** /**
* Sets the {@link Codec.EncoderFactory} that will be used by the transformer. The default value
* is {@link Codec.EncoderFactory#DEFAULT}.
*
* @param encoderFactory The {@link Codec.EncoderFactory} instance.
* @return This builder.
*/
public Builder setEncoderFactory(Codec.EncoderFactory encoderFactory) {
this.encoderFactory = encoderFactory;
return this;
}
/**
* Sets a provider for views to show diagnostic information (if available) during * Sets a provider for views to show diagnostic information (if available) during
* transformation. This is intended for debugging. The default value is {@link * transformation. This is intended for debugging. The default value is {@link
* DebugViewProvider#NONE}, which doesn't show any debug info. * DebugViewProvider#NONE}, which doesn't show any debug info.
...@@ -448,6 +464,8 @@ public final class Transformer { ...@@ -448,6 +464,8 @@ public final class Transformer {
listener, listener,
looper, looper,
clock, clock,
encoderFactory,
Codec.DecoderFactory.DEFAULT,
debugViewProvider); debugViewProvider);
} }
...@@ -536,6 +554,8 @@ public final class Transformer { ...@@ -536,6 +554,8 @@ public final class Transformer {
private final Transformation transformation; private final Transformation transformation;
private final Looper looper; private final Looper looper;
private final Clock clock; private final Clock clock;
private final Codec.EncoderFactory encoderFactory;
private final Codec.DecoderFactory decoderFactory;
private final Transformer.DebugViewProvider debugViewProvider; private final Transformer.DebugViewProvider debugViewProvider;
private Transformer.Listener listener; private Transformer.Listener listener;
...@@ -551,6 +571,8 @@ public final class Transformer { ...@@ -551,6 +571,8 @@ public final class Transformer {
Transformer.Listener listener, Transformer.Listener listener,
Looper looper, Looper looper,
Clock clock, Clock clock,
Codec.EncoderFactory encoderFactory,
Codec.DecoderFactory decoderFactory,
Transformer.DebugViewProvider debugViewProvider) { Transformer.DebugViewProvider debugViewProvider) {
checkState( checkState(
!transformation.removeAudio || !transformation.removeVideo, !transformation.removeAudio || !transformation.removeVideo,
...@@ -562,6 +584,8 @@ public final class Transformer { ...@@ -562,6 +584,8 @@ public final class Transformer {
this.listener = listener; this.listener = listener;
this.looper = looper; this.looper = looper;
this.clock = clock; this.clock = clock;
this.encoderFactory = encoderFactory;
this.decoderFactory = decoderFactory;
this.debugViewProvider = debugViewProvider; this.debugViewProvider = debugViewProvider;
progressState = PROGRESS_STATE_NO_TRANSFORMATION; progressState = PROGRESS_STATE_NO_TRANSFORMATION;
} }
...@@ -662,7 +686,12 @@ public final class Transformer { ...@@ -662,7 +686,12 @@ public final class Transformer {
new ExoPlayer.Builder( new ExoPlayer.Builder(
context, context,
new TransformerRenderersFactory( new TransformerRenderersFactory(
context, muxerWrapper, transformation, debugViewProvider)) context,
muxerWrapper,
transformation,
encoderFactory,
decoderFactory,
debugViewProvider))
.setMediaSourceFactory(mediaSourceFactory) .setMediaSourceFactory(mediaSourceFactory)
.setTrackSelector(trackSelector) .setTrackSelector(trackSelector)
.setLoadControl(loadControl) .setLoadControl(loadControl)
...@@ -751,16 +780,22 @@ public final class Transformer { ...@@ -751,16 +780,22 @@ public final class Transformer {
private final MuxerWrapper muxerWrapper; private final MuxerWrapper muxerWrapper;
private final TransformerMediaClock mediaClock; private final TransformerMediaClock mediaClock;
private final Transformation transformation; private final Transformation transformation;
private final Codec.EncoderFactory encoderFactory;
private final Codec.DecoderFactory decoderFactory;
private final Transformer.DebugViewProvider debugViewProvider; private final Transformer.DebugViewProvider debugViewProvider;
public TransformerRenderersFactory( public TransformerRenderersFactory(
Context context, Context context,
MuxerWrapper muxerWrapper, MuxerWrapper muxerWrapper,
Transformation transformation, Transformation transformation,
Codec.EncoderFactory encoderFactory,
Codec.DecoderFactory decoderFactory,
Transformer.DebugViewProvider debugViewProvider) { Transformer.DebugViewProvider debugViewProvider) {
this.context = context; this.context = context;
this.muxerWrapper = muxerWrapper; this.muxerWrapper = muxerWrapper;
this.transformation = transformation; this.transformation = transformation;
this.encoderFactory = encoderFactory;
this.decoderFactory = decoderFactory;
this.debugViewProvider = debugViewProvider; this.debugViewProvider = debugViewProvider;
mediaClock = new TransformerMediaClock(); mediaClock = new TransformerMediaClock();
} }
...@@ -776,13 +811,21 @@ public final class Transformer { ...@@ -776,13 +811,21 @@ public final class Transformer {
Renderer[] renderers = new Renderer[rendererCount]; Renderer[] renderers = new Renderer[rendererCount];
int index = 0; int index = 0;
if (!transformation.removeAudio) { if (!transformation.removeAudio) {
renderers[index] = new TransformerAudioRenderer(muxerWrapper, mediaClock, transformation); renderers[index] =
new TransformerAudioRenderer(
muxerWrapper, mediaClock, transformation, encoderFactory, decoderFactory);
index++; index++;
} }
if (!transformation.removeVideo) { if (!transformation.removeVideo) {
renderers[index] = renderers[index] =
new TransformerVideoRenderer( new TransformerVideoRenderer(
context, muxerWrapper, mediaClock, transformation, debugViewProvider); context,
muxerWrapper,
mediaClock,
transformation,
encoderFactory,
decoderFactory,
debugViewProvider);
index++; index++;
} }
return renderers; return renderers;
......
...@@ -32,11 +32,19 @@ import com.google.android.exoplayer2.source.SampleStream.ReadDataResult; ...@@ -32,11 +32,19 @@ import com.google.android.exoplayer2.source.SampleStream.ReadDataResult;
private static final String TAG = "TAudioRenderer"; private static final String TAG = "TAudioRenderer";
private final Codec.EncoderFactory encoderFactory;
private final Codec.DecoderFactory decoderFactory;
private final DecoderInputBuffer decoderInputBuffer; private final DecoderInputBuffer decoderInputBuffer;
public TransformerAudioRenderer( public TransformerAudioRenderer(
MuxerWrapper muxerWrapper, TransformerMediaClock mediaClock, Transformation transformation) { MuxerWrapper muxerWrapper,
TransformerMediaClock mediaClock,
Transformation transformation,
Codec.EncoderFactory encoderFactory,
Codec.DecoderFactory decoderFactory) {
super(C.TRACK_TYPE_AUDIO, muxerWrapper, mediaClock, transformation); super(C.TRACK_TYPE_AUDIO, muxerWrapper, mediaClock, transformation);
this.encoderFactory = encoderFactory;
this.decoderFactory = decoderFactory;
decoderInputBuffer = decoderInputBuffer =
new DecoderInputBuffer(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DISABLED); new DecoderInputBuffer(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DISABLED);
} }
...@@ -60,7 +68,8 @@ import com.google.android.exoplayer2.source.SampleStream.ReadDataResult; ...@@ -60,7 +68,8 @@ import com.google.android.exoplayer2.source.SampleStream.ReadDataResult;
} }
Format inputFormat = checkNotNull(formatHolder.format); Format inputFormat = checkNotNull(formatHolder.format);
if (shouldTranscode(inputFormat)) { if (shouldTranscode(inputFormat)) {
samplePipeline = new AudioSamplePipeline(inputFormat, transformation); samplePipeline =
new AudioSamplePipeline(inputFormat, transformation, encoderFactory, decoderFactory);
} else { } else {
samplePipeline = new PassthroughSamplePipeline(inputFormat); samplePipeline = new PassthroughSamplePipeline(inputFormat);
} }
......
...@@ -34,6 +34,8 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -34,6 +34,8 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
private static final String TAG = "TVideoRenderer"; private static final String TAG = "TVideoRenderer";
private final Context context; private final Context context;
private final Codec.EncoderFactory encoderFactory;
private final Codec.DecoderFactory decoderFactory;
private final Transformer.DebugViewProvider debugViewProvider; private final Transformer.DebugViewProvider debugViewProvider;
private final DecoderInputBuffer decoderInputBuffer; private final DecoderInputBuffer decoderInputBuffer;
...@@ -44,9 +46,13 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -44,9 +46,13 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
MuxerWrapper muxerWrapper, MuxerWrapper muxerWrapper,
TransformerMediaClock mediaClock, TransformerMediaClock mediaClock,
Transformation transformation, Transformation transformation,
Codec.EncoderFactory encoderFactory,
Codec.DecoderFactory decoderFactory,
Transformer.DebugViewProvider debugViewProvider) { Transformer.DebugViewProvider debugViewProvider) {
super(C.TRACK_TYPE_VIDEO, muxerWrapper, mediaClock, transformation); super(C.TRACK_TYPE_VIDEO, muxerWrapper, mediaClock, transformation);
this.context = context; this.context = context;
this.encoderFactory = encoderFactory;
this.decoderFactory = decoderFactory;
this.debugViewProvider = debugViewProvider; this.debugViewProvider = debugViewProvider;
decoderInputBuffer = decoderInputBuffer =
new DecoderInputBuffer(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DISABLED); new DecoderInputBuffer(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DISABLED);
...@@ -72,7 +78,13 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -72,7 +78,13 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
Format inputFormat = checkNotNull(formatHolder.format); Format inputFormat = checkNotNull(formatHolder.format);
if (shouldTranscode(inputFormat)) { if (shouldTranscode(inputFormat)) {
samplePipeline = samplePipeline =
new VideoSamplePipeline(context, inputFormat, transformation, debugViewProvider); new VideoSamplePipeline(
context,
inputFormat,
transformation,
encoderFactory,
decoderFactory,
debugViewProvider);
} else { } else {
samplePipeline = new PassthroughSamplePipeline(inputFormat); samplePipeline = new PassthroughSamplePipeline(inputFormat);
} }
......
...@@ -27,7 +27,6 @@ import androidx.annotation.RequiresApi; ...@@ -27,7 +27,6 @@ import androidx.annotation.RequiresApi;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer; import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
import com.google.common.collect.ImmutableMap;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/** /**
...@@ -39,9 +38,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -39,9 +38,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private final int outputRotationDegrees; private final int outputRotationDegrees;
private final DecoderInputBuffer decoderInputBuffer; private final DecoderInputBuffer decoderInputBuffer;
private final MediaCodecAdapterWrapper decoder; private final Codec decoder;
private final MediaCodecAdapterWrapper encoder; private final Codec encoder;
private final DecoderInputBuffer encoderOutputBuffer; private final DecoderInputBuffer encoderOutputBuffer;
private @MonotonicNonNull FrameEditor frameEditor; private @MonotonicNonNull FrameEditor frameEditor;
...@@ -52,6 +51,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -52,6 +51,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
Context context, Context context,
Format inputFormat, Format inputFormat,
Transformation transformation, Transformation transformation,
Codec.EncoderFactory encoderFactory,
Codec.DecoderFactory decoderFactory,
Transformer.DebugViewProvider debugViewProvider) Transformer.DebugViewProvider debugViewProvider)
throws TransformationException { throws TransformationException {
decoderInputBuffer = decoderInputBuffer =
...@@ -85,7 +86,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -85,7 +86,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
transformation.transformationMatrix.postRotate(outputRotationDegrees); transformation.transformationMatrix.postRotate(outputRotationDegrees);
encoder = encoder =
MediaCodecAdapterWrapper.createForVideoEncoding( encoderFactory.createForVideoEncoding(
new Format.Builder() new Format.Builder()
.setWidth(outputWidth) .setWidth(outputWidth)
.setHeight(outputHeight) .setHeight(outputHeight)
...@@ -94,8 +95,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -94,8 +95,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
transformation.videoMimeType != null transformation.videoMimeType != null
? transformation.videoMimeType ? transformation.videoMimeType
: inputFormat.sampleMimeType) : inputFormat.sampleMimeType)
.build(), .build());
ImmutableMap.of());
if (inputFormat.height != outputHeight if (inputFormat.height != outputHeight
|| inputFormat.width != outputWidth || inputFormat.width != outputWidth
|| !transformation.transformationMatrix.isIdentity()) { || !transformation.transformationMatrix.isIdentity()) {
...@@ -109,7 +109,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -109,7 +109,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
debugViewProvider); debugViewProvider);
} }
decoder = decoder =
MediaCodecAdapterWrapper.createForVideoDecoding( decoderFactory.createForVideoDecoding(
inputFormat, inputFormat,
frameEditor == null frameEditor == null
? checkNotNull(encoder.getInputSurface()) ? checkNotNull(encoder.getInputSurface())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment