Commit 9991f146 by kimvde Committed by Ian Baker

Add Open GL step to Transformer

PiperOrigin-RevId: 394708737
parent dd19bc89
......@@ -223,6 +223,9 @@ public final class GlUtil {
}
}
/** Represents an unset texture ID. */
public static final int TEXTURE_ID_UNSET = -1;
/** Whether to throw a {@link GlException} in case of an OpenGL error. */
public static boolean glAssertionsEnabled = false;
......
......@@ -343,8 +343,21 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* be available until the previous has been released.
*/
public void releaseOutputBuffer() {
releaseOutputBuffer(/* render= */ false);
}
/**
* Releases the current output buffer. If the {@link MediaCodec} was configured with an output
* surface, setting {@code render} to {@code true} will first send the buffer to the output
* surface. The surface will release the buffer back to the codec once it is no longer
* used/displayed.
*
* <p>This should be called after the buffer has been processed. The next output buffer will not
* be available until the previous has been released.
*/
public void releaseOutputBuffer(boolean render) {
outputBuffer = null;
codec.releaseOutputBuffer(outputBufferIndex, /* render= */ false);
codec.releaseOutputBuffer(outputBufferIndex, render);
outputBufferIndex = C.INDEX_UNSET;
}
......@@ -359,18 +372,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
codec.release();
}
/** Returns {@code true} if a buffer is successfully obtained, rendered and released. */
public boolean maybeDequeueRenderAndReleaseOutputBuffer() {
if (!maybeDequeueOutputBuffer()) {
return false;
}
codec.releaseOutputBuffer(outputBufferIndex, /* render= */ true);
outputBuffer = null;
outputBufferIndex = C.INDEX_UNSET;
return true;
}
/**
* Tries obtaining an output buffer and sets {@link #outputBuffer} to the obtained output buffer.
*
......
......@@ -20,6 +20,7 @@ import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.google.android.exoplayer2.BaseRenderer;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.RendererCapabilities;
import com.google.android.exoplayer2.util.MediaClock;
......@@ -75,7 +76,7 @@ import com.google.android.exoplayer2.util.MimeTypes;
}
@Override
protected final void onStarted() {
protected void onStarted() throws ExoPlaybackException {
isRendererStarted = true;
}
......
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