OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |