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 |
172 /** | 179 /** |
173 * Create and make an EGLSurface current if both init() and surfaceCreated() h
ave been called. | 180 * Create and make an EGLSurface current if both init() and surfaceCreated() h
ave been called. |
174 */ | 181 */ |
175 public void tryCreateEglSurface() { | 182 public void tryCreateEglSurface() { |
176 // |renderThreadHandler| is only created after |eglBase| is created in init(
), so the | 183 // |renderThreadHandler| is only created after |eglBase| is created in init(
), so the |
177 // following code will only execute if eglBase != null. | 184 // following code will only execute if eglBase != null. |
178 runOnRenderThread(new Runnable() { | 185 runOnRenderThread(new Runnable() { |
179 @Override public void run() { | 186 @Override public void run() { |
180 synchronized (layoutLock) { | 187 synchronized (layoutLock) { |
181 if (isSurfaceCreated && !eglBase.hasSurface()) { | 188 if (isSurfaceCreated && !eglBase.hasSurface()) { |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 if (framesReceived > 0 && framesRendered > 0) { | 567 if (framesReceived > 0 && framesRendered > 0) { |
561 final long timeSinceFirstFrameNs = System.nanoTime() - firstFrameTimeNs; | 568 final long timeSinceFirstFrameNs = System.nanoTime() - firstFrameTimeNs; |
562 Logging.d(TAG, getResourceName() + "Duration: " + (int) (timeSinceFirstF
rameNs / 1e6) + | 569 Logging.d(TAG, getResourceName() + "Duration: " + (int) (timeSinceFirstF
rameNs / 1e6) + |
563 " ms. FPS: " + framesRendered * 1e9 / timeSinceFirstFrameNs); | 570 " ms. FPS: " + framesRendered * 1e9 / timeSinceFirstFrameNs); |
564 Logging.d(TAG, getResourceName() + "Average render time: " | 571 Logging.d(TAG, getResourceName() + "Average render time: " |
565 + (int) (renderTimeNs / (1000 * framesRendered)) + " us."); | 572 + (int) (renderTimeNs / (1000 * framesRendered)) + " us."); |
566 } | 573 } |
567 } | 574 } |
568 } | 575 } |
569 } | 576 } |
OLD | NEW |