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

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

Issue 1338033003: Log to webrtc logging stream from java code. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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 unified diff | Download patch
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,
(...skipping 14 matching lines...) Expand all
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.opengl.EGL14; 30 import android.opengl.EGL14;
31 import android.opengl.EGLConfig; 31 import android.opengl.EGLConfig;
32 import android.opengl.EGLContext; 32 import android.opengl.EGLContext;
33 import android.opengl.EGLDisplay; 33 import android.opengl.EGLDisplay;
34 import android.opengl.EGLSurface; 34 import android.opengl.EGLSurface;
35 import android.util.Log;
36 import android.view.Surface; 35 import android.view.Surface;
37 36
37 import org.webrtc.Logging;
38
38 /** 39 /**
39 * Holds EGL state and utility methods for handling an EGLContext, an EGLDisplay , and an EGLSurface. 40 * Holds EGL state and utility methods for handling an EGLContext, an EGLDisplay , and an EGLSurface.
40 */ 41 */
41 public final class EglBase { 42 public final class EglBase {
42 private static final String TAG = "EglBase"; 43 private static final String TAG = "EglBase";
43 private static final int EGL14_SDK_VERSION = android.os.Build.VERSION_CODES.JE LLY_BEAN_MR1; 44 private static final int EGL14_SDK_VERSION = android.os.Build.VERSION_CODES.JE LLY_BEAN_MR1;
44 private static final int CURRENT_SDK_VERSION = android.os.Build.VERSION.SDK_IN T; 45 private static final int CURRENT_SDK_VERSION = android.os.Build.VERSION.SDK_IN T;
45 // Android-specific extension. 46 // Android-specific extension.
46 private static final int EGL_RECORDABLE_ANDROID = 0x3142; 47 private static final int EGL_RECORDABLE_ANDROID = 0x3142;
47 48
48 private EGLContext eglContext; 49 private EGLContext eglContext;
49 private ConfigType configType; 50 private ConfigType configType;
50 private EGLConfig eglConfig; 51 private EGLConfig eglConfig;
51 private EGLDisplay eglDisplay; 52 private EGLDisplay eglDisplay;
52 private EGLSurface eglSurface = EGL14.EGL_NO_SURFACE; 53 private EGLSurface eglSurface = EGL14.EGL_NO_SURFACE;
53 54
54 public static boolean isEGL14Supported() { 55 public static boolean isEGL14Supported() {
55 Log.d(TAG, "SDK version: " + CURRENT_SDK_VERSION); 56 Logging.d(TAG, "SDK version: " + CURRENT_SDK_VERSION);
56 return (CURRENT_SDK_VERSION >= EGL14_SDK_VERSION); 57 return (CURRENT_SDK_VERSION >= EGL14_SDK_VERSION);
57 } 58 }
58 59
59 // EGLConfig constructor type. Influences eglChooseConfig arguments. 60 // EGLConfig constructor type. Influences eglChooseConfig arguments.
60 public static enum ConfigType { 61 public static enum ConfigType {
61 // No special parameters. 62 // No special parameters.
62 PLAIN, 63 PLAIN,
63 // Configures with EGL_SURFACE_TYPE = EGL_PBUFFER_BIT. 64 // Configures with EGL_SURFACE_TYPE = EGL_PBUFFER_BIT.
64 PIXEL_BUFFER, 65 PIXEL_BUFFER,
65 // Configures with EGL_RECORDABLE_ANDROID = 1. 66 // Configures with EGL_RECORDABLE_ANDROID = 1.
(...skipping 13 matching lines...) Expand all
79 this.configType = configType; 80 this.configType = configType;
80 eglDisplay = getEglDisplay(); 81 eglDisplay = getEglDisplay();
81 eglConfig = getEglConfig(eglDisplay, configType); 82 eglConfig = getEglConfig(eglDisplay, configType);
82 eglContext = createEglContext(sharedContext, eglDisplay, eglConfig); 83 eglContext = createEglContext(sharedContext, eglDisplay, eglConfig);
83 } 84 }
84 85
85 // Create EGLSurface from the Android Surface. 86 // Create EGLSurface from the Android Surface.
86 public void createSurface(Surface surface) { 87 public void createSurface(Surface surface) {
87 checkIsNotReleased(); 88 checkIsNotReleased();
88 if (configType == ConfigType.PIXEL_BUFFER) { 89 if (configType == ConfigType.PIXEL_BUFFER) {
89 Log.w(TAG, "This EGL context is configured for PIXEL_BUFFER, but uses regu lar Surface"); 90 Logging.w(TAG, "This EGL context is configured for PIXEL_BUFFER, but uses regular Surface");
90 } 91 }
91 if (eglSurface != EGL14.EGL_NO_SURFACE) { 92 if (eglSurface != EGL14.EGL_NO_SURFACE) {
92 throw new RuntimeException("Already has an EGLSurface"); 93 throw new RuntimeException("Already has an EGLSurface");
93 } 94 }
94 int[] surfaceAttribs = {EGL14.EGL_NONE}; 95 int[] surfaceAttribs = {EGL14.EGL_NONE};
95 eglSurface = EGL14.eglCreateWindowSurface(eglDisplay, eglConfig, surface, su rfaceAttribs, 0); 96 eglSurface = EGL14.eglCreateWindowSurface(eglDisplay, eglConfig, surface, su rfaceAttribs, 0);
96 if (eglSurface == EGL14.EGL_NO_SURFACE) { 97 if (eglSurface == EGL14.EGL_NO_SURFACE) {
97 throw new RuntimeException("Failed to create window surface"); 98 throw new RuntimeException("Failed to create window surface");
98 } 99 }
99 } 100 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 EGLContext sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfig) { 247 EGLContext sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfig) {
247 int[] contextAttributes = {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NO NE}; 248 int[] contextAttributes = {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NO NE};
248 EGLContext eglContext = 249 EGLContext eglContext =
249 EGL14.eglCreateContext(eglDisplay, eglConfig, sharedContext, contextAttr ibutes, 0); 250 EGL14.eglCreateContext(eglDisplay, eglConfig, sharedContext, contextAttr ibutes, 0);
250 if (eglContext == EGL14.EGL_NO_CONTEXT) { 251 if (eglContext == EGL14.EGL_NO_CONTEXT) {
251 throw new RuntimeException("Failed to create EGL context"); 252 throw new RuntimeException("Failed to create EGL context");
252 } 253 }
253 return eglContext; 254 return eglContext;
254 } 255 }
255 } 256 }
OLDNEW
« no previous file with comments | « talk/app/webrtc/java/android/org/webrtc/CameraEnumerator.java ('k') | talk/app/webrtc/java/android/org/webrtc/GlShader.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698