mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +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;
|
package androidx.media3.common;
|
||||||
|
|
||||||
|
import android.opengl.EGL14;
|
||||||
import android.opengl.EGLContext;
|
import android.opengl.EGLContext;
|
||||||
import android.opengl.EGLDisplay;
|
import android.opengl.EGLDisplay;
|
||||||
import android.opengl.EGLSurface;
|
import android.opengl.EGLSurface;
|
||||||
|
|
@ -68,11 +69,6 @@ public interface GlObjectsProvider {
|
||||||
int fboId = GlUtil.createFboForTexture(texId);
|
int fboId = GlUtil.createFboForTexture(texId);
|
||||||
return new GlTextureInfo(texId, fboId, /* rboId= */ C.INDEX_UNSET, width, height);
|
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)
|
EGLDisplay eglDisplay, @IntRange(from = 2, to = 3) int openGlVersion, int[] configAttributes)
|
||||||
throws GlException;
|
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)
|
@RequiresApi(17)
|
||||||
default EGLSurface createEglSurface(
|
EGLSurface createEglSurface(
|
||||||
EGLDisplay eglDisplay,
|
EGLDisplay eglDisplay,
|
||||||
Object surface,
|
Object surface,
|
||||||
@C.ColorTransfer int colorTransfer,
|
@C.ColorTransfer int colorTransfer,
|
||||||
boolean isEncoderInputSurface)
|
boolean isEncoderInputSurface)
|
||||||
throws GlException {
|
throws GlException;
|
||||||
return GlUtil.createEglSurface(eglDisplay, surface, colorTransfer, isEncoderInputSurface);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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)
|
@RequiresApi(17)
|
||||||
default EGLSurface createFocusedPlaceholderEglSurface(
|
EGLSurface createFocusedPlaceholderEglSurface(
|
||||||
EGLContext eglContext, EGLDisplay eglDisplay, int[] configAttributes) throws GlException {
|
EGLContext eglContext, EGLDisplay eglDisplay, int[] configAttributes) throws GlException;
|
||||||
return GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay, configAttributes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link GlTextureInfo} containing the identifiers of the newly created buffers.
|
* 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.
|
* @throws GlException If an error occurs during creation.
|
||||||
*/
|
*/
|
||||||
GlTextureInfo createBuffersForTexture(int texId, int width, int height) throws GlException;
|
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,
|
outputEglSurface,
|
||||||
outputSurfaceInfo.width,
|
outputSurfaceInfo.width,
|
||||||
outputSurfaceInfo.height);
|
outputSurfaceInfo.height);
|
||||||
glObjectsProvider.clearOutputFrame();
|
GlUtil.clearOutputFrame();
|
||||||
defaultShaderProgram.drawFrame(inputTexture.texId, presentationTimeUs);
|
defaultShaderProgram.drawFrame(inputTexture.texId, presentationTimeUs);
|
||||||
|
|
||||||
EGLExt.eglPresentationTimeANDROID(
|
EGLExt.eglPresentationTimeANDROID(
|
||||||
|
|
@ -466,7 +466,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||||
try {
|
try {
|
||||||
debugSurfaceViewWrapper.maybeRenderToSurfaceView(
|
debugSurfaceViewWrapper.maybeRenderToSurfaceView(
|
||||||
() -> {
|
() -> {
|
||||||
glObjectsProvider.clearOutputFrame();
|
GlUtil.clearOutputFrame();
|
||||||
@C.ColorTransfer
|
@C.ColorTransfer
|
||||||
int configuredColorTransfer = defaultShaderProgram.getOutputColorTransfer();
|
int configuredColorTransfer = defaultShaderProgram.getOutputColorTransfer();
|
||||||
defaultShaderProgram.setOutputColorTransfer(
|
defaultShaderProgram.setOutputColorTransfer(
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ import java.util.concurrent.Executor;
|
||||||
// Copy frame to fbo.
|
// Copy frame to fbo.
|
||||||
GlUtil.focusFramebufferUsingCurrentContext(
|
GlUtil.focusFramebufferUsingCurrentContext(
|
||||||
outputTexture.fboId, outputTexture.width, outputTexture.height);
|
outputTexture.fboId, outputTexture.width, outputTexture.height);
|
||||||
glObjectsProvider.clearOutputFrame();
|
GlUtil.clearOutputFrame();
|
||||||
drawFrame(inputTexture.texId);
|
drawFrame(inputTexture.texId);
|
||||||
inputListener.onInputFrameProcessed(inputTexture);
|
inputListener.onInputFrameProcessed(inputTexture);
|
||||||
outputListener.onOutputFrameAvailable(outputTexture, presentationTimeUs);
|
outputListener.onOutputFrameAvailable(outputTexture, presentationTimeUs);
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ public abstract class SingleFrameGlShaderProgram implements GlShaderProgram {
|
||||||
outputTextureInUse = true;
|
outputTextureInUse = true;
|
||||||
GlUtil.focusFramebufferUsingCurrentContext(
|
GlUtil.focusFramebufferUsingCurrentContext(
|
||||||
outputTexture.fboId, outputTexture.width, outputTexture.height);
|
outputTexture.fboId, outputTexture.width, outputTexture.height);
|
||||||
glObjectsProvider.clearOutputFrame();
|
GlUtil.clearOutputFrame();
|
||||||
drawFrame(inputTexture.texId, presentationTimeUs);
|
drawFrame(inputTexture.texId, presentationTimeUs);
|
||||||
inputListener.onInputFrameProcessed(inputTexture);
|
inputListener.onInputFrameProcessed(inputTexture);
|
||||||
outputListener.onOutputFrameAvailable(outputTexture, presentationTimeUs);
|
outputListener.onOutputFrameAvailable(outputTexture, presentationTimeUs);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue