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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 EGLContext sharedContext, RendererCommon.RendererEvents rendererEvents) { | 156 EGLContext sharedContext, RendererCommon.RendererEvents rendererEvents) { |
157 synchronized (handlerLock) { | 157 synchronized (handlerLock) { |
158 if (renderThreadHandler != null) { | 158 if (renderThreadHandler != null) { |
159 throw new IllegalStateException(getResourceName() + "Already initialized
"); | 159 throw new IllegalStateException(getResourceName() + "Already initialized
"); |
160 } | 160 } |
161 Logging.d(TAG, getResourceName() + "Initializing."); | 161 Logging.d(TAG, getResourceName() + "Initializing."); |
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 = new EglBase(sharedContext, EglBase.ConfigType.PLAIN); | 166 eglBase = new EglBase(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 /** | 172 /** |
173 * 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. |
174 */ | 174 */ |
175 public void tryCreateEglSurface() { | 175 public void tryCreateEglSurface() { |
176 // |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 |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 if (framesReceived > 0 && framesRendered > 0) { | 560 if (framesReceived > 0 && framesRendered > 0) { |
561 final long timeSinceFirstFrameNs = System.nanoTime() - firstFrameTimeNs; | 561 final long timeSinceFirstFrameNs = System.nanoTime() - firstFrameTimeNs; |
562 Logging.d(TAG, getResourceName() + "Duration: " + (int) (timeSinceFirstF
rameNs / 1e6) + | 562 Logging.d(TAG, getResourceName() + "Duration: " + (int) (timeSinceFirstF
rameNs / 1e6) + |
563 " ms. FPS: " + (float) framesRendered * 1e9 / timeSinceFirstFrameNs)
; | 563 " ms. FPS: " + (float) framesRendered * 1e9 / timeSinceFirstFrameNs)
; |
564 Logging.d(TAG, getResourceName() + "Average render time: " | 564 Logging.d(TAG, getResourceName() + "Average render time: " |
565 + (int) (renderTimeNs / (1000 * framesRendered)) + " us."); | 565 + (int) (renderTimeNs / (1000 * framesRendered)) + " us."); |
566 } | 566 } |
567 } | 567 } |
568 } | 568 } |
569 } | 569 } |
OLD | NEW |