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

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

Issue 1466133002: Android SurfaceViewRenderer: Make sure not to call eglCreateSurface() twice (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | 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,
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 /** 167 /**
168 * Create and make an EGLSurface current if both init() and surfaceCreated() h ave been called. 168 * Create and make an EGLSurface current if both init() and surfaceCreated() h ave been called.
169 */ 169 */
170 public void tryCreateEglSurface() { 170 public void tryCreateEglSurface() {
171 // |renderThreadHandler| is only created after |eglBase| is created in init( ), so the 171 // |renderThreadHandler| is only created after |eglBase| is created in init( ), so the
172 // following code will only execute if eglBase != null. 172 // following code will only execute if eglBase != null.
173 runOnRenderThread(new Runnable() { 173 runOnRenderThread(new Runnable() {
174 @Override public void run() { 174 @Override public void run() {
175 synchronized (layoutLock) { 175 synchronized (layoutLock) {
176 if (isSurfaceCreated) { 176 if (isSurfaceCreated && !eglBase.hasSurface()) {
177 eglBase.createSurface(getHolder().getSurface()); 177 eglBase.createSurface(getHolder().getSurface());
178 eglBase.makeCurrent(); 178 eglBase.makeCurrent();
179 // Necessary for YUV frames with odd width. 179 // Necessary for YUV frames with odd width.
180 GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1); 180 GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1);
181 } 181 }
182 } 182 }
183 } 183 }
184 }); 184 });
185 } 185 }
186 186
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 if (framesReceived > 0 && framesRendered > 0) { 538 if (framesReceived > 0 && framesRendered > 0) {
539 final long timeSinceFirstFrameNs = System.nanoTime() - firstFrameTimeNs; 539 final long timeSinceFirstFrameNs = System.nanoTime() - firstFrameTimeNs;
540 Logging.d(TAG, getResourceName() + "Duration: " + (int) (timeSinceFirstF rameNs / 1e6) + 540 Logging.d(TAG, getResourceName() + "Duration: " + (int) (timeSinceFirstF rameNs / 1e6) +
541 " ms. FPS: " + (float) framesRendered * 1e9 / timeSinceFirstFrameNs) ; 541 " ms. FPS: " + (float) framesRendered * 1e9 / timeSinceFirstFrameNs) ;
542 Logging.d(TAG, getResourceName() + "Average render time: " 542 Logging.d(TAG, getResourceName() + "Average render time: "
543 + (int) (renderTimeNs / (1000 * framesRendered)) + " us."); 543 + (int) (renderTimeNs / (1000 * framesRendered)) + " us.");
544 } 544 }
545 } 545 }
546 } 546 }
547 } 547 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698