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 1460703002: Implement AndroidTextureBuffer::NativeToI420. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Deleted unused variable Created 5 years 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 EGL10.EGL_NONE 80 EGL10.EGL_NONE
81 }; 81 };
82 public static final int[] CONFIG_PIXEL_BUFFER = { 82 public static final int[] CONFIG_PIXEL_BUFFER = {
83 EGL10.EGL_RED_SIZE, 8, 83 EGL10.EGL_RED_SIZE, 8,
84 EGL10.EGL_GREEN_SIZE, 8, 84 EGL10.EGL_GREEN_SIZE, 8,
85 EGL10.EGL_BLUE_SIZE, 8, 85 EGL10.EGL_BLUE_SIZE, 8,
86 EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, 86 EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
87 EGL10.EGL_SURFACE_TYPE, EGL10.EGL_PBUFFER_BIT, 87 EGL10.EGL_SURFACE_TYPE, EGL10.EGL_PBUFFER_BIT,
88 EGL10.EGL_NONE 88 EGL10.EGL_NONE
89 }; 89 };
90 public static final int[] CONFIG_PIXEL_RGBA_BUFFER = {
91 EGL10.EGL_RED_SIZE, 8,
92 EGL10.EGL_GREEN_SIZE, 8,
93 EGL10.EGL_BLUE_SIZE, 8,
94 EGL10.EGL_ALPHA_SIZE, 8,
95 EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
96 EGL10.EGL_SURFACE_TYPE, EGL10.EGL_PBUFFER_BIT,
97 EGL10.EGL_NONE
98 };
90 public static final int[] CONFIG_RECORDABLE = { 99 public static final int[] CONFIG_RECORDABLE = {
91 EGL10.EGL_RED_SIZE, 8, 100 EGL10.EGL_RED_SIZE, 8,
92 EGL10.EGL_GREEN_SIZE, 8, 101 EGL10.EGL_GREEN_SIZE, 8,
93 EGL10.EGL_BLUE_SIZE, 8, 102 EGL10.EGL_BLUE_SIZE, 8,
94 EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, 103 EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
95 EGL_RECORDABLE_ANDROID, 1, 104 EGL_RECORDABLE_ANDROID, 1,
96 EGL10.EGL_NONE 105 EGL10.EGL_NONE
97 }; 106 };
98 107
99 // Create a new context with the specified config attributes, sharing data wit h sharedContext. 108 // Create a new context with the specified config attributes, sharing data wit h sharedContext.
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 if (eglSurface != EGL10.EGL_NO_SURFACE) { 249 if (eglSurface != EGL10.EGL_NO_SURFACE) {
241 throw new RuntimeException("Already has an EGLSurface"); 250 throw new RuntimeException("Already has an EGLSurface");
242 } 251 }
243 int[] surfaceAttribs = {EGL10.EGL_WIDTH, width, EGL10.EGL_HEIGHT, height, EG L10.EGL_NONE}; 252 int[] surfaceAttribs = {EGL10.EGL_WIDTH, width, EGL10.EGL_HEIGHT, height, EG L10.EGL_NONE};
244 eglSurface = egl.eglCreatePbufferSurface(eglDisplay, eglConfig, surfaceAttri bs); 253 eglSurface = egl.eglCreatePbufferSurface(eglDisplay, eglConfig, surfaceAttri bs);
245 if (eglSurface == EGL10.EGL_NO_SURFACE) { 254 if (eglSurface == EGL10.EGL_NO_SURFACE) {
246 throw new RuntimeException("Failed to create pixel buffer surface"); 255 throw new RuntimeException("Failed to create pixel buffer surface");
247 } 256 }
248 } 257 }
249 258
259 // Ensure we have a pixel buffer surface of the right size.
260 public void withPbufferSurface(int width, int height) {
perkj_webrtc 2015/12/10 10:15:53 I would prefer if put this this helper method wher
nisse-webrtc 2015/12/10 12:14:56 I'll delete this method and inline the logic where
261 if (hasSurface()) {
262 if (surfaceWidth() == width &&
263 surfaceHeight() == height)
264 // We already have a surface, and of the right size.
265 return;
266
267 releaseSurface();
268 }
269 createPbufferSurface(width, height);
270 }
271
250 public Context getEglBaseContext() { 272 public Context getEglBaseContext() {
251 return new Context(eglContext); 273 return new Context(eglContext);
252 } 274 }
253 275
254 public boolean hasSurface() { 276 public boolean hasSurface() {
255 return eglSurface != EGL10.EGL_NO_SURFACE; 277 return eglSurface != EGL10.EGL_NO_SURFACE;
256 } 278 }
257 279
258 public int surfaceWidth() { 280 public int surfaceWidth() {
259 final int widthArray[] = new int[1]; 281 final int widthArray[] = new int[1];
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 EGLContext rootContext = 371 EGLContext rootContext =
350 sharedContext == null ? EGL10.EGL_NO_CONTEXT : sharedContext.eglContext; 372 sharedContext == null ? EGL10.EGL_NO_CONTEXT : sharedContext.eglContext;
351 EGLContext eglContext = 373 EGLContext eglContext =
352 egl.eglCreateContext(eglDisplay, eglConfig, rootContext, contextAttribut es); 374 egl.eglCreateContext(eglDisplay, eglConfig, rootContext, contextAttribut es);
353 if (eglContext == EGL10.EGL_NO_CONTEXT) { 375 if (eglContext == EGL10.EGL_NO_CONTEXT) {
354 throw new RuntimeException("Failed to create EGL context"); 376 throw new RuntimeException("Failed to create EGL context");
355 } 377 }
356 return eglContext; 378 return eglContext;
357 } 379 }
358 } 380 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698