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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 this.rendererEvents = rendererEvents; | 162 this.rendererEvents = rendererEvents; |
163 renderThread = new HandlerThread(TAG); | 163 renderThread = new HandlerThread(TAG); |
164 renderThread.start(); | 164 renderThread.start(); |
165 drawer = new GlRectDrawer(); | 165 drawer = new GlRectDrawer(); |
166 eglBase = EglBase.create(sharedContext, EglBase.CONFIG_PLAIN); | 166 eglBase = EglBase.create(sharedContext, EglBase.CONFIG_PLAIN); |
167 renderThreadHandler = new Handler(renderThread.getLooper()); | 167 renderThreadHandler = new Handler(renderThread.getLooper()); |
168 } | 168 } |
169 tryCreateEglSurface(); | 169 tryCreateEglSurface(); |
170 } | 170 } |
171 | 171 |
172 @Deprecated | |
173 // TODO(perkj): Remove when applications has been updated. | |
174 public void init( | |
175 EGLContext sharedContext, RendererCommon.RendererEvents rendererEvents) { | |
176 init(sharedContext != null ? new EglBase.Context(sharedContext) : null, rend
ererEvents); | |
177 } | |
178 | |
179 /** | 172 /** |
180 * Create and make an EGLSurface current if both init() and surfaceCreated() h
ave been called. | 173 * Create and make an EGLSurface current if both init() and surfaceCreated() h
ave been called. |
181 */ | 174 */ |
182 public void tryCreateEglSurface() { | 175 public void tryCreateEglSurface() { |
183 // |renderThreadHandler| is only created after |eglBase| is created in init(
), so the | 176 // |renderThreadHandler| is only created after |eglBase| is created in init(
), so the |
184 // following code will only execute if eglBase != null. | 177 // following code will only execute if eglBase != null. |
185 runOnRenderThread(new Runnable() { | 178 runOnRenderThread(new Runnable() { |
186 @Override public void run() { | 179 @Override public void run() { |
187 synchronized (layoutLock) { | 180 synchronized (layoutLock) { |
188 if (isSurfaceCreated && !eglBase.hasSurface()) { | 181 if (isSurfaceCreated && !eglBase.hasSurface()) { |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 if (framesReceived > 0 && framesRendered > 0) { | 560 if (framesReceived > 0 && framesRendered > 0) { |
568 final long timeSinceFirstFrameNs = System.nanoTime() - firstFrameTimeNs; | 561 final long timeSinceFirstFrameNs = System.nanoTime() - firstFrameTimeNs; |
569 Logging.d(TAG, getResourceName() + "Duration: " + (int) (timeSinceFirstF
rameNs / 1e6) + | 562 Logging.d(TAG, getResourceName() + "Duration: " + (int) (timeSinceFirstF
rameNs / 1e6) + |
570 " ms. FPS: " + framesRendered * 1e9 / timeSinceFirstFrameNs); | 563 " ms. FPS: " + framesRendered * 1e9 / timeSinceFirstFrameNs); |
571 Logging.d(TAG, getResourceName() + "Average render time: " | 564 Logging.d(TAG, getResourceName() + "Average render time: " |
572 + (int) (renderTimeNs / (1000 * framesRendered)) + " us."); | 565 + (int) (renderTimeNs / (1000 * framesRendered)) + " us."); |
573 } | 566 } |
574 } | 567 } |
575 } | 568 } |
576 } | 569 } |
OLD | NEW |