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

Side by Side Diff: talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java

Issue 1396013004: Android: Replace EGL14 with EGL10 (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add comments for hardcoded EGL constants Created 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 13 matching lines...) Expand all
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 package org.webrtc; 28 package org.webrtc;
29 29
30 import java.util.ArrayList; 30 import java.util.ArrayList;
31 import java.util.concurrent.CountDownLatch; 31 import java.util.concurrent.CountDownLatch;
32 32
33 import javax.microedition.khronos.egl.EGLConfig; 33 import javax.microedition.khronos.egl.EGLConfig;
34 import javax.microedition.khronos.egl.EGL10;
35 import javax.microedition.khronos.egl.EGLContext;
34 import javax.microedition.khronos.opengles.GL10; 36 import javax.microedition.khronos.opengles.GL10;
35 37
36 import android.annotation.SuppressLint; 38 import android.annotation.SuppressLint;
37 import android.graphics.Point; 39 import android.graphics.Point;
38 import android.graphics.Rect; 40 import android.graphics.Rect;
39 import android.graphics.SurfaceTexture; 41 import android.graphics.SurfaceTexture;
40 import android.opengl.EGL14;
41 import android.opengl.EGLContext;
42 import android.opengl.GLES20; 42 import android.opengl.GLES20;
43 import android.opengl.GLSurfaceView; 43 import android.opengl.GLSurfaceView;
44 44
45 import org.webrtc.Logging; 45 import org.webrtc.Logging;
46 import org.webrtc.VideoRenderer.I420Frame; 46 import org.webrtc.VideoRenderer.I420Frame;
47 47
48 /** 48 /**
49 * Efficiently renders YUV frames using the GPU for CSC. 49 * Efficiently renders YUV frames using the GPU for CSC.
50 * Clients will want first to call setView() to pass GLSurfaceView 50 * Clients will want first to call setView() to pass GLSurfaceView
51 * and then for each video stream either create instance of VideoRenderer using 51 * and then for each video stream either create instance of VideoRenderer using
(...skipping 12 matching lines...) Expand all
64 // If true then for every newly created yuv image renderer createTexture() 64 // If true then for every newly created yuv image renderer createTexture()
65 // should be called. The variable is accessed on multiple threads and 65 // should be called. The variable is accessed on multiple threads and
66 // all accesses are synchronized on yuvImageRenderers' object lock. 66 // all accesses are synchronized on yuvImageRenderers' object lock.
67 private boolean onSurfaceCreatedCalled; 67 private boolean onSurfaceCreatedCalled;
68 private int screenWidth; 68 private int screenWidth;
69 private int screenHeight; 69 private int screenHeight;
70 // List of yuv renderers. 70 // List of yuv renderers.
71 private final ArrayList<YuvImageRenderer> yuvImageRenderers; 71 private final ArrayList<YuvImageRenderer> yuvImageRenderers;
72 // |drawer| is synchronized on |yuvImageRenderers|. 72 // |drawer| is synchronized on |yuvImageRenderers|.
73 private GlRectDrawer drawer; 73 private GlRectDrawer drawer;
74 private static final int EGL14_SDK_VERSION =
75 android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
76 // Current SDK version.
77 private static final int CURRENT_SDK_VERSION =
78 android.os.Build.VERSION.SDK_INT;
79 // Render and draw threads. 74 // Render and draw threads.
80 private static Thread renderFrameThread; 75 private static Thread renderFrameThread;
81 private static Thread drawThread; 76 private static Thread drawThread;
82 77
83 private VideoRendererGui(GLSurfaceView surface) { 78 private VideoRendererGui(GLSurfaceView surface) {
84 this.surface = surface; 79 this.surface = surface;
85 // Create an OpenGL ES 2.0 context. 80 // Create an OpenGL ES 2.0 context.
86 surface.setPreserveEGLContextOnPause(true); 81 surface.setPreserveEGLContextOnPause(true);
87 surface.setEGLContextClientVersion(2); 82 surface.setEGLContextClientVersion(2);
88 surface.setRenderer(this); 83 surface.setRenderer(this);
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 } 600 }
606 printStackTrace(renderFrameThread, "Render frame thread"); 601 printStackTrace(renderFrameThread, "Render frame thread");
607 printStackTrace(drawThread, "Draw thread"); 602 printStackTrace(drawThread, "Draw thread");
608 } 603 }
609 604
610 @SuppressLint("NewApi") 605 @SuppressLint("NewApi")
611 @Override 606 @Override
612 public void onSurfaceCreated(GL10 unused, EGLConfig config) { 607 public void onSurfaceCreated(GL10 unused, EGLConfig config) {
613 Logging.d(TAG, "VideoRendererGui.onSurfaceCreated"); 608 Logging.d(TAG, "VideoRendererGui.onSurfaceCreated");
614 // Store render EGL context. 609 // Store render EGL context.
615 if (CURRENT_SDK_VERSION >= EGL14_SDK_VERSION) { 610 synchronized (VideoRendererGui.class) {
616 synchronized (VideoRendererGui.class) { 611 eglContext = ((EGL10) EGLContext.getEGL()).eglGetCurrentContext();
617 eglContext = EGL14.eglGetCurrentContext(); 612 Logging.d(TAG, "VideoRendererGui EGL Context: " + eglContext);
618 Logging.d(TAG, "VideoRendererGui EGL Context: " + eglContext);
619 }
620 } 613 }
621 614
622 synchronized (yuvImageRenderers) { 615 synchronized (yuvImageRenderers) {
623 // Create drawer for YUV/OES frames. 616 // Create drawer for YUV/OES frames.
624 drawer = new GlRectDrawer(); 617 drawer = new GlRectDrawer();
625 // Create textures for all images. 618 // Create textures for all images.
626 for (YuvImageRenderer yuvImageRenderer : yuvImageRenderers) { 619 for (YuvImageRenderer yuvImageRenderer : yuvImageRenderers) {
627 yuvImageRenderer.createTextures(); 620 yuvImageRenderer.createTextures();
628 } 621 }
629 onSurfaceCreatedCalled = true; 622 onSurfaceCreatedCalled = true;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 GLES20.glViewport(0, 0, screenWidth, screenHeight); 654 GLES20.glViewport(0, 0, screenWidth, screenHeight);
662 GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); 655 GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
663 synchronized (yuvImageRenderers) { 656 synchronized (yuvImageRenderers) {
664 for (YuvImageRenderer yuvImageRenderer : yuvImageRenderers) { 657 for (YuvImageRenderer yuvImageRenderer : yuvImageRenderers) {
665 yuvImageRenderer.draw(drawer); 658 yuvImageRenderer.draw(drawer);
666 } 659 }
667 } 660 }
668 } 661 }
669 662
670 } 663 }
OLDNEW
« no previous file with comments | « talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java ('k') | talk/app/webrtc/java/jni/androidmediadecoder_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698