Methods Summary |
---|
public void | allowNewFrames()Re-enable drawing new frames after a call to {@link #ignoreNewFrames()}.
mGLHandlerThread.getHandler().sendEmptyMessage(MSG_ALLOW_FRAMES);
|
public android.graphics.SurfaceTexture | getCurrentSurfaceTexture()Get the underlying surface to produce frames from.
This returns the surface that is drawn into the set of surfaces passed in for each frame.
This method should only be called after a call to
{@link #setConfigurationAndWait(java.util.Collection)}. Calling this before the first call
to {@link #setConfigurationAndWait(java.util.Collection)}, after {@link #quit()}, or
concurrently to one of these calls may result in an invalid
{@link android.graphics.SurfaceTexture} being returned.
return mTextureRenderer.getSurfaceTexture();
|
public void | ignoreNewFrames()Ignore any subsequent calls to {@link #queueNewFrame(java.util.Collection)}.
mGLHandlerThread.getHandler().sendEmptyMessage(MSG_DROP_FRAMES);
|
public void | queueNewFrame()Queue a new call to draw into the surfaces specified in the next available preview
request from the {@link CaptureCollector} passed to
{@link #setConfigurationAndWait(java.util.Collection, CaptureCollector)};
Handler handler = mGLHandlerThread.getHandler();
/**
* Avoid queuing more than one new frame. If we are not consuming faster than frames
* are produced, drop frames rather than allowing the queue to back up.
*/
if (!handler.hasMessages(MSG_NEW_FRAME)) {
handler.sendMessage(handler.obtainMessage(MSG_NEW_FRAME));
} else {
Log.e(TAG, "GLThread dropping frame. Not consuming frames quickly enough!");
}
|
public void | quit()Quit the thread.
No further methods can be called after this.
Handler handler = mGLHandlerThread.getHandler();
handler.sendMessageAtFrontOfQueue(handler.obtainMessage(MSG_CLEANUP));
mGLHandlerThread.quitSafely();
try {
mGLHandlerThread.join();
} catch (InterruptedException e) {
Log.e(TAG, String.format("Thread %s (%d) interrupted while quitting.",
mGLHandlerThread.getName(), mGLHandlerThread.getId()));
}
|
public void | setConfigurationAndWait(java.util.Collection surfaces, CaptureCollector collector)Configure the GL renderer for the given set of output surfaces, and block until
this configuration has been applied.
checkNotNull(collector, "collector must not be null");
Handler handler = mGLHandlerThread.getHandler();
final ConditionVariable condition = new ConditionVariable(/*closed*/false);
ConfigureHolder configure = new ConfigureHolder(condition, surfaces, collector);
Message m = handler.obtainMessage(MSG_NEW_CONFIGURATION, /*arg1*/0, /*arg2*/0, configure);
handler.sendMessage(m);
// Block until configuration applied.
condition.block();
|
public void | start()Start the thread.
This must be called before queueing new frames.
mGLHandlerThread.start();
|
public void | waitUntilIdle()Wait until no messages are queued.
mGLHandlerThread.waitUntilIdle();
|
public void | waitUntilStarted()Wait until the thread has started.
mGLHandlerThread.waitUntilStarted();
|