mirror of
https://github.com/samsonjs/media.git
synced 2026-04-14 12:45:47 +00:00
Remove glUtil.clearOutputFrame from GLObjectsProvider.
d288891c77 added clearing depth buffers to GLUtil, so there is no need to have allow apps to have a custom clearOutputFrame.
Also removes default implementations in GLObjectsProvider know that these methods have been implemented.
PiperOrigin-RevId: 517156304
This commit is contained in:
parent
6109a0eb62
commit
de3678e461
4 changed files with 30 additions and 25 deletions
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package androidx.media3.common;
|
||||
|
||||
import android.opengl.EGL14;
|
||||
import android.opengl.EGLContext;
|
||||
import android.opengl.EGLDisplay;
|
||||
import android.opengl.EGLSurface;
|
||||
|
|
@ -68,11 +69,6 @@ public interface GlObjectsProvider {
|
|||
int fboId = GlUtil.createFboForTexture(texId);
|
||||
return new GlTextureInfo(texId, fboId, /* rboId= */ C.INDEX_UNSET, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearOutputFrame() throws GlException {
|
||||
GlUtil.clearOutputFrame();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -89,22 +85,38 @@ public interface GlObjectsProvider {
|
|||
EGLDisplay eglDisplay, @IntRange(from = 2, to = 3) int openGlVersion, int[] configAttributes)
|
||||
throws GlException;
|
||||
|
||||
// TODO(b/271433904): Remove default implementations once photos have implemented these methods.
|
||||
/**
|
||||
* Creates a new {@link EGLSurface} wrapping the specified {@code surface}.
|
||||
*
|
||||
* @param eglDisplay The {@link EGLDisplay} to attach the surface to.
|
||||
* @param surface The surface to wrap; must be a surface, surface texture or surface holder.
|
||||
* @param colorTransfer The {@linkplain C.ColorTransfer color transfer characteristics} to which
|
||||
* the {@code surface} is configured.
|
||||
* @param isEncoderInputSurface Whether the {@code surface} is the input surface of an encoder.
|
||||
* @throws GlException If an error occurs during creation.
|
||||
*/
|
||||
@RequiresApi(17)
|
||||
default EGLSurface createEglSurface(
|
||||
EGLSurface createEglSurface(
|
||||
EGLDisplay eglDisplay,
|
||||
Object surface,
|
||||
@C.ColorTransfer int colorTransfer,
|
||||
boolean isEncoderInputSurface)
|
||||
throws GlException {
|
||||
return GlUtil.createEglSurface(eglDisplay, surface, colorTransfer, isEncoderInputSurface);
|
||||
}
|
||||
throws GlException;
|
||||
|
||||
/**
|
||||
* Creates and focuses a placeholder {@link EGLSurface}.
|
||||
*
|
||||
* @param eglContext The {@link EGLContext} to make current.
|
||||
* @param eglDisplay The {@link EGLDisplay} to attach the surface to.
|
||||
* @param configAttributes The attributes to configure EGL with.
|
||||
* @return A placeholder {@link EGLSurface} that has been focused to allow rendering to take
|
||||
* place, or {@link EGL14#EGL_NO_SURFACE} if the current context supports rendering without a
|
||||
* surface.
|
||||
* @throws GlException If an error occurs during creation.
|
||||
*/
|
||||
@RequiresApi(17)
|
||||
default EGLSurface createFocusedPlaceholderEglSurface(
|
||||
EGLContext eglContext, EGLDisplay eglDisplay, int[] configAttributes) throws GlException {
|
||||
return GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay, configAttributes);
|
||||
}
|
||||
EGLSurface createFocusedPlaceholderEglSurface(
|
||||
EGLContext eglContext, EGLDisplay eglDisplay, int[] configAttributes) throws GlException;
|
||||
|
||||
/**
|
||||
* Returns a {@link GlTextureInfo} containing the identifiers of the newly created buffers.
|
||||
|
|
@ -115,11 +127,4 @@ public interface GlObjectsProvider {
|
|||
* @throws GlException If an error occurs during creation.
|
||||
*/
|
||||
GlTextureInfo createBuffersForTexture(int texId, int width, int height) throws GlException;
|
||||
|
||||
/**
|
||||
* Clears the current render target.
|
||||
*
|
||||
* @throws GlException If an error occurs during clearing.
|
||||
*/
|
||||
void clearOutputFrame() throws GlException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||
outputEglSurface,
|
||||
outputSurfaceInfo.width,
|
||||
outputSurfaceInfo.height);
|
||||
glObjectsProvider.clearOutputFrame();
|
||||
GlUtil.clearOutputFrame();
|
||||
defaultShaderProgram.drawFrame(inputTexture.texId, presentationTimeUs);
|
||||
|
||||
EGLExt.eglPresentationTimeANDROID(
|
||||
|
|
@ -466,7 +466,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||
try {
|
||||
debugSurfaceViewWrapper.maybeRenderToSurfaceView(
|
||||
() -> {
|
||||
glObjectsProvider.clearOutputFrame();
|
||||
GlUtil.clearOutputFrame();
|
||||
@C.ColorTransfer
|
||||
int configuredColorTransfer = defaultShaderProgram.getOutputColorTransfer();
|
||||
defaultShaderProgram.setOutputColorTransfer(
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ import java.util.concurrent.Executor;
|
|||
// Copy frame to fbo.
|
||||
GlUtil.focusFramebufferUsingCurrentContext(
|
||||
outputTexture.fboId, outputTexture.width, outputTexture.height);
|
||||
glObjectsProvider.clearOutputFrame();
|
||||
GlUtil.clearOutputFrame();
|
||||
drawFrame(inputTexture.texId);
|
||||
inputListener.onInputFrameProcessed(inputTexture);
|
||||
outputListener.onOutputFrameAvailable(outputTexture, presentationTimeUs);
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ public abstract class SingleFrameGlShaderProgram implements GlShaderProgram {
|
|||
outputTextureInUse = true;
|
||||
GlUtil.focusFramebufferUsingCurrentContext(
|
||||
outputTexture.fboId, outputTexture.width, outputTexture.height);
|
||||
glObjectsProvider.clearOutputFrame();
|
||||
GlUtil.clearOutputFrame();
|
||||
drawFrame(inputTexture.texId, presentationTimeUs);
|
||||
inputListener.onInputFrameProcessed(inputTexture);
|
||||
outputListener.onOutputFrameAvailable(outputTexture, presentationTimeUs);
|
||||
|
|
|
|||
Loading…
Reference in a new issue