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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // when the EGL context is lost. It might be dangerous to delete them manu
ally in | 199 // when the EGL context is lost. It might be dangerous to delete them manu
ally in |
200 // Activity.onDestroy(). | 200 // Activity.onDestroy(). |
201 renderThreadHandler.postAtFrontOfQueue(new Runnable() { | 201 renderThreadHandler.postAtFrontOfQueue(new Runnable() { |
202 @Override public void run() { | 202 @Override public void run() { |
203 drawer.release(); | 203 drawer.release(); |
204 drawer = null; | 204 drawer = null; |
205 if (yuvTextures != null) { | 205 if (yuvTextures != null) { |
206 GLES20.glDeleteTextures(3, yuvTextures, 0); | 206 GLES20.glDeleteTextures(3, yuvTextures, 0); |
207 yuvTextures = null; | 207 yuvTextures = null; |
208 } | 208 } |
209 // Clear last rendered image to black. | 209 if (eglBase.hasSurface()) { |
210 GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); | 210 // Clear last rendered image to black. |
211 eglBase.swapBuffers(); | 211 GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); |
| 212 eglBase.swapBuffers(); |
| 213 } |
212 eglBase.release(); | 214 eglBase.release(); |
213 eglBase = null; | 215 eglBase = null; |
214 } | 216 } |
215 }); | 217 }); |
216 // Don't accept any more frames or messages to the render thread. | 218 // Don't accept any more frames or messages to the render thread. |
217 renderThreadHandler = null; | 219 renderThreadHandler = null; |
218 } | 220 } |
219 // Quit safely to make sure the EGL/GL cleanup posted above is executed. | 221 // Quit safely to make sure the EGL/GL cleanup posted above is executed. |
220 renderThread.quitSafely(); | 222 renderThread.quitSafely(); |
221 synchronized (frameLock) { | 223 synchronized (frameLock) { |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 if (framesReceived > 0 && framesRendered > 0) { | 511 if (framesReceived > 0 && framesRendered > 0) { |
510 final long timeSinceFirstFrameNs = System.nanoTime() - firstFrameTimeNs; | 512 final long timeSinceFirstFrameNs = System.nanoTime() - firstFrameTimeNs; |
511 Logging.d(TAG, "Duration: " + (int) (timeSinceFirstFrameNs / 1e6) + | 513 Logging.d(TAG, "Duration: " + (int) (timeSinceFirstFrameNs / 1e6) + |
512 " ms. FPS: " + (float) framesRendered * 1e9 / timeSinceFirstFrameNs)
; | 514 " ms. FPS: " + (float) framesRendered * 1e9 / timeSinceFirstFrameNs)
; |
513 Logging.d(TAG, "Average render time: " | 515 Logging.d(TAG, "Average render time: " |
514 + (int) (renderTimeNs / (1000 * framesRendered)) + " us."); | 516 + (int) (renderTimeNs / (1000 * framesRendered)) + " us."); |
515 } | 517 } |
516 } | 518 } |
517 } | 519 } |
518 } | 520 } |
OLD | NEW |