Rabbit-R1/android (non root)/java/sources/androidx/media3/exoplayer/mediacodec/DefaultMediaCodecAdapterFactory.java
2024-05-21 17:08:36 -04:00

44 lines
2 KiB
Java

package androidx.media3.exoplayer.mediacodec;
import androidx.media3.common.MimeTypes;
import androidx.media3.common.util.Log;
import androidx.media3.common.util.Util;
import androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter;
import androidx.media3.exoplayer.mediacodec.MediaCodecAdapter;
import androidx.media3.exoplayer.mediacodec.SynchronousMediaCodecAdapter;
import java.io.IOException;
/* loaded from: classes2.dex */
public final class DefaultMediaCodecAdapterFactory implements MediaCodecAdapter.Factory {
private static final int MODE_DEFAULT = 0;
private static final int MODE_DISABLED = 2;
private static final int MODE_ENABLED = 1;
private static final String TAG = "DMCodecAdapterFactory";
private int asynchronousMode = 0;
private boolean enableSynchronizeCodecInteractionsWithQueueing;
public void experimentalSetSynchronizeCodecInteractionsWithQueueingEnabled(boolean z) {
this.enableSynchronizeCodecInteractionsWithQueueing = z;
}
public DefaultMediaCodecAdapterFactory forceDisableAsynchronous() {
this.asynchronousMode = 2;
return this;
}
public DefaultMediaCodecAdapterFactory forceEnableAsynchronous() {
this.asynchronousMode = 1;
return this;
}
@Override // androidx.media3.exoplayer.mediacodec.MediaCodecAdapter.Factory
public MediaCodecAdapter createAdapter(MediaCodecAdapter.Configuration configuration) throws IOException {
int i;
if (Util.SDK_INT >= 23 && ((i = this.asynchronousMode) == 1 || (i == 0 && Util.SDK_INT >= 31))) {
int trackType = MimeTypes.getTrackType(configuration.format.sampleMimeType);
Log.i(TAG, "Creating an asynchronous MediaCodec adapter for track type " + Util.getTrackTypeString(trackType));
return new AsynchronousMediaCodecAdapter.Factory(trackType, this.enableSynchronizeCodecInteractionsWithQueueing).createAdapter(configuration);
}
return new SynchronousMediaCodecAdapter.Factory().createAdapter(configuration);
}
}