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

Unified Diff: talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java

Issue 1303373005: Android GlUtil: Add helper functions generateTexture/deleteTexture (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: addressing hbos@ comments Created 5 years, 3 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
Index: talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java
diff --git a/talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java b/talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java
index ffda916cbdaa1fd09c903919e1cbe3f9b69c808d..aeb5418f75451c571a87fe1a4ffd7c094a8ccd35 100644
--- a/talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java
+++ b/talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java
@@ -81,7 +81,7 @@ public class VideoCapturerAndroid extends VideoCapturer implements PreviewCallba
private int id;
private Camera.CameraInfo info;
private SurfaceTexture cameraSurfaceTexture;
- private int[] cameraGlTextures = null;
+ private int cameraGlTexture = 0;
private final FramePool videoBuffers = new FramePool();
// Remember the requested format in case we want to switch cameras.
private int requestedWidth;
@@ -323,23 +323,8 @@ public class VideoCapturerAndroid extends VideoCapturer implements PreviewCallba
// it over to Camera, but never listen for frame-ready callbacks,
// and never call updateTexImage on it.
try {
- cameraSurfaceTexture = null;
-
- cameraGlTextures = new int[1];
- // Generate one texture pointer and bind it as an external texture.
- GLES20.glGenTextures(1, cameraGlTextures, 0);
- GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
- cameraGlTextures[0]);
- GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
- GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
- GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
- GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
- GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
- GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
- GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
- GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
-
- cameraSurfaceTexture = new SurfaceTexture(cameraGlTextures[0]);
+ cameraGlTexture = GlUtil.generateTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES);
+ cameraSurfaceTexture = new SurfaceTexture(cameraGlTexture);
cameraSurfaceTexture.setOnFrameAvailableListener(null);
camera.setPreviewTexture(cameraSurfaceTexture);
@@ -473,11 +458,10 @@ public class VideoCapturerAndroid extends VideoCapturer implements PreviewCallba
camera.setPreviewTexture(null);
cameraSurfaceTexture = null;
- if (cameraGlTextures != null) {
- GLES20.glDeleteTextures(1, cameraGlTextures, 0);
- cameraGlTextures = null;
+ if (cameraGlTexture != 0) {
+ GLES20.glDeleteTextures(1, new int[] {cameraGlTexture}, 0);
hbos 2015/09/02 11:10:38 Optional: the hbos@ style guide is "new int[] { ca
magjed_webrtc 2015/09/02 11:50:14 4.6.2 Horizontal whitespace ... 8. Optional just
+ cameraGlTexture = 0;
}
-
Log.d(TAG, "Release camera.");
camera.release();
camera = null;

Powered by Google App Engine
This is Rietveld 408576698