This commit is contained in:
Romain Vimont 2025-01-07 22:01:12 +01:00
commit 139b3e688a
2 changed files with 18 additions and 8 deletions

View file

@ -193,14 +193,20 @@ public final class OpenGLRunner {
filter.init(); filter.init();
surfaceTexture.setOnFrameAvailableListener(surfaceTexture -> { Runnable runnable = new Runnable() {
if (stopped) { @Override public void run() {
// Make sure to never render after resources have been released if (stopped) {
return; // Make sure to never render after resources have been released
} return;
}
render(outputSize); render(outputSize);
}, handler);
handler.postDelayed(this, 15);
}
};
handler.post(runnable);
} }
private void render(Size outputSize) { private void render(Size outputSize) {
@ -219,7 +225,7 @@ public final class OpenGLRunner {
filter.draw(textureId, matrix); filter.draw(textureId, matrix);
EGLExt.eglPresentationTimeANDROID(eglDisplay, eglSurface, surfaceTexture.getTimestamp()); //EGLExt.eglPresentationTimeANDROID(eglDisplay, eglSurface, surfaceTexture.getTimestamp());
EGL14.eglSwapBuffers(eglDisplay, eglSurface); EGL14.eglSwapBuffers(eglDisplay, eglSurface);
} }

View file

@ -111,6 +111,10 @@ public class ScreenCapture extends SurfaceCapture {
virtualDisplay = null; virtualDisplay = null;
} }
if (transform == null) {
transform = AffineMatrix.IDENTITY;
}
Size inputSize; Size inputSize;
if (transform != null) { if (transform != null) {
// If there is a filter, it must receive the full display content // If there is a filter, it must receive the full display content