Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: webrtc/api/android/java/src/org/webrtc/SurfaceTextureHelper.java

Issue 2436653003: Android YuvConverter: Use OpenGL Framebuffer instead of EGL pixel buffer (Closed)
Patch Set: Rebase against VideoFileRenderer Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/api/android/java/src/org/webrtc/VideoFileRenderer.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/android/java/src/org/webrtc/SurfaceTextureHelper.java
diff --git a/webrtc/api/android/java/src/org/webrtc/SurfaceTextureHelper.java b/webrtc/api/android/java/src/org/webrtc/SurfaceTextureHelper.java
index e7c767b057ef90dcb18f3eea6b6f18618861a581..48a57bca5e08920efaf28b4149b2ae42114c46a3 100644
--- a/webrtc/api/android/java/src/org/webrtc/SurfaceTextureHelper.java
+++ b/webrtc/api/android/java/src/org/webrtc/SurfaceTextureHelper.java
@@ -134,18 +134,6 @@ class SurfaceTextureHelper {
});
}
- private YuvConverter getYuvConverter() {
- // yuvConverter is assigned once
- if (yuvConverter != null)
- return yuvConverter;
-
- synchronized (this) {
- if (yuvConverter == null)
- yuvConverter = new YuvConverter(eglBase.getEglBaseContext());
- return yuvConverter;
- }
- }
-
/**
* Start to stream textures to the given |listener|. If you need to change listener, you need to
* call stopListening() first.
@@ -231,12 +219,21 @@ class SurfaceTextureHelper {
});
}
- public void textureToYUV(
- ByteBuffer buf, int width, int height, int stride, int textureId, float[] transformMatrix) {
- if (textureId != oesTextureId)
+ public void textureToYUV(final ByteBuffer buf, final int width, final int height,
+ final int stride, final int textureId, final float[] transformMatrix) {
+ if (textureId != oesTextureId) {
throw new IllegalStateException("textureToByteBuffer called with unexpected textureId");
+ }
- getYuvConverter().convert(buf, width, height, stride, textureId, transformMatrix);
+ ThreadUtils.invokeAtFrontUninterruptibly(handler, new Runnable() {
+ @Override
+ public void run() {
+ if (yuvConverter == null) {
+ yuvConverter = new YuvConverter();
+ }
+ yuvConverter.convert(buf, width, height, stride, textureId, transformMatrix);
+ }
+ });
}
private void updateTexImage() {
@@ -275,9 +272,8 @@ class SurfaceTextureHelper {
if (isTextureInUse || !isQuitting) {
throw new IllegalStateException("Unexpected release.");
}
- synchronized (this) {
- if (yuvConverter != null)
- yuvConverter.release();
+ if (yuvConverter != null) {
+ yuvConverter.release();
}
GLES20.glDeleteTextures(1, new int[] {oesTextureId}, 0);
surfaceTexture.release();
« no previous file with comments | « no previous file | webrtc/api/android/java/src/org/webrtc/VideoFileRenderer.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698