mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Renaming to make pasthrough modes more explicit
Passthrough mode can use a codec or not, but the code only mentioned "passthrough" in most cases, making the specific mode confusing. For example both `MediaCodecRenderer` and it's derived class `MediaCodecAudioRenderer` had a private `passthroughEnabled` field, but they were used for the opposite modes! This change renames all relevant variables/functions to explicit `CodecPassthrough` or `Bypass`. PiperOrigin-RevId: 319225235
This commit is contained in:
parent
ab348c045c
commit
69187523b1
3 changed files with 58 additions and 58 deletions
|
|
@ -84,10 +84,9 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||||
private final AudioSink audioSink;
|
private final AudioSink audioSink;
|
||||||
|
|
||||||
private int codecMaxInputSize;
|
private int codecMaxInputSize;
|
||||||
private boolean passthroughEnabled;
|
|
||||||
private boolean codecNeedsDiscardChannelsWorkaround;
|
private boolean codecNeedsDiscardChannelsWorkaround;
|
||||||
private boolean codecNeedsEosBufferTimestampWorkaround;
|
private boolean codecNeedsEosBufferTimestampWorkaround;
|
||||||
@Nullable private Format passthroughCodecFormat;
|
@Nullable private Format codecPassthroughFormat;
|
||||||
@Nullable private Format inputFormat;
|
@Nullable private Format inputFormat;
|
||||||
private long currentPositionUs;
|
private long currentPositionUs;
|
||||||
private boolean allowFirstBufferPositionDiscontinuity;
|
private boolean allowFirstBufferPositionDiscontinuity;
|
||||||
|
|
@ -299,14 +298,14 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||||
codecMaxInputSize = getCodecMaxInputSize(codecInfo, format, getStreamFormats());
|
codecMaxInputSize = getCodecMaxInputSize(codecInfo, format, getStreamFormats());
|
||||||
codecNeedsDiscardChannelsWorkaround = codecNeedsDiscardChannelsWorkaround(codecInfo.name);
|
codecNeedsDiscardChannelsWorkaround = codecNeedsDiscardChannelsWorkaround(codecInfo.name);
|
||||||
codecNeedsEosBufferTimestampWorkaround = codecNeedsEosBufferTimestampWorkaround(codecInfo.name);
|
codecNeedsEosBufferTimestampWorkaround = codecNeedsEosBufferTimestampWorkaround(codecInfo.name);
|
||||||
passthroughEnabled =
|
|
||||||
MimeTypes.AUDIO_RAW.equals(codecInfo.mimeType)
|
|
||||||
&& !MimeTypes.AUDIO_RAW.equals(format.sampleMimeType);
|
|
||||||
MediaFormat mediaFormat =
|
MediaFormat mediaFormat =
|
||||||
getMediaFormat(format, codecInfo.codecMimeType, codecMaxInputSize, codecOperatingRate);
|
getMediaFormat(format, codecInfo.codecMimeType, codecMaxInputSize, codecOperatingRate);
|
||||||
codecAdapter.configure(mediaFormat, /* surface= */ null, crypto, /* flags= */ 0);
|
codecAdapter.configure(mediaFormat, /* surface= */ null, crypto, /* flags= */ 0);
|
||||||
// Store the input MIME type if we're using the passthrough codec.
|
// Store the input MIME type if we're using the passthrough codec.
|
||||||
passthroughCodecFormat = passthroughEnabled ? format : null;
|
boolean codecPassthroughEnabled =
|
||||||
|
MimeTypes.AUDIO_RAW.equals(codecInfo.mimeType)
|
||||||
|
&& !MimeTypes.AUDIO_RAW.equals(format.sampleMimeType);
|
||||||
|
codecPassthroughFormat = codecPassthroughEnabled ? format : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -388,8 +387,8 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||||
@Override
|
@Override
|
||||||
protected void configureOutput(Format outputFormat) throws ExoPlaybackException {
|
protected void configureOutput(Format outputFormat) throws ExoPlaybackException {
|
||||||
Format audioSinkInputFormat;
|
Format audioSinkInputFormat;
|
||||||
if (passthroughCodecFormat != null) {
|
if (codecPassthroughFormat != null) {
|
||||||
@C.Encoding int passthroughEncoding = getPassthroughEncoding(passthroughCodecFormat);
|
@C.Encoding int passthroughEncoding = getPassthroughEncoding(codecPassthroughFormat);
|
||||||
// TODO(b/112299307): Passthrough can have become unavailable since usePassthrough was called.
|
// TODO(b/112299307): Passthrough can have become unavailable since usePassthrough was called.
|
||||||
Assertions.checkState(passthroughEncoding != C.ENCODING_INVALID);
|
Assertions.checkState(passthroughEncoding != C.ENCODING_INVALID);
|
||||||
audioSinkInputFormat = outputFormat.buildUpon().setEncoding(passthroughEncoding).build();
|
audioSinkInputFormat = outputFormat.buildUpon().setEncoding(passthroughEncoding).build();
|
||||||
|
|
@ -426,7 +425,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onOutputPassthroughFormatChanged(Format outputFormat) throws ExoPlaybackException {
|
protected void onOutputBypassFormatChanged(Format outputFormat) throws ExoPlaybackException {
|
||||||
@C.Encoding int passthroughEncoding = getPassthroughEncoding(outputFormat);
|
@C.Encoding int passthroughEncoding = getPassthroughEncoding(outputFormat);
|
||||||
// TODO(b/112299307): Passthrough can have become unavailable since usePassthrough was called.
|
// TODO(b/112299307): Passthrough can have become unavailable since usePassthrough was called.
|
||||||
Assertions.checkState(passthroughEncoding != C.ENCODING_INVALID);
|
Assertions.checkState(passthroughEncoding != C.ENCODING_INVALID);
|
||||||
|
|
@ -631,7 +630,8 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||||
bufferPresentationTimeUs = getLargestQueuedPresentationTimeUs();
|
bufferPresentationTimeUs = getLargestQueuedPresentationTimeUs();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (passthroughEnabled && (bufferFlags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) != 0) {
|
if (codecPassthroughFormat != null
|
||||||
|
&& (bufferFlags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) != 0) {
|
||||||
// Discard output buffers from the passthrough (raw) decoder containing codec specific data.
|
// Discard output buffers from the passthrough (raw) decoder containing codec specific data.
|
||||||
codec.releaseOutputBuffer(bufferIndex, false);
|
codec.releaseOutputBuffer(bufferIndex, false);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -346,7 +346,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
private final float assumedMinimumCodecOperatingRate;
|
private final float assumedMinimumCodecOperatingRate;
|
||||||
private final DecoderInputBuffer buffer;
|
private final DecoderInputBuffer buffer;
|
||||||
private final DecoderInputBuffer flagsOnlyBuffer;
|
private final DecoderInputBuffer flagsOnlyBuffer;
|
||||||
private final BatchBuffer passthroughBatchBuffer;
|
private final BatchBuffer bypassBatchBuffer;
|
||||||
private final TimedValueQueue<Format> formatQueue;
|
private final TimedValueQueue<Format> formatQueue;
|
||||||
private final ArrayList<Long> decodeOnlyPresentationTimestamps;
|
private final ArrayList<Long> decodeOnlyPresentationTimestamps;
|
||||||
private final MediaCodec.BufferInfo outputBufferInfo;
|
private final MediaCodec.BufferInfo outputBufferInfo;
|
||||||
|
|
@ -388,8 +388,8 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
private ByteBuffer outputBuffer;
|
private ByteBuffer outputBuffer;
|
||||||
private boolean isDecodeOnlyOutputBuffer;
|
private boolean isDecodeOnlyOutputBuffer;
|
||||||
private boolean isLastOutputBuffer;
|
private boolean isLastOutputBuffer;
|
||||||
private boolean passthroughEnabled;
|
private boolean bypassEnabled;
|
||||||
private boolean passthroughDrainAndReinitialize;
|
private boolean bypassDrainAndReinitialize;
|
||||||
private boolean codecReconfigured;
|
private boolean codecReconfigured;
|
||||||
@ReconfigurationState private int codecReconfigurationState;
|
@ReconfigurationState private int codecReconfigurationState;
|
||||||
@DrainState private int codecDrainState;
|
@DrainState private int codecDrainState;
|
||||||
|
|
@ -441,7 +441,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
pendingOutputStreamOffsetsUs = new long[MAX_PENDING_OUTPUT_STREAM_OFFSET_COUNT];
|
pendingOutputStreamOffsetsUs = new long[MAX_PENDING_OUTPUT_STREAM_OFFSET_COUNT];
|
||||||
pendingOutputStreamSwitchTimesUs = new long[MAX_PENDING_OUTPUT_STREAM_OFFSET_COUNT];
|
pendingOutputStreamSwitchTimesUs = new long[MAX_PENDING_OUTPUT_STREAM_OFFSET_COUNT];
|
||||||
outputStreamOffsetUs = C.TIME_UNSET;
|
outputStreamOffsetUs = C.TIME_UNSET;
|
||||||
passthroughBatchBuffer = new BatchBuffer();
|
bypassBatchBuffer = new BatchBuffer();
|
||||||
resetCodecStateForRelease();
|
resetCodecStateForRelease();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -544,14 +544,14 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
@Nullable MediaCrypto crypto,
|
@Nullable MediaCrypto crypto,
|
||||||
float codecOperatingRate);
|
float codecOperatingRate);
|
||||||
|
|
||||||
protected final void maybeInitCodecOrPassthrough() throws ExoPlaybackException {
|
protected final void maybeInitCodecOrBypass() throws ExoPlaybackException {
|
||||||
if (codec != null || passthroughEnabled || inputFormat == null) {
|
if (codec != null || bypassEnabled || inputFormat == null) {
|
||||||
// We have a codec or using passthrough, or don't have a format to decide how to render.
|
// We have a codec, are bypassing it, or don't have a format to decide how to render.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sourceDrmSession == null && usePassthrough(inputFormat)) {
|
if (sourceDrmSession == null && usePassthrough(inputFormat)) {
|
||||||
initPassthrough(inputFormat);
|
initBypass(inputFormat);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -699,8 +699,8 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
inputStreamEnded = false;
|
inputStreamEnded = false;
|
||||||
outputStreamEnded = false;
|
outputStreamEnded = false;
|
||||||
pendingOutputEndOfStream = false;
|
pendingOutputEndOfStream = false;
|
||||||
if (passthroughEnabled) {
|
if (bypassEnabled) {
|
||||||
passthroughBatchBuffer.flush();
|
bypassBatchBuffer.flush();
|
||||||
} else {
|
} else {
|
||||||
flushOrReinitializeCodec();
|
flushOrReinitializeCodec();
|
||||||
}
|
}
|
||||||
|
|
@ -743,17 +743,17 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
@Override
|
@Override
|
||||||
protected void onReset() {
|
protected void onReset() {
|
||||||
try {
|
try {
|
||||||
disablePassthrough();
|
disableBypass();
|
||||||
releaseCodec();
|
releaseCodec();
|
||||||
} finally {
|
} finally {
|
||||||
setSourceDrmSession(null);
|
setSourceDrmSession(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disablePassthrough() {
|
private void disableBypass() {
|
||||||
passthroughDrainAndReinitialize = false;
|
bypassDrainAndReinitialize = false;
|
||||||
passthroughBatchBuffer.clear();
|
bypassBatchBuffer.clear();
|
||||||
passthroughEnabled = false;
|
bypassEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void releaseCodec() {
|
protected void releaseCodec() {
|
||||||
|
|
@ -812,10 +812,10 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// We have a format.
|
// We have a format.
|
||||||
maybeInitCodecOrPassthrough();
|
maybeInitCodecOrBypass();
|
||||||
if (passthroughEnabled) {
|
if (bypassEnabled) {
|
||||||
TraceUtil.beginSection("renderPassthrough");
|
TraceUtil.beginSection("bypassRender");
|
||||||
while (renderPassthrough(positionUs, elapsedRealtimeUs)) {}
|
while (bypassRender(positionUs, elapsedRealtimeUs)) {}
|
||||||
TraceUtil.endSection();
|
TraceUtil.endSection();
|
||||||
} else if (codec != null) {
|
} else if (codec != null) {
|
||||||
long renderStartTimeMs = SystemClock.elapsedRealtime();
|
long renderStartTimeMs = SystemClock.elapsedRealtime();
|
||||||
|
|
@ -846,7 +846,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
* This method is a no-op if the codec is {@code null}.
|
* This method is a no-op if the codec is {@code null}.
|
||||||
*
|
*
|
||||||
* <p>The implementation of this method calls {@link #flushOrReleaseCodec()}, and {@link
|
* <p>The implementation of this method calls {@link #flushOrReleaseCodec()}, and {@link
|
||||||
* #maybeInitCodecOrPassthrough()} if the codec needs to be re-instantiated.
|
* #maybeInitCodecOrBypass()} if the codec needs to be re-instantiated.
|
||||||
*
|
*
|
||||||
* @return Whether the codec was released and reinitialized, rather than being flushed.
|
* @return Whether the codec was released and reinitialized, rather than being flushed.
|
||||||
* @throws ExoPlaybackException If an error occurs re-instantiating the codec.
|
* @throws ExoPlaybackException If an error occurs re-instantiating the codec.
|
||||||
|
|
@ -854,7 +854,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
protected final boolean flushOrReinitializeCodec() throws ExoPlaybackException {
|
protected final boolean flushOrReinitializeCodec() throws ExoPlaybackException {
|
||||||
boolean released = flushOrReleaseCodec();
|
boolean released = flushOrReleaseCodec();
|
||||||
if (released) {
|
if (released) {
|
||||||
maybeInitCodecOrPassthrough();
|
maybeInitCodecOrBypass();
|
||||||
}
|
}
|
||||||
return released;
|
return released;
|
||||||
}
|
}
|
||||||
|
|
@ -1051,23 +1051,23 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures passthrough where no codec is used. Called instead of {@link
|
* Configures rendering where no codec is used. Called instead of {@link
|
||||||
* #configureCodec(MediaCodecInfo, MediaCodecAdapter, Format, MediaCrypto, float)} when no codec
|
* #configureCodec(MediaCodecInfo, MediaCodecAdapter, Format, MediaCrypto, float)} when no codec
|
||||||
* is used in passthrough.
|
* is used to render.
|
||||||
*/
|
*/
|
||||||
private void initPassthrough(Format format) {
|
private void initBypass(Format format) {
|
||||||
disablePassthrough(); // In case of transition between 2 passthrough formats.
|
disableBypass(); // In case of transition between 2 bypass formats.
|
||||||
|
|
||||||
String mimeType = format.sampleMimeType;
|
String mimeType = format.sampleMimeType;
|
||||||
if (!MimeTypes.AUDIO_AAC.equals(mimeType)
|
if (!MimeTypes.AUDIO_AAC.equals(mimeType)
|
||||||
&& !MimeTypes.AUDIO_MPEG.equals(mimeType)
|
&& !MimeTypes.AUDIO_MPEG.equals(mimeType)
|
||||||
&& !MimeTypes.AUDIO_OPUS.equals(mimeType)) {
|
&& !MimeTypes.AUDIO_OPUS.equals(mimeType)) {
|
||||||
// TODO(b/154746451): Batching provokes frame drops in non offload passthrough.
|
// TODO(b/154746451): Batching provokes frame drops in non offload.
|
||||||
passthroughBatchBuffer.setMaxAccessUnitCount(1);
|
bypassBatchBuffer.setMaxAccessUnitCount(1);
|
||||||
} else {
|
} else {
|
||||||
passthroughBatchBuffer.setMaxAccessUnitCount(BatchBuffer.DEFAULT_BATCH_SIZE_ACCESS_UNITS);
|
bypassBatchBuffer.setMaxAccessUnitCount(BatchBuffer.DEFAULT_BATCH_SIZE_ACCESS_UNITS);
|
||||||
}
|
}
|
||||||
passthroughEnabled = true;
|
bypassEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCodec(MediaCodecInfo codecInfo, MediaCrypto crypto) throws Exception {
|
private void initCodec(MediaCodecInfo codecInfo, MediaCrypto crypto) throws Exception {
|
||||||
|
|
@ -1405,18 +1405,18 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
setSourceDrmSession(formatHolder.drmSession);
|
setSourceDrmSession(formatHolder.drmSession);
|
||||||
inputFormat = newFormat;
|
inputFormat = newFormat;
|
||||||
|
|
||||||
if (passthroughEnabled) {
|
if (bypassEnabled) {
|
||||||
passthroughDrainAndReinitialize = true;
|
bypassDrainAndReinitialize = true;
|
||||||
return; // Need to drain passthrough first.
|
return; // Need to drain batch buffer first.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (codec == null) {
|
if (codec == null) {
|
||||||
maybeInitCodecOrPassthrough();
|
maybeInitCodecOrBypass();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have an existing codec that we may need to reconfigure or re-initialize or release it to
|
// We have an existing codec that we may need to reconfigure or re-initialize or release it to
|
||||||
// switch to passthrough. If the existing codec instance is being kept then its operating rate
|
// switch to bypass. If the existing codec instance is being kept then its operating rate
|
||||||
// may need to be updated.
|
// may need to be updated.
|
||||||
|
|
||||||
if ((sourceDrmSession == null && codecDrmSession != null)
|
if ((sourceDrmSession == null && codecDrmSession != null)
|
||||||
|
|
@ -1514,7 +1514,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the output {@link Format} changes in passthrough.
|
* Called when the output {@link Format} changes in bypass mode (no codec used).
|
||||||
*
|
*
|
||||||
* <p>The default implementation is a no-op.
|
* <p>The default implementation is a no-op.
|
||||||
*
|
*
|
||||||
|
|
@ -1522,7 +1522,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
* @throws ExoPlaybackException Thrown if an error occurs handling the new output media format.
|
* @throws ExoPlaybackException Thrown if an error occurs handling the new output media format.
|
||||||
*/
|
*/
|
||||||
// TODO(b/154849417): merge with {@link #onOutputFormatChanged(Format)}.
|
// TODO(b/154849417): merge with {@link #onOutputFormatChanged(Format)}.
|
||||||
protected void onOutputPassthroughFormatChanged(Format outputFormat) throws ExoPlaybackException {
|
protected void onOutputBypassFormatChanged(Format outputFormat) throws ExoPlaybackException {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1874,7 +1874,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
* iteration of the rendering loop.
|
* iteration of the rendering loop.
|
||||||
* @param elapsedRealtimeUs {@link SystemClock#elapsedRealtime()} in microseconds, measured at the
|
* @param elapsedRealtimeUs {@link SystemClock#elapsedRealtime()} in microseconds, measured at the
|
||||||
* start of the current iteration of the rendering loop.
|
* start of the current iteration of the rendering loop.
|
||||||
* @param codec The {@link MediaCodec} instance, or null in passthrough mode.
|
* @param codec The {@link MediaCodec} instance, or null in bypass mode were no codec is used.
|
||||||
* @param buffer The output buffer to process.
|
* @param buffer The output buffer to process.
|
||||||
* @param bufferIndex The index of the output buffer.
|
* @param bufferIndex The index of the output buffer.
|
||||||
* @param bufferFlags The flags attached to the output buffer.
|
* @param bufferFlags The flags attached to the output buffer.
|
||||||
|
|
@ -2003,7 +2003,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
|
|
||||||
private void reinitializeCodec() throws ExoPlaybackException {
|
private void reinitializeCodec() throws ExoPlaybackException {
|
||||||
releaseCodec();
|
releaseCodec();
|
||||||
maybeInitCodecOrPassthrough();
|
maybeInitCodecOrBypass();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDecodeOnlyBuffer(long presentationTimeUs) {
|
private boolean isDecodeOnlyBuffer(long presentationTimeUs) {
|
||||||
|
|
@ -2081,9 +2081,9 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
* @throws ExoPlaybackException If an error occurred while processing a buffer or handling a
|
* @throws ExoPlaybackException If an error occurred while processing a buffer or handling a
|
||||||
* format change.
|
* format change.
|
||||||
*/
|
*/
|
||||||
private boolean renderPassthrough(long positionUs, long elapsedRealtimeUs)
|
private boolean bypassRender(long positionUs, long elapsedRealtimeUs)
|
||||||
throws ExoPlaybackException {
|
throws ExoPlaybackException {
|
||||||
BatchBuffer batchBuffer = passthroughBatchBuffer;
|
BatchBuffer batchBuffer = bypassBatchBuffer;
|
||||||
|
|
||||||
// Let's process the pending buffer if any.
|
// Let's process the pending buffer if any.
|
||||||
Assertions.checkState(!outputStreamEnded);
|
Assertions.checkState(!outputStreamEnded);
|
||||||
|
|
@ -2112,15 +2112,15 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
}
|
}
|
||||||
batchBuffer.batchWasConsumed();
|
batchBuffer.batchWasConsumed();
|
||||||
|
|
||||||
if (passthroughDrainAndReinitialize) {
|
if (bypassDrainAndReinitialize) {
|
||||||
if (!batchBuffer.isEmpty()) {
|
if (!batchBuffer.isEmpty()) {
|
||||||
return true; // Drain the batch buffer before propagating the format change.
|
return true; // Drain the batch buffer before propagating the format change.
|
||||||
}
|
}
|
||||||
disablePassthrough(); // The new format might not be supported in passthrough.
|
disableBypass(); // The new format might require a codec.
|
||||||
passthroughDrainAndReinitialize = false;
|
bypassDrainAndReinitialize = false;
|
||||||
maybeInitCodecOrPassthrough();
|
maybeInitCodecOrBypass();
|
||||||
if (!passthroughEnabled) {
|
if (!bypassEnabled) {
|
||||||
return false; // The new format is not supported in passthrough.
|
return false; // The new format is not supported in codec bypass.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2132,7 +2132,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
if (!batchBuffer.isEmpty() && waitingForFirstSampleInFormat) {
|
if (!batchBuffer.isEmpty() && waitingForFirstSampleInFormat) {
|
||||||
// This is the first buffer in a new format, the output format must be updated.
|
// This is the first buffer in a new format, the output format must be updated.
|
||||||
outputFormat = Assertions.checkNotNull(inputFormat);
|
outputFormat = Assertions.checkNotNull(inputFormat);
|
||||||
onOutputPassthroughFormatChanged(outputFormat);
|
onOutputBypassFormatChanged(outputFormat);
|
||||||
waitingForFirstSampleInFormat = false;
|
waitingForFirstSampleInFormat = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -515,7 +515,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||||
setOutputSurfaceV23(codec, surface);
|
setOutputSurfaceV23(codec, surface);
|
||||||
} else {
|
} else {
|
||||||
releaseCodec();
|
releaseCodec();
|
||||||
maybeInitCodecOrPassthrough();
|
maybeInitCodecOrBypass();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (surface != null && surface != dummySurface) {
|
if (surface != null && surface != dummySurface) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue