mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
TextureInput: Advise client to delete syncObject after use
PiperOrigin-RevId: 544670927
This commit is contained in:
parent
58180a0f2a
commit
6f9731ce7e
@ -27,7 +27,8 @@ public interface OnInputFrameProcessedListener {
|
||||
* @param textureId The identifier of the processed texture.
|
||||
* @param syncObject A GL sync object that has been inserted into the GL command stream after the
|
||||
* last write of texture. Value is 0 if and only if the {@code GLES30#glFenceSync} failed or
|
||||
* the EGL context version is less than openGL 3.0.
|
||||
* the EGL context version is less than openGL 3.0. The sync object must be {@link
|
||||
* androidx.media3.common.util.GlUtil#deleteSyncObject deleted} after use.
|
||||
*/
|
||||
void onInputFrameProcessed(int textureId, long syncObject) throws VideoFrameProcessingException;
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
|
||||
private @MonotonicNonNull OnInputFrameProcessedListener frameProcessedListener;
|
||||
private @MonotonicNonNull FrameInfo inputFrameInfo;
|
||||
private long glSyncObject;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
@ -68,11 +67,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
@Override
|
||||
public void onInputFrameProcessed(GlTextureInfo inputTexture) {
|
||||
videoFrameProcessingTaskExecutor.submit(
|
||||
() -> {
|
||||
glSyncObject = GlUtil.createGlSyncFence();
|
||||
checkNotNull(frameProcessedListener)
|
||||
.onInputFrameProcessed(inputTexture.getTexId(), glSyncObject);
|
||||
});
|
||||
() ->
|
||||
checkNotNull(frameProcessedListener)
|
||||
.onInputFrameProcessed(inputTexture.getTexId(), GlUtil.createGlSyncFence()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,10 +125,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
|
||||
@Override
|
||||
public void release() throws VideoFrameProcessingException {
|
||||
try {
|
||||
GlUtil.deleteSyncObject(glSyncObject);
|
||||
} catch (GlUtil.GlException e) {
|
||||
throw new VideoFrameProcessingException(e);
|
||||
}
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
|
@ -354,9 +354,10 @@ public final class VideoFrameProcessorTestRunner {
|
||||
.setPixelWidthHeightRatio(pixelWidthHeightRatio)
|
||||
.build());
|
||||
videoFrameProcessor.setOnInputFrameProcessedListener(
|
||||
(texId, unused) -> {
|
||||
(texId, syncObject) -> {
|
||||
try {
|
||||
GlUtil.deleteTexture(texId);
|
||||
GlUtil.deleteSyncObject(syncObject);
|
||||
} catch (GlUtil.GlException e) {
|
||||
throw new VideoFrameProcessingException(e);
|
||||
}
|
||||
|
@ -503,9 +503,10 @@ public class TransformerEndToEndTest {
|
||||
EditedMediaItem editedMediaItem, Looper looper, AssetLoader.Listener listener) {
|
||||
Format format = new Format.Builder().setWidth(width).setHeight(height).build();
|
||||
OnInputFrameProcessedListener frameProcessedListener =
|
||||
(texId, unused) -> {
|
||||
(texId, syncObject) -> {
|
||||
try {
|
||||
GlUtil.deleteTexture(texId);
|
||||
GlUtil.deleteSyncObject(syncObject);
|
||||
} catch (GlUtil.GlException e) {
|
||||
throw new VideoFrameProcessingException(e);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user