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

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

Issue 1368093003: Android SurfaceTextureHelper: Don't wait for pending frames in disconnect() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased and added more comments 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
« no previous file with comments | « no previous file | talk/app/webrtc/java/android/org/webrtc/SurfaceTextureHelper.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 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,
11 * this list of conditions and the following disclaimer in the documentation 11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution. 12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products 13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
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 android.graphics.SurfaceTexture;
30 import android.opengl.EGL14; 31 import android.opengl.EGL14;
31 import android.opengl.EGLConfig; 32 import android.opengl.EGLConfig;
32 import android.opengl.EGLContext; 33 import android.opengl.EGLContext;
33 import android.opengl.EGLDisplay; 34 import android.opengl.EGLDisplay;
34 import android.opengl.EGLSurface; 35 import android.opengl.EGLSurface;
35 import android.view.Surface; 36 import android.view.Surface;
36 37
37 import org.webrtc.Logging; 38 import org.webrtc.Logging;
38 39
39 /** 40 /**
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // Create a new context with the specified config type, sharing data with shar edContext. 79 // Create a new context with the specified config type, sharing data with shar edContext.
79 public EglBase(EGLContext sharedContext, ConfigType configType) { 80 public EglBase(EGLContext sharedContext, ConfigType configType) {
80 this.configType = configType; 81 this.configType = configType;
81 eglDisplay = getEglDisplay(); 82 eglDisplay = getEglDisplay();
82 eglConfig = getEglConfig(eglDisplay, configType); 83 eglConfig = getEglConfig(eglDisplay, configType);
83 eglContext = createEglContext(sharedContext, eglDisplay, eglConfig); 84 eglContext = createEglContext(sharedContext, eglDisplay, eglConfig);
84 } 85 }
85 86
86 // Create EGLSurface from the Android Surface. 87 // Create EGLSurface from the Android Surface.
87 public void createSurface(Surface surface) { 88 public void createSurface(Surface surface) {
89 createSurfaceInternal(surface);
90 }
91
92 // Create EGLSurface from the Android SurfaceTexture.
93 public void createSurface(SurfaceTexture surfaceTexture) {
94 createSurfaceInternal(surfaceTexture);
95 }
96
97 // Create EGLSurface from either Surface or SurfaceTexture.
98 private void createSurfaceInternal(Object surface) {
99 if (!(surface instanceof Surface) && !(surface instanceof SurfaceTexture)) {
100 throw new IllegalStateException("Input must be either a Surface or Surface Texture");
101 }
88 checkIsNotReleased(); 102 checkIsNotReleased();
89 if (configType == ConfigType.PIXEL_BUFFER) { 103 if (configType == ConfigType.PIXEL_BUFFER) {
90 Logging.w(TAG, "This EGL context is configured for PIXEL_BUFFER, but uses regular Surface"); 104 Logging.w(TAG, "This EGL context is configured for PIXEL_BUFFER, but uses regular Surface");
91 } 105 }
92 if (eglSurface != EGL14.EGL_NO_SURFACE) { 106 if (eglSurface != EGL14.EGL_NO_SURFACE) {
93 throw new RuntimeException("Already has an EGLSurface"); 107 throw new RuntimeException("Already has an EGLSurface");
94 } 108 }
95 int[] surfaceAttribs = {EGL14.EGL_NONE}; 109 int[] surfaceAttribs = {EGL14.EGL_NONE};
96 eglSurface = EGL14.eglCreateWindowSurface(eglDisplay, eglConfig, surface, su rfaceAttribs, 0); 110 eglSurface = EGL14.eglCreateWindowSurface(eglDisplay, eglConfig, surface, su rfaceAttribs, 0);
97 if (eglSurface == EGL14.EGL_NO_SURFACE) { 111 if (eglSurface == EGL14.EGL_NO_SURFACE) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 EGLContext sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfig) { 261 EGLContext sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfig) {
248 int[] contextAttributes = {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NO NE}; 262 int[] contextAttributes = {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NO NE};
249 EGLContext eglContext = 263 EGLContext eglContext =
250 EGL14.eglCreateContext(eglDisplay, eglConfig, sharedContext, contextAttr ibutes, 0); 264 EGL14.eglCreateContext(eglDisplay, eglConfig, sharedContext, contextAttr ibutes, 0);
251 if (eglContext == EGL14.EGL_NO_CONTEXT) { 265 if (eglContext == EGL14.EGL_NO_CONTEXT) {
252 throw new RuntimeException("Failed to create EGL context"); 266 throw new RuntimeException("Failed to create EGL context");
253 } 267 }
254 return eglContext; 268 return eglContext;
255 } 269 }
256 } 270 }
OLDNEW
« no previous file with comments | « no previous file | talk/app/webrtc/java/android/org/webrtc/SurfaceTextureHelper.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698