Effect: Remove GlTextureInfo accessor methods.
The extra check was a bit excessive, especially as it's called multiple times per frame. PiperOrigin-RevId: 545657102
This commit is contained in:
parent
11dec52b6a
commit
7a368b9a11
@ -164,8 +164,7 @@ import java.util.concurrent.Future;
|
|||||||
public void queueInputFrame(
|
public void queueInputFrame(
|
||||||
GlObjectsProvider glObjectsProvider, GlTextureInfo inputTexture, long presentationTimeUs) {
|
GlObjectsProvider glObjectsProvider, GlTextureInfo inputTexture, long presentationTimeUs) {
|
||||||
AppTextureFrame appTextureFrame =
|
AppTextureFrame appTextureFrame =
|
||||||
new AppTextureFrame(
|
new AppTextureFrame(inputTexture.texId, inputTexture.width, inputTexture.height);
|
||||||
inputTexture.getTexId(), inputTexture.getWidth(), inputTexture.getHeight());
|
|
||||||
// TODO(b/238302213): Handle timestamps restarting from 0 when applying effects to a playlist.
|
// TODO(b/238302213): Handle timestamps restarting from 0 when applying effects to a playlist.
|
||||||
// MediaPipe will fail if the timestamps are not monotonically increasing.
|
// MediaPipe will fail if the timestamps are not monotonically increasing.
|
||||||
// Also make sure that a MediaPipe graph producing additional frames only starts producing
|
// Also make sure that a MediaPipe graph producing additional frames only starts producing
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.common;
|
package androidx.media3.common;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Assertions.checkState;
|
|
||||||
|
|
||||||
import androidx.media3.common.util.GlUtil;
|
import androidx.media3.common.util.GlUtil;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
|
|
||||||
@ -32,13 +30,26 @@ public final class GlTextureInfo {
|
|||||||
/* width= */ C.LENGTH_UNSET,
|
/* width= */ C.LENGTH_UNSET,
|
||||||
/* height= */ C.LENGTH_UNSET);
|
/* height= */ C.LENGTH_UNSET);
|
||||||
|
|
||||||
private final int texId;
|
/** The OpenGL texture identifier, or {@link C#INDEX_UNSET} if not specified. */
|
||||||
private final int fboId;
|
public final int texId;
|
||||||
private final int rboId;
|
|
||||||
private final int width;
|
|
||||||
private final int height;
|
|
||||||
|
|
||||||
private boolean isReleased;
|
/**
|
||||||
|
* Identifier of a framebuffer object associated with the texture, or {@link C#INDEX_UNSET} if not
|
||||||
|
* specified.
|
||||||
|
*/
|
||||||
|
public final int fboId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identifier of a renderbuffer object attached with the framebuffer, or {@link C#INDEX_UNSET} if
|
||||||
|
* not specified.
|
||||||
|
*/
|
||||||
|
public final int rboId;
|
||||||
|
|
||||||
|
/** The width of the texture, in pixels, or {@link C#LENGTH_UNSET} if not specified. */
|
||||||
|
public final int width;
|
||||||
|
|
||||||
|
/** The height of the texture, in pixels, or {@link C#LENGTH_UNSET} if not specified. */
|
||||||
|
public final int height;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance.
|
* Creates a new instance.
|
||||||
@ -59,44 +70,8 @@ public final class GlTextureInfo {
|
|||||||
this.height = height;
|
this.height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The OpenGL texture identifier, or {@link C#INDEX_UNSET} if not specified. */
|
/** Releases all information associated with this instance. */
|
||||||
public int getTexId() {
|
|
||||||
checkState(!isReleased);
|
|
||||||
return texId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Identifier of a framebuffer object associated with the texture, or {@link C#INDEX_UNSET} if not
|
|
||||||
* specified.
|
|
||||||
*/
|
|
||||||
public int getFboId() {
|
|
||||||
checkState(!isReleased);
|
|
||||||
return fboId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Identifier of a renderbuffer object attached with the framebuffer, or {@link C#INDEX_UNSET} if
|
|
||||||
* not specified.
|
|
||||||
*/
|
|
||||||
public int getRboId() {
|
|
||||||
checkState(!isReleased);
|
|
||||||
return rboId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The width of the texture, in pixels, or {@link C#LENGTH_UNSET} if not specified. */
|
|
||||||
public int getWidth() {
|
|
||||||
checkState(!isReleased);
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The height of the texture, in pixels, or {@link C#LENGTH_UNSET} if not specified. */
|
|
||||||
public int getHeight() {
|
|
||||||
checkState(!isReleased);
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void release() throws GlUtil.GlException {
|
public void release() throws GlUtil.GlException {
|
||||||
isReleased = true;
|
|
||||||
if (texId != C.INDEX_UNSET) {
|
if (texId != C.INDEX_UNSET) {
|
||||||
GlUtil.deleteTexture(texId);
|
GlUtil.deleteTexture(texId);
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ public abstract class BaseGlShaderProgram implements GlShaderProgram {
|
|||||||
public void queueInputFrame(
|
public void queueInputFrame(
|
||||||
GlObjectsProvider glObjectsProvider, GlTextureInfo inputTexture, long presentationTimeUs) {
|
GlObjectsProvider glObjectsProvider, GlTextureInfo inputTexture, long presentationTimeUs) {
|
||||||
try {
|
try {
|
||||||
Size outputTextureSize = configure(inputTexture.getWidth(), inputTexture.getHeight());
|
Size outputTextureSize = configure(inputTexture.width, inputTexture.height);
|
||||||
outputTexturePool.ensureConfigured(
|
outputTexturePool.ensureConfigured(
|
||||||
glObjectsProvider, outputTextureSize.getWidth(), outputTextureSize.getHeight());
|
glObjectsProvider, outputTextureSize.getWidth(), outputTextureSize.getHeight());
|
||||||
|
|
||||||
@ -128,9 +128,9 @@ public abstract class BaseGlShaderProgram implements GlShaderProgram {
|
|||||||
|
|
||||||
// Copy frame to fbo.
|
// Copy frame to fbo.
|
||||||
GlUtil.focusFramebufferUsingCurrentContext(
|
GlUtil.focusFramebufferUsingCurrentContext(
|
||||||
outputTexture.getFboId(), outputTexture.getWidth(), outputTexture.getHeight());
|
outputTexture.fboId, outputTexture.width, outputTexture.height);
|
||||||
GlUtil.clearFocusedBuffers();
|
GlUtil.clearFocusedBuffers();
|
||||||
drawFrame(inputTexture.getTexId(), presentationTimeUs);
|
drawFrame(inputTexture.texId, presentationTimeUs);
|
||||||
inputListener.onInputFrameProcessed(inputTexture);
|
inputListener.onInputFrameProcessed(inputTexture);
|
||||||
outputListener.onOutputFrameAvailable(outputTexture, presentationTimeUs);
|
outputListener.onOutputFrameAvailable(outputTexture, presentationTimeUs);
|
||||||
} catch (VideoFrameProcessingException | GlUtil.GlException | NoSuchElementException e) {
|
} catch (VideoFrameProcessingException | GlUtil.GlException | NoSuchElementException e) {
|
||||||
|
@ -132,25 +132,23 @@ import androidx.media3.common.util.Size;
|
|||||||
GlObjectsProvider glObjectsProvider, GlTextureInfo newTexture, long presentationTimeUs) {
|
GlObjectsProvider glObjectsProvider, GlTextureInfo newTexture, long presentationTimeUs) {
|
||||||
try {
|
try {
|
||||||
if (previousTexture == null) {
|
if (previousTexture == null) {
|
||||||
int texId = GlUtil.createTexture(newTexture.getWidth(), newTexture.getHeight(), useHdr);
|
int texId = GlUtil.createTexture(newTexture.width, newTexture.height, useHdr);
|
||||||
previousTexture =
|
previousTexture =
|
||||||
glObjectsProvider.createBuffersForTexture(
|
glObjectsProvider.createBuffersForTexture(texId, newTexture.width, newTexture.height);
|
||||||
texId, newTexture.getWidth(), newTexture.getHeight());
|
|
||||||
}
|
}
|
||||||
GlTextureInfo previousTexture = checkNotNull(this.previousTexture);
|
GlTextureInfo previousTexture = checkNotNull(this.previousTexture);
|
||||||
if (previousTexture.getHeight() != newTexture.getHeight()
|
if (previousTexture.height != newTexture.height
|
||||||
|| previousTexture.getWidth() != newTexture.getWidth()) {
|
|| previousTexture.width != newTexture.width) {
|
||||||
previousTexture.release();
|
previousTexture.release();
|
||||||
int texId = GlUtil.createTexture(newTexture.getWidth(), newTexture.getHeight(), useHdr);
|
int texId = GlUtil.createTexture(newTexture.width, newTexture.height, useHdr);
|
||||||
previousTexture =
|
previousTexture =
|
||||||
glObjectsProvider.createBuffersForTexture(
|
glObjectsProvider.createBuffersForTexture(texId, newTexture.width, newTexture.height);
|
||||||
texId, newTexture.getWidth(), newTexture.getHeight());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GlUtil.focusFramebufferUsingCurrentContext(
|
GlUtil.focusFramebufferUsingCurrentContext(
|
||||||
previousTexture.getFboId(), previousTexture.getWidth(), previousTexture.getHeight());
|
previousTexture.fboId, previousTexture.width, previousTexture.height);
|
||||||
GlUtil.clearFocusedBuffers();
|
GlUtil.clearFocusedBuffers();
|
||||||
drawFrame(newTexture.getTexId(), presentationTimeUs);
|
drawFrame(newTexture.texId, presentationTimeUs);
|
||||||
previousPresentationTimeUs = presentationTimeUs;
|
previousPresentationTimeUs = presentationTimeUs;
|
||||||
this.previousTexture = previousTexture;
|
this.previousTexture = previousTexture;
|
||||||
} catch (VideoFrameProcessingException | GlUtil.GlException e) {
|
} catch (VideoFrameProcessingException | GlUtil.GlException e) {
|
||||||
@ -174,7 +172,7 @@ import androidx.media3.common.util.Size;
|
|||||||
private void queuePreviousFrame(GlObjectsProvider glObjectsProvider) {
|
private void queuePreviousFrame(GlObjectsProvider glObjectsProvider) {
|
||||||
try {
|
try {
|
||||||
GlTextureInfo previousTexture = checkNotNull(this.previousTexture);
|
GlTextureInfo previousTexture = checkNotNull(this.previousTexture);
|
||||||
Size outputTextureSize = configure(previousTexture.getWidth(), previousTexture.getHeight());
|
Size outputTextureSize = configure(previousTexture.width, previousTexture.height);
|
||||||
outputTexturePool.ensureConfigured(
|
outputTexturePool.ensureConfigured(
|
||||||
glObjectsProvider, outputTextureSize.getWidth(), outputTextureSize.getHeight());
|
glObjectsProvider, outputTextureSize.getWidth(), outputTextureSize.getHeight());
|
||||||
|
|
||||||
@ -183,10 +181,10 @@ import androidx.media3.common.util.Size;
|
|||||||
|
|
||||||
// Copy frame to fbo.
|
// Copy frame to fbo.
|
||||||
GlUtil.focusFramebufferUsingCurrentContext(
|
GlUtil.focusFramebufferUsingCurrentContext(
|
||||||
outputTexture.getFboId(), outputTexture.getWidth(), outputTexture.getHeight());
|
outputTexture.fboId, outputTexture.width, outputTexture.height);
|
||||||
GlUtil.clearFocusedBuffers();
|
GlUtil.clearFocusedBuffers();
|
||||||
|
|
||||||
drawFrame(previousTexture.getTexId(), previousPresentationTimeUs);
|
drawFrame(previousTexture.texId, previousPresentationTimeUs);
|
||||||
getOutputListener().onOutputFrameAvailable(outputTexture, previousPresentationTimeUs);
|
getOutputListener().onOutputFrameAvailable(outputTexture, previousPresentationTimeUs);
|
||||||
lastQueuedPresentationTimeUs = previousPresentationTimeUs;
|
lastQueuedPresentationTimeUs = previousPresentationTimeUs;
|
||||||
} catch (VideoFrameProcessingException | GlUtil.GlException e) {
|
} catch (VideoFrameProcessingException | GlUtil.GlException e) {
|
||||||
|
@ -328,8 +328,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
long renderTimeNs) {
|
long renderTimeNs) {
|
||||||
try {
|
try {
|
||||||
if (renderTimeNs == VideoFrameProcessor.DROP_OUTPUT_FRAME
|
if (renderTimeNs == VideoFrameProcessor.DROP_OUTPUT_FRAME
|
||||||
|| !ensureConfigured(
|
|| !ensureConfigured(glObjectsProvider, inputTexture.width, inputTexture.height)) {
|
||||||
glObjectsProvider, inputTexture.getWidth(), inputTexture.getHeight())) {
|
|
||||||
inputListener.onInputFrameProcessed(inputTexture);
|
inputListener.onInputFrameProcessed(inputTexture);
|
||||||
return; // Drop frames when requested, or there is no output surface and output texture.
|
return; // Drop frames when requested, or there is no output surface and output texture.
|
||||||
}
|
}
|
||||||
@ -365,7 +364,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
outputSurfaceInfo.width,
|
outputSurfaceInfo.width,
|
||||||
outputSurfaceInfo.height);
|
outputSurfaceInfo.height);
|
||||||
GlUtil.clearFocusedBuffers();
|
GlUtil.clearFocusedBuffers();
|
||||||
defaultShaderProgram.drawFrame(inputTexture.getTexId(), presentationTimeUs);
|
defaultShaderProgram.drawFrame(inputTexture.texId, presentationTimeUs);
|
||||||
|
|
||||||
EGLExt.eglPresentationTimeANDROID(
|
EGLExt.eglPresentationTimeANDROID(
|
||||||
eglDisplay,
|
eglDisplay,
|
||||||
@ -382,9 +381,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
GlTextureInfo outputTexture = outputTexturePool.useTexture();
|
GlTextureInfo outputTexture = outputTexturePool.useTexture();
|
||||||
outputTextureTimestamps.add(presentationTimeUs);
|
outputTextureTimestamps.add(presentationTimeUs);
|
||||||
GlUtil.focusFramebufferUsingCurrentContext(
|
GlUtil.focusFramebufferUsingCurrentContext(
|
||||||
outputTexture.getFboId(), outputTexture.getWidth(), outputTexture.getHeight());
|
outputTexture.fboId, outputTexture.width, outputTexture.height);
|
||||||
GlUtil.clearFocusedBuffers();
|
GlUtil.clearFocusedBuffers();
|
||||||
checkNotNull(defaultShaderProgram).drawFrame(inputTexture.getTexId(), presentationTimeUs);
|
checkNotNull(defaultShaderProgram).drawFrame(inputTexture.texId, presentationTimeUs);
|
||||||
long syncObject = GlUtil.createGlSyncFence();
|
long syncObject = GlUtil.createGlSyncFence();
|
||||||
syncObjects.add(syncObject);
|
syncObjects.add(syncObject);
|
||||||
checkNotNull(textureOutputListener)
|
checkNotNull(textureOutputListener)
|
||||||
@ -534,10 +533,10 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
int configuredColorTransfer = defaultShaderProgram.getOutputColorTransfer();
|
int configuredColorTransfer = defaultShaderProgram.getOutputColorTransfer();
|
||||||
defaultShaderProgram.setOutputColorTransfer(
|
defaultShaderProgram.setOutputColorTransfer(
|
||||||
debugSurfaceViewWrapper.outputColorTransfer);
|
debugSurfaceViewWrapper.outputColorTransfer);
|
||||||
defaultShaderProgram.drawFrame(inputTexture.getTexId(), presentationTimeUs);
|
defaultShaderProgram.drawFrame(inputTexture.texId, presentationTimeUs);
|
||||||
defaultShaderProgram.setOutputColorTransfer(configuredColorTransfer);
|
defaultShaderProgram.setOutputColorTransfer(configuredColorTransfer);
|
||||||
} else {
|
} else {
|
||||||
defaultShaderProgram.drawFrame(inputTexture.getTexId(), presentationTimeUs);
|
defaultShaderProgram.drawFrame(inputTexture.texId, presentationTimeUs);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
glObjectsProvider);
|
glObjectsProvider);
|
||||||
|
@ -69,7 +69,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
videoFrameProcessingTaskExecutor.submit(
|
videoFrameProcessingTaskExecutor.submit(
|
||||||
() ->
|
() ->
|
||||||
checkNotNull(frameProcessedListener)
|
checkNotNull(frameProcessedListener)
|
||||||
.onInputFrameProcessed(inputTexture.getTexId(), GlUtil.createGlSyncFence()));
|
.onInputFrameProcessed(inputTexture.texId, GlUtil.createGlSyncFence()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -77,7 +77,7 @@ import java.util.Queue;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GlTextureInfo texture = getIteratorToAllTextures().next();
|
GlTextureInfo texture = getIteratorToAllTextures().next();
|
||||||
if (texture.getWidth() != width || texture.getHeight() != height) {
|
if (texture.width != width || texture.height != height) {
|
||||||
deleteAllTextures();
|
deleteAllTextures();
|
||||||
createTextures(glObjectsProvider, width, height);
|
createTextures(glObjectsProvider, width, height);
|
||||||
}
|
}
|
||||||
@ -100,8 +100,6 @@ import java.util.Queue;
|
|||||||
* <p>Throws {@link IllegalStateException} if {@code textureInfo} isn't in use.
|
* <p>Throws {@link IllegalStateException} if {@code textureInfo} isn't in use.
|
||||||
*/
|
*/
|
||||||
public void freeTexture(GlTextureInfo textureInfo) {
|
public void freeTexture(GlTextureInfo textureInfo) {
|
||||||
// TODO(b/262694346): Check before adding to freeTexture, that this texture wasn't released
|
|
||||||
// already.
|
|
||||||
checkState(inUseTextures.contains(textureInfo));
|
checkState(inUseTextures.contains(textureInfo));
|
||||||
inUseTextures.remove(textureInfo);
|
inUseTextures.remove(textureInfo);
|
||||||
freeTextures.add(textureInfo);
|
freeTextures.add(textureInfo);
|
||||||
@ -113,8 +111,6 @@ import java.util.Queue;
|
|||||||
* <p>Throws {@link IllegalStateException} if there's no textures in use to free.
|
* <p>Throws {@link IllegalStateException} if there's no textures in use to free.
|
||||||
*/
|
*/
|
||||||
public void freeTexture() {
|
public void freeTexture() {
|
||||||
// TODO(b/262694346): Check before adding to freeTexture, that this texture wasn't released
|
|
||||||
// already.
|
|
||||||
checkState(!inUseTextures.isEmpty());
|
checkState(!inUseTextures.isEmpty());
|
||||||
GlTextureInfo texture = inUseTextures.remove();
|
GlTextureInfo texture = inUseTextures.remove();
|
||||||
freeTextures.add(texture);
|
freeTextures.add(texture);
|
||||||
@ -122,8 +118,6 @@ import java.util.Queue;
|
|||||||
|
|
||||||
/** Free all in-use textures. */
|
/** Free all in-use textures. */
|
||||||
public void freeAllTextures() {
|
public void freeAllTextures() {
|
||||||
// TODO(b/262694346): Check before adding to freeTexture, that this texture wasn't released
|
|
||||||
// already.
|
|
||||||
freeTextures.addAll(inUseTextures);
|
freeTextures.addAll(inUseTextures);
|
||||||
inUseTextures.clear();
|
inUseTextures.clear();
|
||||||
}
|
}
|
||||||
|
@ -132,11 +132,11 @@ public final class VideoCompositor {
|
|||||||
// * Allow different frame dimensions.
|
// * Allow different frame dimensions.
|
||||||
InputFrameInfo inputFrame1 = framesToComposite.get(0);
|
InputFrameInfo inputFrame1 = framesToComposite.get(0);
|
||||||
InputFrameInfo inputFrame2 = framesToComposite.get(1);
|
InputFrameInfo inputFrame2 = framesToComposite.get(1);
|
||||||
checkState(inputFrame1.texture.getWidth() == inputFrame2.texture.getWidth());
|
checkState(inputFrame1.texture.width == inputFrame2.texture.width);
|
||||||
checkState(inputFrame1.texture.getHeight() == inputFrame2.texture.getHeight());
|
checkState(inputFrame1.texture.height == inputFrame2.texture.height);
|
||||||
try {
|
try {
|
||||||
outputTexturePool.ensureConfigured(
|
outputTexturePool.ensureConfigured(
|
||||||
glObjectsProvider, inputFrame1.texture.getWidth(), inputFrame1.texture.getHeight());
|
glObjectsProvider, inputFrame1.texture.width, inputFrame1.texture.height);
|
||||||
GlTextureInfo outputTexture = outputTexturePool.useTexture();
|
GlTextureInfo outputTexture = outputTexturePool.useTexture();
|
||||||
|
|
||||||
drawFrame(inputFrame1.texture, inputFrame2.texture, outputTexture);
|
drawFrame(inputFrame1.texture, inputFrame2.texture, outputTexture);
|
||||||
@ -177,15 +177,13 @@ public final class VideoCompositor {
|
|||||||
GlTextureInfo inputTexture1, GlTextureInfo inputTexture2, GlTextureInfo outputTexture)
|
GlTextureInfo inputTexture1, GlTextureInfo inputTexture2, GlTextureInfo outputTexture)
|
||||||
throws GlUtil.GlException {
|
throws GlUtil.GlException {
|
||||||
GlUtil.focusFramebufferUsingCurrentContext(
|
GlUtil.focusFramebufferUsingCurrentContext(
|
||||||
outputTexture.getFboId(), outputTexture.getWidth(), outputTexture.getHeight());
|
outputTexture.fboId, outputTexture.width, outputTexture.height);
|
||||||
GlUtil.clearFocusedBuffers();
|
GlUtil.clearFocusedBuffers();
|
||||||
|
|
||||||
GlProgram glProgram = checkNotNull(this.glProgram);
|
GlProgram glProgram = checkNotNull(this.glProgram);
|
||||||
glProgram.use();
|
glProgram.use();
|
||||||
glProgram.setSamplerTexIdUniform(
|
glProgram.setSamplerTexIdUniform("uTexSampler1", inputTexture1.texId, /* texUnitIndex= */ 0);
|
||||||
"uTexSampler1", inputTexture1.getTexId(), /* texUnitIndex= */ 0);
|
glProgram.setSamplerTexIdUniform("uTexSampler2", inputTexture2.texId, /* texUnitIndex= */ 1);
|
||||||
glProgram.setSamplerTexIdUniform(
|
|
||||||
"uTexSampler2", inputTexture2.getTexId(), /* texUnitIndex= */ 1);
|
|
||||||
|
|
||||||
glProgram.setFloatsUniform("uTexTransformationMatrix", GlUtil.create4x4IdentityMatrix());
|
glProgram.setFloatsUniform("uTexTransformationMatrix", GlUtil.create4x4IdentityMatrix());
|
||||||
glProgram.setFloatsUniform("uTransformationMatrix", GlUtil.create4x4IdentityMatrix());
|
glProgram.setFloatsUniform("uTransformationMatrix", GlUtil.create4x4IdentityMatrix());
|
||||||
|
@ -353,7 +353,7 @@ public final class VideoFrameProcessorTestRunner {
|
|||||||
|
|
||||||
public void queueInputTexture(GlTextureInfo inputTexture, long pts) {
|
public void queueInputTexture(GlTextureInfo inputTexture, long pts) {
|
||||||
videoFrameProcessor.setInputFrameInfo(
|
videoFrameProcessor.setInputFrameInfo(
|
||||||
new FrameInfo.Builder(inputTexture.getWidth(), inputTexture.getHeight())
|
new FrameInfo.Builder(inputTexture.width, inputTexture.height)
|
||||||
.setPixelWidthHeightRatio(pixelWidthHeightRatio)
|
.setPixelWidthHeightRatio(pixelWidthHeightRatio)
|
||||||
.build());
|
.build());
|
||||||
videoFrameProcessor.setOnInputFrameProcessedListener(
|
videoFrameProcessor.setOnInputFrameProcessedListener(
|
||||||
@ -365,7 +365,7 @@ public final class VideoFrameProcessorTestRunner {
|
|||||||
throw new VideoFrameProcessingException(e);
|
throw new VideoFrameProcessingException(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
videoFrameProcessor.queueInputTexture(inputTexture.getTexId(), pts);
|
videoFrameProcessor.queueInputTexture(inputTexture.texId, pts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@link #endFrameProcessing(long)} with {@link #VIDEO_FRAME_PROCESSING_WAIT_MS} applied. */
|
/** {@link #endFrameProcessing(long)} with {@link #VIDEO_FRAME_PROCESSING_WAIT_MS} applied. */
|
||||||
|
@ -73,10 +73,10 @@ public final class TextureBitmapReader implements VideoFrameProcessorTestRunner.
|
|||||||
throws VideoFrameProcessingException {
|
throws VideoFrameProcessingException {
|
||||||
try {
|
try {
|
||||||
GlUtil.focusFramebufferUsingCurrentContext(
|
GlUtil.focusFramebufferUsingCurrentContext(
|
||||||
outputTexture.getFboId(), outputTexture.getWidth(), outputTexture.getHeight());
|
outputTexture.fboId, outputTexture.width, outputTexture.height);
|
||||||
outputBitmap =
|
outputBitmap =
|
||||||
createBitmapFromCurrentGlFrameBuffer(
|
createBitmapFromCurrentGlFrameBuffer(
|
||||||
outputTexture.getWidth(), outputTexture.getHeight(), useHighPrecisionColorComponents);
|
outputTexture.width, outputTexture.height, useHighPrecisionColorComponents);
|
||||||
outputTimestampsToBitmaps.put(presentationTimeUs, outputBitmap);
|
outputTimestampsToBitmaps.put(presentationTimeUs, outputBitmap);
|
||||||
} catch (GlUtil.GlException e) {
|
} catch (GlUtil.GlException e) {
|
||||||
throw new VideoFrameProcessingException(e);
|
throw new VideoFrameProcessingException(e);
|
||||||
|
@ -128,7 +128,7 @@ public final class VideoCompositorPixelTest {
|
|||||||
}
|
}
|
||||||
compositedOutputBitmap.set(
|
compositedOutputBitmap.set(
|
||||||
BitmapPixelTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(
|
BitmapPixelTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(
|
||||||
outputTexture.getWidth(), outputTexture.getHeight()));
|
outputTexture.width, outputTexture.height));
|
||||||
} catch (GlUtil.GlException e) {
|
} catch (GlUtil.GlException e) {
|
||||||
throw VideoFrameProcessingException.from(e);
|
throw VideoFrameProcessingException.from(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user